सदस्यः:IKHazarika/brahmi-converter.js
सूचना : भवता/भवत्या कृतानि सम्पादनानि संरक्ष्य तानि परिवर्तनेषु द्रष्टुं गवेषकस्य पृष्ठस्य पुनरारोपणम् (reload) आवश्यकं भवति ।
- Firefox / Safari: Shiftकुड्मलेन सह Reloadकुड्मलं नुदतु ।
- Google Chrome: Ctrl-Shift-R नोदनेन पुनरारोपणं भवति । (⌘-R इति Mac तन्त्रांशप्रयोक्तॄभ्यः)
- Internet Explorer: Ctrlकुड्मलेन सह Refreshकुड्मलं नुदतु, Ctrl-F5 नुदतु वा ।
- Opera: Tools → Preferences इत्यत्र गत्वा कर्तुं शक्नोति ।
(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, 'xyzabc')
.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, '𑁆')
.replace(/xyzabc/, 'देवनागरी');
}
}
// 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,'xyzabc')
.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, '्')
.replace(/xyzabc/g, '𑀩𑁆𑀭𑀸𑀳𑁆𑀫𑀻');
}
}
// Function to create the toggle button
function createToggleButton() {
var button = document.createElement('button');
button.textContent = '𑀩𑁆𑀭𑀸𑀳𑁆𑀫𑀻';
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')
})();