ବ୍ୟବହାରକାରୀ:Radhadwibedi/converter.js
ସୂଚନା: ବଦଳଗୁଡ଼ିକ ଦେଖିବା ପାଇଁ ଆପଣଙ୍କୁ ହୁଏତ ନିଜ ବ୍ରାଉଜର କ୍ୟାସ ବାଇପାସ କରିବାକୁ ପଡ଼ିପାରେ ।
- Firefox / Safari: Reload ଉପରେ କ୍ଲିକ କରିବା ବେଳେ Shift ଧରି କିମ୍ବା Ctrl-F5 ବା Ctrl-R ଦବାନ୍ତୁ (Macରେ ⌘-R)
- Google Chrome: Ctrl-Shift-R ଦବାନ୍ତୁ (Macରେ ⌘-Shift-R)
- Internet Explorer / Edge: Refresh ଉପରେ କ୍ଲିକ କଲା ବେଳେ Ctrl ଧରି ବା Ctrl-F5 ଦବାଇ
- Opera: Ctrl-F5 ଦବାନ୍ତୁ ।
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
// from https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#action
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( callConverter );
}
} );
}
var callConverter = function(){
//Add New Section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'converter': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'କନଭର୍ଟର',
// 'labelMsg': 'section-converter-label'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'converter',
'groups': {
'converters': {
'label': 'କନଭର୍ଟର ଗୁଡିକ' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'converter',
'group': 'converters',
'tools': {
'akruti': {
label: 'Akruti', // or use labelMsg for a localized label, see above
type: 'button',
text: "Akruti",
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'callback',
execute: function () {
checkInput();
convert('akruti');
}
}
},
'sreelipi': {
label: 'Sreelipi', // or use labelMsg for a localized label, see above
type: 'button',
text: "sreelipi",
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'callback',
execute: function () {
checkInput();
convert('sreelipi');
}
}
},
'gist': {
label: 'Gist', // or use labelMsg for a localized label, see above
type: 'button',
text: "gist",
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'callback',
execute: function () {
checkInput();
convert('gist');
}
}
},
'apranta': {
label: 'Apranta', // or use labelMsg for a localized label, see above
type: 'button',
text: "apranta",
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'callback',
execute: function () {
checkInput();
convert('apranta');
}
}
},
'sambad': {
label: 'Sambad', // or use labelMsg for a localized label, see above
type: 'button',
text: "sambad",
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'callback',
execute: function () {
checkInput();
convert('sambad');
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
groups: {
list: {
tools: {
templates: {
label: 'Templates',
type: 'select',
list: {
'Ping-button': {
label: '{{Ping}}',
action: {
type: 'encapsulate',
options: {
pre: '{{Ping|',
post: '}}'
}
}
},
'Clear-button': {
label: 'Clear',
action: {
type: 'encapsulate',
options: {
pre: '{{Clear}}'
}
}
},
'Done-button': {
label: 'Done',
action: {
type: 'encapsulate',
options: {
pre: '{{Done}}'
}
}
}
}
}
}
}
}
} );
};
function convert(type) {
$.ajax({
url:'https://jsahu.me/ouc/',
type:"POST",
// dataType: 'jsonp',
data: { input_text: $( '#ascii_text' ).val(), type: type}
}).done(function(data) {
$("#wpTextbox1").val(data);
});
}
function checkInput() {
if ($('#ascii_text').length <= 0) {
$("<input type='hidden' id='ascii_text' />").appendTo('body');
$('#ascii_text').val($( '#wpTextbox1' ).val());
}
}