ব্যবহারকারী:Pmlineditor/quickcreate.js
লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।
- ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
- ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
- অপেরা: Ctrl-F5 টিপুন।
( function( $ ) {
// Don't load twice...
if ( typeof window.BengaliWiktCreateScript !== 'undefined' ) {
return false;
}
window.BengaliWiktCreateScript = {
version: '0.0.1',
/* Initialize the script */
init: function () {
if( mw.config.get( 'wgNamespaceNumber' ) === 0 && mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgAction' ) === 'edit') {
var menuId = ( skin === 'vector' ? '#p-cactions > .menu > ul' : '#p-cactions > .pBody > ul' );
$( menuId ).append( '<li id="page-create"></li>' );
$('<a />').text('Accelerated page creation').attr('href', '#').click( function () {
BengaliWiktCreateScript.createPopUpForm();
} ).appendTo( '#page-create' );
}
},
/* Create the pop-up form */
createPopUpForm: function () {
var popupHTML = '<section style="left: 50%; top: 50px; width: 1000px; z-index: 20000002; margin-left: -520px;" class="modalWrapper">'
+'<span class="quickrfd-closebutton" onclick="BengaliWiktCreateScript.closePopUpForm()"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Crystal_button_cancel.svg/18px-Crystal_button_cancel.svg.png"></span>'
+'<h1>Accelerated entry addition</h1>'
+'<section class="modalContent">'
+'<div class="AcceleratedEntryBox" id="AcceleratedEntryBox">'
+'<form class="AcceleratedEntryForm">'
+'<fieldset>'
+'<p><label for="bnw-speech">Part of speech: </label><select id="bnw-speech" style="width: 20em;"><option value="বিশেষ্য ">বিশেষ্য</option><option value=" বিশেষণ "> বিশেষণ </option><option value=" ক্রিয়া ">ক্রিয়া </option><option value="সর্বনাম">সর্বনাম </option><option value="অব্যয়">অব্যয় </option></select></p>'
+'<p><label for="bnw-entry">Entry: </label><input type="text" style="width: 70em;" id="bnw-entry" /></p>'
+'<p><label for="bnw-usage">Usage: </label><input type="text" style="width: 70em;" id="bnw-usage" /></p>'
+'<p><label for="bnw-eng">English: </label><input type="text" style="width: 70em;" id="bnw-eng" /></p>'
+'<p><label for="bnw-source">Reference: </label><input type="text" style="width: 65em;" id="bnw-source" /></p>'
+'</fieldset>'
+'<input type="button" id="bnw-startbutton" value="Submit" onclick="BengaliWiktCreateScript.createPage()" />'
+'</form>'
+'</div>'
+'</section>'
+'</section>'
+'<div class="blackout" style="height: 6702px; z-index: 20000001; opacity: 0.65;"></div>';
$( 'body' ).append( popupHTML );
mw.util.addCSS( '.modalWrapper { -moz-box-shadow: 0 10px 60px #7F7F7F; background: none repeat scroll 0 0 white; border: 5px solid #BACDD8; padding: 25px 15px; position: absolute; }'
+'section { display: block; }'
+'.blackout { background: none repeat scroll 0 0 white; left: 0; opacity: 0.8; position: absolute; top: 0; width: 100%; }' );
},
closePopUpForm: function () {
$('section.modalWrapper').remove();
$('div.blackout').remove();
},
/* Edit function */
createPage: function () {
var speech = $( '#bnw-speech' ).val();
var entry = $( '#bnw-entry' ).val();
var usage = $( '#bnw-usage' ).val();
var eng = $( '#bnw-eng' ).val();
var source = $( '#bnw-source' ).val();
var usageflag = true;
if (!usage) usageflag = false;
var summary = 'Creating entry using [[User:Pmlineditor/quickcreate.js|quick create script]]';
var lang = 'বাংলা';
var pageText = '==' + lang + '==' + '\n';
var pageSpeech = '==' + '=' + speech + '==' + '=\n';
pageSpeech = pageSpeech + '{{' + speech + '}}\n#' + entry;
var pageUsage = '\n=' + '==' + 'ব্যবহার টীকা' + '==' + '=\n' + usage;
var pageEng = '\n=' + '==' + 'ইংরেজি' + '==' + '=\n' + eng;
var pageSource = '\n=' + '==' + 'তথ্যসূত্র' + '==' + '=\n' + '* ' + source;
if (usageflag === true)
pageText = pageText + pageSpeech + pageUsage + pageEng + pageSource;
else pageText = pageText + pageSpeech + pageEng + pageSource;
pageText = pageText + '\n\n' + '[[Category:' + lang + ' ' + speech + ']]';
$('#wpTextbox1').val(pageText);
$('#wpSummary').val(summary);
$('section.modalWrapper').remove();
$('div.blackout').remove();
}
};
$(document).ready( BengaliWiktCreateScript.init );
} )( jQuery );