Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions build/media_source/com_templates/joomla.asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "com_templates.admin-template-compare.es5",
"type": "script",
"uri": "com_templates/admin-template-compare-es5.min.js",
"dependencies": [
"core",
"diff"
],
"attributes": {
"nomodule": true,
"defer": true
}
},
{
"name": "com_templates.admin-template-compare",
"type": "script",
"uri": "com_templates/admin-template-compare.min.js",
"dependencies": [
"com_templates.admin-template-compare.es5"
],
"attributes": {
"type": "module"
}
},
{
"name": "com_templates.admin-template-toggle-assignment.es5",
"type": "script",
Expand Down
63 changes: 63 additions & 0 deletions build/media_source/com_templates/js/admin-template-compare.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @deprecated This file is deprecated and will be removed with Joomla 5.0
*/
(() => {
'use strict';

document.addEventListener('DOMContentLoaded', () => {
const decodeHtmlspecialChars = (text) => {
const map = {
'&amp;': '&',
'&#038;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#039;': "'",
'&#8217;': '’',
'&#8216;': '‘',
'&#8211;': '–',
'&#8212;': '—',
'&#8230;': '…',
'&#8221;': '”',
};

/* eslint-disable */
return text.replace(/\&[\w\d\#]{2,5}\;/g, (m) => { const n = map[m]; return n; });
};

const compare = (original, changed) => {
const display = changed.nextElementSibling;
let color = '';
let pre = null;
const diff = Diff.diffLines(original.innerHTML, changed.innerHTML);
const fragment = document.createDocumentFragment();

/* eslint-enable */

diff.forEach((part) => {
if (part.added) {
color = '#a6f3a6';
} else if (part.removed) {
color = '#f8cbcb';
} else {
color = '';
}
pre = document.createElement('pre');
pre.style.backgroundColor = color;
pre.className = 'diffview';
pre.appendChild(document.createTextNode(decodeHtmlspecialChars(part.value)));
fragment.appendChild(pre);
});

display.appendChild(fragment);
};

const diffs = [].slice.call(document.querySelectorAll('#original'));
for (let i = 0, l = diffs.length; i < l; i += 1) {
compare(diffs[i], diffs[i].nextElementSibling);
}
});
})();
36 changes: 36 additions & 0 deletions build/media_source/com_users/js/admin-users-mail.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @deprecated This file is deprecated and will be removed with Joomla 5.0
*/

(() => {
'use strict';

document.addEventListener('DOMContentLoaded', () => {
Joomla.submitbutton = (pressbutton) => {
const form = document.adminForm;
const html = document.createElement('joomla-alert');

if (pressbutton === 'mail.cancel') {
Joomla.submitform(pressbutton);
return;
}

// do field validation
if (form.jform_subject.value === '') {
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_SUBJECT');
form.insertAdjacentElement('afterbegin', html);
} else if (form.jform_group.value < 0) {
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_SELECT_A_GROUP');
form.insertAdjacentElement('afterbegin', html);
} else if (form.jform_message.value === '') {
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_MESSAGE');
form.insertAdjacentElement('afterbegin', html);
} else {
Joomla.submitform(pressbutton);
}
};
});
})();