CoreFiles by mySites.guru
admin-article-readmore-es5.js33 lines, 992 bytes, from Joomla_4.0.3-Stable-Full_Package.zip
Raw History Compare with 4.0.2
md5
a935119aa4088fa7f4856c9b0366afb6
sha1
86286a8ef0b872059adc2cbd7cdd68a451a3bf6a
sha256
8703cb917973de428d1d145ec329059cb27b5a159d315ec7316e394cf976f278
(function () {
  'use strict';

  /**
   * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   */
  (function () {
    var options = window.Joomla.getOptions('xtd-readmore');

    window.insertReadmore = function (editor) {
      if (!options) {
        // Something went wrong!
        throw new Error('XTD Button \'read more\' not properly initialized');
      }

      var content = window.Joomla.editors.instances[editor].getValue();

      if (!content) {
        Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">');
      } else if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) {
        Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">');
      } else {
        // TODO replace with joomla-alert
        alert(options.exists);
        return false;
      }

      return true;
    };
  })();

}());

The same content is in 23 releases, Joomla 4.0.0-rc1 to 4.1.0-beta2. See them all, or every version of this file.