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

From Test Wiki
Revision as of 04:46, 11 January 2023 by Euphoria (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(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(/शहर/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(नेपालीकरण);
    }
});