primo commit
This commit is contained in:
26
media/com_content/js/admin-article-pagebreak.js
Normal file
26
media/com_content/js/admin-article-pagebreak.js
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
(() => {
|
||||
|
||||
window.insertPagebreak = editor => {
|
||||
// Get the pagebreak title
|
||||
let title = document.getElementById('title').value;
|
||||
if (!window.parent.Joomla.getOptions('xtd-pagebreak')) {
|
||||
// Something went wrong!
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the pagebreak toc alias -- not inserting for now don't know which attribute to use..
|
||||
let alt = document.getElementById('alt').value;
|
||||
title = title !== '' ? `title="${title}"` : '';
|
||||
alt = alt !== '' ? `alt="${alt}"` : '';
|
||||
const tag = `<hr class="system-pagebreak" ${title} ${alt}>`;
|
||||
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
return false;
|
||||
};
|
||||
})();
|
||||
4
media/com_content/js/admin-article-pagebreak.min.js
vendored
Normal file
4
media/com_content/js/admin-article-pagebreak.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/window.insertPagebreak=a=>{let e=document.getElementById("title").value;if(!window.parent.Joomla.getOptions("xtd-pagebreak"))return window.parent.Joomla.Modal.getCurrent().close(),!1;let t=document.getElementById("alt").value;e=e!==""?`title="${e}"`:"",t=t!==""?`alt="${t}"`:"";const l=`<hr class="system-pagebreak" ${e} ${t}>`;return window.parent.Joomla.editors.instances[a].replaceSelection(l),window.parent.Joomla.Modal.getCurrent().close(),!1};
|
||||
BIN
media/com_content/js/admin-article-pagebreak.min.js.gz
Normal file
BIN
media/com_content/js/admin-article-pagebreak.min.js.gz
Normal file
Binary file not shown.
29
media/com_content/js/admin-article-readmore.js
Normal file
29
media/com_content/js/admin-article-readmore.js
Normal file
@ -0,0 +1,29 @@
|
||||
import { JoomlaEditor, JoomlaEditorButton } from 'editor-api';
|
||||
import JoomlaDialog from 'joomla.dialog';
|
||||
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
const insertReadmoreHandler = editor => {
|
||||
const content = editor.getValue();
|
||||
if (!content) {
|
||||
editor.replaceSelection('<hr id="system-readmore">');
|
||||
} else if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) {
|
||||
editor.replaceSelection('<hr id="system-readmore">');
|
||||
} else {
|
||||
JoomlaDialog.alert(Joomla.Text._('PLG_READMORE_ALREADY_EXISTS'));
|
||||
}
|
||||
};
|
||||
|
||||
// @TODO: Remove in Joomla 6
|
||||
window.insertReadmore = () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Method window.insertReadmore() is deprecated, use button action "insert-readmore."');
|
||||
const editor = JoomlaEditor.getActive();
|
||||
if (!editor) {
|
||||
throw new Error('An active editor are not available');
|
||||
}
|
||||
insertReadmoreHandler(editor);
|
||||
};
|
||||
JoomlaEditorButton.registerAction('insert-readmore', insertReadmoreHandler);
|
||||
4
media/com_content/js/admin-article-readmore.min.js
vendored
Normal file
4
media/com_content/js/admin-article-readmore.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import{JoomlaEditor as t,JoomlaEditorButton as i}from"editor-api";import a from"joomla.dialog";/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/const r=e=>{const o=e.getValue();o?o&&!o.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)?e.replaceSelection('<hr id="system-readmore">'):a.alert(Joomla.Text._("PLG_READMORE_ALREADY_EXISTS")):e.replaceSelection('<hr id="system-readmore">')};window.insertReadmore=()=>{console.warn('Method window.insertReadmore() is deprecated, use button action "insert-readmore."');const e=t.getActive();if(!e)throw new Error("An active editor are not available");r(e)},i.registerAction("insert-readmore",r);
|
||||
BIN
media/com_content/js/admin-article-readmore.min.js.gz
Normal file
BIN
media/com_content/js/admin-article-readmore.min.js.gz
Normal file
Binary file not shown.
33
media/com_content/js/admin-articles-default-batch-footer.js
Normal file
33
media/com_content/js/admin-articles-default-batch-footer.js
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
((document, submitForm) => {
|
||||
|
||||
// Selectors used by this script
|
||||
const buttonDataSelector = 'data-submit-task';
|
||||
const formId = 'adminForm';
|
||||
|
||||
/**
|
||||
* Submit the task
|
||||
* @param task
|
||||
*/
|
||||
const submitTask = task => {
|
||||
const form = document.getElementById(formId);
|
||||
if (form && task === 'article.batch') {
|
||||
submitForm(task, form);
|
||||
}
|
||||
};
|
||||
|
||||
// Register events
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const button = document.getElementById('batch-submit-button-id');
|
||||
if (button) {
|
||||
button.addEventListener('click', e => {
|
||||
const task = e.target.getAttribute(buttonDataSelector);
|
||||
submitTask(task);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
})(document, Joomla.submitform);
|
||||
4
media/com_content/js/admin-articles-default-batch-footer.min.js
vendored
Normal file
4
media/com_content/js/admin-articles-default-batch-footer.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/((n,o)=>{const a="data-submit-task",s="adminForm",i=t=>{const e=n.getElementById(s);e&&t==="article.batch"&&o(t,e)};n.addEventListener("DOMContentLoaded",()=>{const t=n.getElementById("batch-submit-button-id");t&&t.addEventListener("click",e=>{const r=e.target.getAttribute(a);return i(r),!1})})})(document,Joomla.submitform);
|
||||
Binary file not shown.
32
media/com_content/js/admin-articles-default-stage-footer.js
Normal file
32
media/com_content/js/admin-articles-default-stage-footer.js
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
((document, submitForm) => {
|
||||
|
||||
// Selectors used by this script
|
||||
const buttonDataSelector = 'data-submit-task';
|
||||
const formId = 'adminForm';
|
||||
|
||||
/**
|
||||
* Submit the task
|
||||
* @param task
|
||||
*/
|
||||
const submitTask = task => {
|
||||
const form = document.getElementById(formId);
|
||||
if (form) {
|
||||
submitForm(task, form);
|
||||
}
|
||||
};
|
||||
|
||||
// Register events
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const button = document.getElementById('stage-submit-button-id');
|
||||
if (button) {
|
||||
button.addEventListener('click', e => {
|
||||
const task = e.target.getAttribute(buttonDataSelector);
|
||||
submitTask(task);
|
||||
});
|
||||
}
|
||||
});
|
||||
})(document, Joomla.submitform);
|
||||
4
media/com_content/js/admin-articles-default-stage-footer.min.js
vendored
Normal file
4
media/com_content/js/admin-articles-default-stage-footer.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/((n,o)=>{const s="data-submit-task",a="adminForm",i=t=>{const e=n.getElementById(a);e&&o(t,e)};n.addEventListener("DOMContentLoaded",()=>{const t=n.getElementById("stage-submit-button-id");t&&t.addEventListener("click",e=>{const d=e.target.getAttribute(s);i(d)})})})(document,Joomla.submitform);
|
||||
Binary file not shown.
53
media/com_content/js/admin-articles-modal.js
Normal file
53
media/com_content/js/admin-articles-modal.js
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
(() => {
|
||||
|
||||
// Use a JoomlaExpectingPostMessage flag to be able to distinct legacy methods
|
||||
if (window.parent.JoomlaExpectingPostMessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Javascript to insert the link
|
||||
* View element calls jSelectArticle when an article is clicked
|
||||
* jSelectArticle creates the link tag, sends it to the editor,
|
||||
* and closes the select frame.
|
||||
* */
|
||||
window.jSelectArticle = (id, title, catid, object, link, lang) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Method jSelectArticle() is deprecated. Use postMessage() instead.');
|
||||
if (!Joomla.getOptions('xtd-articles')) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
editor
|
||||
} = Joomla.getOptions('xtd-articles');
|
||||
const tag = `<a href="${link}"${lang !== '' ? ` hreflang="${lang}"` : ''}>${title}</a>`;
|
||||
window.parent.Joomla.editors.instances[editor].replaceSelection(tag);
|
||||
if (window.parent.Joomla.Modal && window.parent.Joomla.Modal.getCurrent()) {
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
}
|
||||
};
|
||||
document.querySelectorAll('.select-link').forEach(element => {
|
||||
// Listen for click event
|
||||
element.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
const {
|
||||
target
|
||||
} = event;
|
||||
const functionName = target.getAttribute('data-function');
|
||||
if (functionName === 'jSelectArticle' && window[functionName]) {
|
||||
// Used in xtd_contacts
|
||||
window[functionName](target.getAttribute('data-id'), target.getAttribute('data-title'), target.getAttribute('data-cat-id'), null, target.getAttribute('data-uri'), target.getAttribute('data-language'));
|
||||
} else if (window.parent[functionName]) {
|
||||
// Used in com_menus
|
||||
window.parent[functionName](target.getAttribute('data-id'), target.getAttribute('data-title'), target.getAttribute('data-cat-id'), null, target.getAttribute('data-uri'), target.getAttribute('data-language'));
|
||||
}
|
||||
if (window.parent.Joomla.Modal && window.parent.Joomla.Modal.getCurrent()) {
|
||||
window.parent.Joomla.Modal.getCurrent().close();
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
4
media/com_content/js/admin-articles-modal.min.js
vendored
Normal file
4
media/com_content/js/admin-articles-modal.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/window.parent.JoomlaExpectingPostMessage||(window.jSelectArticle=(o,a,t,e,n,i)=>{if(console.warn("Method jSelectArticle() is deprecated. Use postMessage() instead."),!Joomla.getOptions("xtd-articles"))return;const{editor:r}=Joomla.getOptions("xtd-articles"),d=`<a href="${n}"${i!==""?` hreflang="${i}"`:""}>${a}</a>`;window.parent.Joomla.editors.instances[r].replaceSelection(d),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()},document.querySelectorAll(".select-link").forEach(o=>{o.addEventListener("click",a=>{a.preventDefault();const{target:t}=a,e=t.getAttribute("data-function");e==="jSelectArticle"&&window[e]?window[e](t.getAttribute("data-id"),t.getAttribute("data-title"),t.getAttribute("data-cat-id"),null,t.getAttribute("data-uri"),t.getAttribute("data-language")):window.parent[e]&&window.parent[e](t.getAttribute("data-id"),t.getAttribute("data-title"),t.getAttribute("data-cat-id"),null,t.getAttribute("data-uri"),t.getAttribute("data-language")),window.parent.Joomla.Modal&&window.parent.Joomla.Modal.getCurrent()&&window.parent.Joomla.Modal.getCurrent().close()})}));
|
||||
BIN
media/com_content/js/admin-articles-modal.min.js.gz
Normal file
BIN
media/com_content/js/admin-articles-modal.min.js.gz
Normal file
Binary file not shown.
21
media/com_content/js/articles-list.js
Normal file
21
media/com_content/js/articles-list.js
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
(document => {
|
||||
|
||||
const onClick = () => {
|
||||
const form = document.getElementById('adminForm');
|
||||
document.getElementById('filter-search').value = '';
|
||||
form.submit();
|
||||
};
|
||||
const onBoot = () => {
|
||||
const form = document.getElementById('adminForm');
|
||||
const element = form.querySelector('button[type="reset"]');
|
||||
if (element) {
|
||||
element.addEventListener('click', onClick);
|
||||
}
|
||||
document.removeEventListener('DOMContentLoaded', onBoot);
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', onBoot);
|
||||
})(document);
|
||||
4
media/com_content/js/articles-list.min.js
vendored
Normal file
4
media/com_content/js/articles-list.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/(e=>{const r=()=>{const n=e.getElementById("adminForm");e.getElementById("filter-search").value="",n.submit()},t=()=>{const o=e.getElementById("adminForm").querySelector('button[type="reset"]');o&&o.addEventListener("click",r),e.removeEventListener("DOMContentLoaded",t)};e.addEventListener("DOMContentLoaded",t)})(document);
|
||||
BIN
media/com_content/js/articles-list.min.js.gz
Normal file
BIN
media/com_content/js/articles-list.min.js.gz
Normal file
Binary file not shown.
13
media/com_content/js/articles-status.js
Normal file
13
media/com_content/js/articles-status.js
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
(() => {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.article-status').forEach(element => {
|
||||
element.addEventListener('click', event => event.stopPropagation());
|
||||
});
|
||||
});
|
||||
})();
|
||||
4
media/com_content/js/articles-status.min.js
vendored
Normal file
4
media/com_content/js/articles-status.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".article-status").forEach(e=>{e.addEventListener("click",t=>t.stopPropagation())})});
|
||||
BIN
media/com_content/js/articles-status.min.js.gz
Normal file
BIN
media/com_content/js/articles-status.min.js.gz
Normal file
Binary file not shown.
32
media/com_content/js/form-edit.js
Normal file
32
media/com_content/js/form-edit.js
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
((document, submitForm) => {
|
||||
|
||||
// Selectors used by this script
|
||||
const buttonDataSelector = 'data-submit-task';
|
||||
const formId = 'adminForm';
|
||||
|
||||
/**
|
||||
* Submit the task
|
||||
* @param task
|
||||
*/
|
||||
const submitTask = task => {
|
||||
const form = document.getElementById(formId);
|
||||
if (task === 'article.cancel' || document.formvalidator.isValid(form)) {
|
||||
submitForm(task, form);
|
||||
}
|
||||
};
|
||||
|
||||
// Register events
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll(`[${buttonDataSelector}]`).forEach(button => {
|
||||
button.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
const task = e.target.getAttribute(buttonDataSelector);
|
||||
submitTask(task);
|
||||
});
|
||||
});
|
||||
});
|
||||
})(document, Joomla.submitform);
|
||||
4
media/com_content/js/form-edit.min.js
vendored
Normal file
4
media/com_content/js/form-edit.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/((e,r)=>{const o="data-submit-task",n="adminForm",i=a=>{const t=e.getElementById(n);(a==="article.cancel"||e.formvalidator.isValid(t))&&r(a,t)};e.addEventListener("DOMContentLoaded",()=>{e.querySelectorAll(`[${o}]`).forEach(a=>{a.addEventListener("click",t=>{t.preventDefault();const s=t.target.getAttribute(o);i(s)})})})})(document,Joomla.submitform);
|
||||
BIN
media/com_content/js/form-edit.min.js.gz
Normal file
BIN
media/com_content/js/form-edit.min.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user