Sha256: 7880b51210ca8d6ff3b6783fdc94f7a748698b453617011abc6d1cd624c88cd5

Contents?: true

Size: 1.21 KB

Versions: 55

Compression:

Stored size: 1.21 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

55 entries across 55 versions & 1 rubygems

Version Path
mumuki-laboratory-9.9.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.8.2 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.8.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.8.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.7.2 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.7.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.7.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.6.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.5.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.5.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.4.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.4.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.3.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.3.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.2.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.1.3 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.1.2 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.1.1 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.1.0 app/assets/javascripts/mumuki_laboratory/application/elipsis.js
mumuki-laboratory-9.0.6 app/assets/javascripts/mumuki_laboratory/application/elipsis.js