प्रयोगकर्ता:बडा काजी/एक शब्द प्रतिस्थापन.js
सूचना: सम्पादनहरू प्रकाशित गरेपछि, परिवर्तनहरू हेर्नको लागि तपाईंले आफ्नो ब्राउजरको क्यासलाई बाइपास गर्नुपर्छ। गुगल क्रोम, फायरफक्स, माइक्रोसफ्ट एज र सफारी: ⇧ Shift कुञ्जी थिचिराखेर रिलोड उपकरणपट्टी बटनमा थिच्नुहोस्।
$(document).ready(function() {
var प्रतिस्थापन= function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'एक शब्द प्रतिस्थापन': {
label: 'एक शब्द प्रतिस्थापन गर्नुहोस्',
type: 'button',
icon: 'https://upload.wikimedia.org/wikipedia/commons/8/8e/Devanagari_Conjunct_ChJha.svg',
action: {
type: 'callback',
execute: function() {
getText = $('#wpTextbox1').val();
x = getText.replace(/यहाँ नलेख्नुहोस् !!!!/g, "यहाँ नलेख्नुहोस् !!!!");
x = x.replace(/1/g, '१');
x = x.replace(/2/g, '२');
x = x.replace(/3/g, '३');
x = x.replace(/4/g, '४');
x = x.replace(/5/g, '५');
x = x.replace(/6/g, '६');
x = x.replace(/7/g, '७');
x = x.replace(/8/g, '८');
x = x.replace(/9/g, '९');
x = x.replace(/0/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(प्रतिस्थापन);
}
});