[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 /** 2 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 (() => { 6 7 document.addEventListener('DOMContentLoaded', () => { 8 const decodeHtmlspecialChars = text => { 9 const map = { 10 '&': '&', 11 '&': '&', 12 '<': '<', 13 '>': '>', 14 '"': '"', 15 ''': "'", 16 '’': '’', 17 '‘': '‘', 18 '–': '–', 19 '—': '—', 20 '…': '…', 21 '”': '”' 22 }; 23 /* eslint-disable */ 24 25 return text.replace(/\&[\w\d\#]{2,5}\;/g, m => { 26 const n = map[m]; 27 return n; 28 }); 29 }; 30 31 const compare = (original, changed) => { 32 const display = changed.nextElementSibling; 33 let color = ''; 34 let pre = null; 35 const diff = Diff.diffLines(original.innerHTML, changed.innerHTML); 36 const fragment = document.createDocumentFragment(); 37 /* eslint-enable */ 38 39 diff.forEach(part => { 40 if (part.added) { 41 color = '#a6f3a6'; 42 } else if (part.removed) { 43 color = '#f8cbcb'; 44 } else { 45 color = ''; 46 } 47 48 pre = document.createElement('pre'); 49 pre.style.backgroundColor = color; 50 pre.className = 'diffview'; 51 pre.appendChild(document.createTextNode(decodeHtmlspecialChars(part.value))); 52 fragment.appendChild(pre); 53 }); 54 display.appendChild(fragment); 55 }; 56 57 const diffs = [].slice.call(document.querySelectorAll('#original')); 58 59 for (let i = 0, l = diffs.length; i < l; i += 1) { 60 compare(diffs[i], diffs[i].nextElementSibling); 61 } 62 }); 63 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |