ব্যবহারকারী:SHEIKH/সারাংশ.js
লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।
- ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
- ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
- অপেরা: Ctrl-F5 টিপুন।
var $summaryBox = $( '#wpSummary' );
if( typeof customGeneralSummaries === "undefined" ) {
customGeneralSummaries = [];
if (typeof customsum1 != "undefined") customGeneralSummaries.push( customsum1 );
if (typeof customsum2 != "undefined") customGeneralSummaries.push( customsum2 );
if (typeof customsum3 != "undefined") customGeneralSummaries.push( customsum3 );
if (typeof customsum4 != "undefined") customGeneralSummaries.push( customsum4 );
if (typeof customsum5 != "undefined") customGeneralSummaries.push( customsum5 );
if (typeof customsum6 != "undefined") customGeneralSummaries.push( customsum6 );
if (typeof customsum7 != "undefined") customGeneralSummaries.push( customsum7 );
if (typeof customsum8 != "undefined") customGeneralSummaries.push( customsum8 );
if (typeof customsum9 != "undefined") customGeneralSummaries.push( customsum9 );
if (typeof customsum10 != "undefined") customGeneralSummaries.push( customsum10 );
if (typeof customsum11 != "undefined") customGeneralSummaries.push( customsum11 );
if (typeof customsum12 != "undefined") customGeneralSummaries.push( customsum12 );
if (typeof customsum13 != "undefined") customGeneralSummaries.push( customsum13 );
if (typeof customsum14 != "undefined") customGeneralSummaries.push( customsum14 );
if (typeof customsum15 != "undefined") customGeneralSummaries.push( customsum15 );
if (typeof customsum16 != "undefined") customGeneralSummaries.push( customsum16 );
if (typeof customsum17 != "undefined") customGeneralSummaries.push( customsum17 );
if (typeof customsum18 != "undefined") customGeneralSummaries.push( customsum18 );
if (typeof customsum19 != "undefined") customGeneralSummaries.push( customsum19 );
if (typeof customsum20 != "undefined") customGeneralSummaries.push( customsum20 );
}
function addOptionsToDropdown( dropdown, optionTexts ) {
dropdown.menu.addItems( ( optionTexts || [] ).map( function ( optionText ) {
return new OO.ui.MenuOptionWidget( { label: optionText } );
} ) );
}
function onSummarySelect( option ) {
// Save the original value of the edit summary field
var editsummOriginalSummary = $summaryBox.val(),
canned = option.getLabel(),
newSummary = editsummOriginalSummary;
// Append old edit summary with space, if exists,
// and last character != space
if ( newSummary.length !== 0 && newSummary.charAt( newSummary.length - 1 ) !== ' ' ) {
newSummary += ' ';
}
newSummary += canned;
$summaryBox.val( newSummary ).trigger( 'change' );
}
function insertSummaryOptions( $insertBeforeThis, dropdownWidth ) {
// For convenience, add a dropdown box with some canned edit
// summaries to the form.
var namespace = mw.config.get( 'wgNamespaceNumber' ),
dropdown = new OO.ui.DropdownWidget( {
label: 'সারাংশ'
} );
dropdown.$element.css( 'width', dropdownWidth );
dropdown.menu.on( 'select', onSummarySelect );
addOptionsToDropdown( dropdown, customGeneralSummaries );
if( typeof customNamespaceSummaries != "undefined" && customNamespaceSummaries[namespace + ''] ) {
addOptionsToDropdown( dropdown, customNamespaceSummaries[namespace + ''] );
}
$insertBeforeThis.before( dropdown.$element );
}
// VisualEditor
mw.hook( 've.saveDialog.stateChanged' ).add( function () {
var target, $saveOptions;
// .ve-init-mw-viewPageTarget-saveDialog-checkboxes
if ( $( 'body' ).data( 'wppresent' ) ) { return; }
$( 'body' ).data( 'wppresent', 'true' );
target = ve.init.target;
$saveOptions = target.saveDialog.$saveOptions;
$summaryBox = target.saveDialog.editSummaryInput.$input;
if ( !$saveOptions.length ) {
return;
}
insertSummaryOptions( $saveOptions );
} );
// WikiEditor (i.e. the normal wikicode editor)
$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function () {
var $editCheckboxes = $( '.editCheckboxes' );
// If we failed to find the editCheckboxes class
if ( !$editCheckboxes.length ) {
return;
}
insertSummaryOptions( $editCheckboxes, '38%' );
} );