This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
64 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
(() => { | ||
'use strict'; | ||
|
||
window.insertReadmore = (editor) => { | ||
if (!Joomla.getOptions('xtd-readmore')) { | ||
// Something went wrong! | ||
return false; | ||
} | ||
|
||
let content; | ||
const options = window.Joomla.getOptions('xtd-readmore'); | ||
|
||
if (window.Joomla && window.Joomla.editors && window.Joomla.editors.instances | ||
&& window.Joomla.editors.instances.hasOwnProperty.call(editor)) { | ||
content = window.Joomla.editors.instances[editor].getValue(); | ||
} else { | ||
content = () => options.editor; | ||
} | ||
|
||
if (!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; | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
/** | ||
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION. | ||
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD. | ||
**/ | ||
|
||
/** | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
(function () { | ||
'use strict'; | ||
|
||
window.insertReadmore = function(editor) { | ||
"use strict"; | ||
if (!Joomla.getOptions('xtd-readmore')) { | ||
// Something went wrong! | ||
return false; | ||
} | ||
window.insertReadmore = function (editor) { | ||
if (!Joomla.getOptions('xtd-readmore')) { | ||
// Something went wrong! | ||
return false; | ||
} | ||
|
||
var content, options = window.Joomla.getOptions('xtd-readmore'); | ||
var content = void 0; | ||
var options = window.Joomla.getOptions('xtd-readmore'); | ||
|
||
if (window.Joomla && window.Joomla.editors && window.Joomla.editors.instances && window.Joomla.editors.instances.hasOwnProperty(editor)) { | ||
content = window.Joomla.editors.instances[editor].getValue(); | ||
} else { | ||
content = (new Function('return ' + options.editor))(); | ||
} | ||
if (window.Joomla && window.Joomla.editors && window.Joomla.editors.instances && window.Joomla.editors.instances.hasOwnProperty.call(editor)) { | ||
content = window.Joomla.editors.instances[editor].getValue(); | ||
} else { | ||
content = function content() { | ||
return options.editor; | ||
}; | ||
} | ||
|
||
if (content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) { | ||
alert(options.exists); | ||
return false; | ||
} else { | ||
Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">'); | ||
} | ||
}; | ||
if (!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; | ||
}; | ||
})(); |