सदस्यः:IKHazarika/savingJS
दिखावट
(function() { console.log('Hello world')
// Function to replace characters function replaceCharacters() { var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false); var node;
while (node = walker.nextNode()) { node.nodeValue = node.nodeValue .replace(/क/g, 'ক') .replace(/र/g, 'ৰ') .replace(/ख/g, 'খ') .replace(/ग/g, 'গ') .replace(/घ/g, 'ঘ') .replace(/ङ/g, 'ঙ') .replace(/च/g, 'চ') .replace(/छ/g, 'ছ') .replace(/ज/g, 'জ') .replace(/झ/g, 'ঝ') .replace(/ञ/g, 'ঞ') .replace(/ट/g, 'ট') .replace(/ठ/g, 'ঠ') .replace(/ड/g, 'ড') .replace(/ढ/g, 'ঢ') .replace(/ण/g, 'ণ') .replace(/त/g, 'ত') .replace(/थ/g, 'থ') .replace(/द/g, 'দ') .replace(/ध/g, 'ধ') .replace(/न/g, 'ন') .replace(/प/g, 'প') .replace(/फ/g, 'ফ') .replace(/ब/g, 'ব') .replace(/भ/g, 'ভ') .replace(/म/g, 'ম') .replace(/य/g, 'য') .replace(/ल/g, 'ল') .replace(/व/g, 'ৱ') .replace(/श/g, 'শ') .replace(/ष/g, 'ষ') .replace(/स/g, 'স') .replace(/ह/g, 'হ') .replace(/अ/g, 'অ') .replace(/आ/g, 'আ') .replace(/इ/g, 'ই') .replace(/ई/g, 'ঈ') .replace(/उ/g, 'উ') .replace(/ऊ/g, 'ঊ') .replace(/ऋ/g, 'ঋ') .replace(/ए/g, 'এ') .replace(/ऐ/g, 'ঐ') .replace(/ओ/g, 'ও') .replace(/औ/g, 'ঔ') .replace(/ा/g, 'া') .replace(/ि/g, 'ি') .replace(/ी/g, 'ী') .replace(/ु/g, 'ু') .replace(/ू/g, 'ূ') .replace(/ृ/g, 'ৃ') .replace(/े/g, 'ে') .replace(/ै/g, 'ৈ') .replace(/ो/g, 'ো') .replace(/ौ/g, 'ৌ') .replace(/ं/g, 'ং') .replace(/ः/g, 'ঃ') .replace(/ँ/g, 'ঁ') .replace(/्/g, '্'); } }
// Function to undo the replacements function undoReplacements() { var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false); var node;
while (node = walker.nextNode()) { node.nodeValue = node.nodeValue .replace(/ক/g, 'क') .replace(/ৰ/g, 'र') .replace(/খ/g, 'ख') .replace(/গ/g, 'ग') .replace(/ঘ/g, 'घ') .replace(/ঙ/g, 'ङ') .replace(/চ/g, 'च') .replace(/ছ/g, 'छ') .replace(/জ/g, 'ज') .replace(/ঝ/g, 'झ') .replace(/ঞ/g, 'ञ') .replace(/ট/g, 'ट') .replace(/ঠ/g, 'ठ') .replace(/ড/g, 'ड') .replace(/ঢ/g, 'ढ') .replace(/ণ/g, 'ण') .replace(/ত/g, 'त') .replace(/থ/g, 'थ') .replace(/দ/g, 'द') .replace(/ধ/g, 'ध') .replace(/ন/g, 'न') .replace(/প/g, 'प') .replace(/ফ/g, 'फ') .replace(/ব/g, 'ब') .replace(/ভ/g, 'भ') .replace(/ম/g, 'म') .replace(/য/g, 'य') .replace(/ল/g, 'ल') .replace(/ৱ/g, 'व') .replace(/শ/g, 'श') .replace(/ষ/g, 'ष') .replace(/স/g, 'स') .replace(/হ/g, 'ह') .replace(/অ/g, 'अ') .replace(/আ/g, 'आ') .replace(/ই/g, 'इ') .replace(/ঈ/g, 'ई') .replace(/উ/g, 'उ') .replace(/ঊ/g, 'ऊ') .replace(/ঋ/g, 'ऋ') .replace(/এ/g, 'ए') .replace(/ঐ/g, 'ऐ') .replace(/ও/g, 'ओ') .replace(/ঔ/g, 'औ') .replace(/া/g, 'ा') .replace(/ি/g, 'ि') .replace(/ী/g, 'ी') .replace(/ু/g, 'ु') .replace(/ূ/g, 'ू') .replace(/ৃ/g, 'ृ') .replace(/ে/g, 'े') .replace(/ৈ/g, 'ै') .replace(/ো/g, 'ो') .replace(/ৌ/g, 'ौ') .replace(/ং/g, 'ं') .replace(/ঃ/g, 'ः') .replace(/ঁ/g, 'ँ') .replace(/্/g, '्'); } }
// Function to create the toggle button function createToggleButton() { var button = document.createElement('button'); button.textContent = 'Toggle Script'; button.style.position = 'fixed'; button.style.top = '50px'; button.style.right = '10px'; button.style.zIndex = '1000'; button.style.padding = '10px'; button.style.backgroundColor = '#007bff'; button.style.color = '#ffffff'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer';
// Add event listener to toggle the replacements var isReplaced = false; button.addEventListener('click', function() { if (isReplaced) { undoReplacements(); isReplaced = false; } else { replaceCharacters(); isReplaced = true; } });
// Append the button to the body document.body.appendChild(button); }
// Run the function after the page has fully loaded setTimeout(createToggleButton, 3000); //document.addEventListener('DOMContentLoaded', createToggleButton); console.log('ok world')
})();