User:Euphoria/नेपालीकरण.js: Difference between revisions

From Test Wiki
Jump to navigation Jump to search
Content deleted Content added
No edit summary
Tag: Reverted
Undo revision 34134 by Euphoria (talk)
Tag: Undo
Line 17: Line 17:
x = getText.replace(/यहाँ नलेख्नुहोस् !!!!/g, "यहाँ नलेख्नुहोस् !!!!");
x = getText.replace(/यहाँ नलेख्नुहोस् !!!!/g, "यहाँ नलेख्नुहोस् !!!!");


x = x.replace(/cat/g, 'dog');
x = x.replace(/\bcat\b/g, 'dog');
x = x.replace(/(?:\P{Xwd}|\A)शहर(?:\P{Xwd}|\Z)/g, 'सहर');


$('#wpTextbox1').val(x);
$('#wpTextbox1').val(x);

Revision as of 14:05, 26 December 2023

$(document).ready(function() {

    var नेपालीकरण = function() {
        $('#wpTextbox1').wikiEditor('addToToolbar', {
            'section': 'main',
            'group': 'insert',
            'tools': {
                'नेपालीकरण': {
                    label: 'नेपालीकरण गर्नुहोस्',
                    type: 'button',
        			icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c6/Devanagari_ah.svg/24px-Devanagari_ah.svg.png',
                    action: {
                        type: 'callback',
                        execute: function() {
                        
getText = $('#wpTextbox1').val();
x = getText.replace(/यहाँ नलेख्नुहोस् !!!!/g, "यहाँ नलेख्नुहोस् !!!!");

   x = x.replace(/\bcat\b/g, 'dog');
   x = x.replace(/(?:\P{Xwd}|\A)शहर(?:\P{Xwd}|\Z)/g, 'सहर');

$('#wpTextbox1').val(x);
document.getElementById('wpSummary').value += "एक उपकरण प्रयोग गरेर व्याकरण ठीक गरियो";
document.editform.wpMinoredit.checked = true;
document.editform.wpDiff.click()

                        }
                    }
                }
            }
        });

    };
    
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
    if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
        $.when(mw.loader.using('ext.wikiEditor'), $.ready)
            .then(नेपालीकरण);
    }
});