Sha256: da00edcb8a423fa8a224db6a225a8ba78f11f342f2d73b0fd36904702d1a8f6d

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

// This module defines three client-side-only special sections, and allows them to be replaced
// by adding the `mu-elipsis` class, or by calling `mumuki.elipsis()`:
//
// * <elipsis-for-student@ ...code... @elipsis-for-student>                     : replaces code with an elipsis
// * <hidden-for-student@ ...code... @hidden-for-student>                       : completely hides code
// * <description-for-student[...text...]@ ...code... @description-for-student> : replaces code a message sourrounded by elipsis
//
//
// This module assumes the strings are already markdown-like escaped code strings, not plain code
mumuki.elipsis = (() => {

  function elipsis(code) {
    return code
      .replace(/&lt;elipsis-for-student@[\s\S]*?@elipsis-for-student&gt;/g, ' ... ')
      .replace(/&lt;hidden-for-student@[\s\S]*?@hidden-for-student&gt;/g, '')
      .replace(/&lt;description-for-student\[([^\]]*)\]@[\s\S]*?@description-for-student&gt;/g, ' ... $1 ... ');
  }

  elipsis.replaceHtml = () => {
    let $elipsis = $('.mu-elipsis');
    $elipsis.each((it, e) =>  {
      let $e = $(e);
      $e.html(mumuki.elipsis($e.html()));
    })
  };

  mumuki.load(() => {
    mumuki.elipsis.replaceHtml();
  });

  return elipsis;
})();

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mumuki-laboratory-8.1.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-8.1.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.12.3 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-8.0.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.12.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.12.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.11.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.11.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.5 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.4 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.3 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.2 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.10.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.9.2 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.9.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.9.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-7.8.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js