5 lines
		
	
	
		
			838 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			5 lines
		
	
	
		
			838 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * @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 n=document.createElement("textarea");return n.innerHTML=Joomla.sanitizeHtml(e),n.value},i=(e,n)=>{const l=n.nextElementSibling,m=window.Diff.diffWords(e.innerHTML,n.innerHTML),c=document.createDocumentFragment();m.forEach(o=>{let d="";o.added&&(d="#a6f3a6"),o.removed&&(d="#f8cbcb");const t=document.createElement("span");t.style.backgroundColor=d,t.style.borderRadius=".2rem",t.appendChild(document.createTextNode(r(o.value))),c.appendChild(t)}),l.appendChild(c)},a=()=>{document.querySelectorAll(".original").forEach(e=>i(e,e.nextElementSibling)),document.removeEventListener("DOMContentLoaded",a)};document.addEventListener("DOMContentLoaded",a)})();
 |