User:দিব্য দত্ত/Script/InsertCh.js
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.
/*
@Author [[User:দিব্য দত্ত]]
*/
if( urlbyPageId === undefined ) {
var urlbyPageId = {
Lcbtn: 'গুগল অচিআৰৰ যোগেদি পাঠোদ্ধাৰ কৰক আৰু কেইটামান সাধাৰণ ভুল প্ৰতিস্থাপন কৰক!'
}
}
$(function Pratisthapon() {
var pageId = mw.config.get('wgArticleId');
var div = document.createElement('div');
div.style ='position: fixed; left:350px; top:100px; display:block;';
div.id = 'iconForUrl';
function createIcon(imageSrc, imgTooltip) {
var element = document.createElement('img');
element.className = 'image';
element.width = '57';
element.height = '60';
element.src = imageSrc;
element.title = imgTooltip;
var divForIcon = document.createElement('div');
divForIcon.appendChild(element);
return divForIcon;
}
var elements = {
lachitIcon: createIcon(
'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Dibya.jpg/233px-Dibya.jpg',
urlbyPageId.Lcbtn
)
};
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) === -1 ) {
// View mode
$(div).append();
} else {
// Edit mode
$(div).append(elements.lachitIcon);
};
$('#mw-content-text').after( div );
$(elements.lachitIcon).on('click', function(){
getText = $('#wpTextbox1').val();
newText = getText.replace(/ +/g, " ");
newText = newText.replace(/ন্ট/g, 'ণ্ট');
newText = newText.replace(/{ku/g, '{{কুসুমমালা|<poem>');
newText = newText.replace(/pmpm/g, '</poem>|<poem>');
newText = newText.replace(/কক্স/g, 'ৰুক্ম');
newText = newText.replace(/gp4/g, '{{gap|4em}}');
newText = newText.replace(/gp3/g, '{{gap|3em}}');
newText = newText.replace(/{blc/g, '{{Block center|<poem>');
newText = newText.replace(/pm}}/g, '</poem>}}');
newText = newText.replace(/{cn/g, '{{center|');
newText = newText.replace(/।।/g, '॥');
newText = newText.replace(/।৷/g, '॥');
newText = newText.replace(/gp/g, '{{gap}}');
$('#wpTextbox1').val(newText);
});
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
$.when(mw.loader.using('ext.wikiEditor'), $.ready)
.then(Pratisthapon);
}
});