মিডিয়াউইকি:Gadget-Edittools.js
টীকা: সংরক্ষণ করার পর, পরিবর্তনসমূহ তৎক্ষণাৎ নাও দেখাতে পারে। আপনার ব্রাউজারের ক্যাশ কিভাবে এড়াবেন তা জানতে এখানে ক্লিক করুন।
- ফায়ারফক্স / সাফারি: Shift ধরে রাখা অবস্থায়পুনঃলোড করুন-এ ক্লিক করুন, অথবা Ctrl-F5 বা Ctrl-R (ম্যাক-এ ⌘-R) চাপুন
- গুগল ক্রোম: Ctrl-Shift-R (ম্যাক-এ ⌘-Shift-R) চাপুন
- ইন্টারনেট এক্সপ্লোরার: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 চাপুন
- অপেরা: মেনু → ব্যবস্থাপনাসমূহ-এ যান (ম্যাকে অপেরা → পছন্দসমূহ) এবং এরপর গোপনীয়তা ও সুরক্ষা → ব্রাউজিং-এর তথ্য পরিষ্কার করুন → ক্যাশে করা ছবি ও ফাইলগুলি।
অন্যান্য ব্রাউজার সম্পর্কে বিশদ নির্দেশাবলীর জন্য, উইকিপিডিয়া:আপনার ক্যাশে বাইপাস করুন দেখুন।
/**
* EditTools support: add a selector, change <a> into buttons.
* The special characters to insert are defined at [[MediaWiki:Edittools]].
*
* @author Arnomane, 2006 (on the commons.wikimedia.org/wiki/MediaWiki:Edittools.js)
* @author Kaganer, 2007 (adapting to www.mediawiki.org)
* @author Krinkle, 2012
* @source www.mediawiki.org/wiki/MediaWiki:Gadget-Edittools.js
* @revision 2012-02-29
*/
/*jslint browser: true*/
/*global jQuery, mediaWiki*/
(function ($, mw) {
"use strict";
var conf, editTools, $sections;
conf = {
initialSubset: window.EditTools_initial_subset === undefined ? window.EditTools_initial_subset : 0
};
editTools = {
/**
* Creates the selector
*/
setup: function () {
var $container, $select, initial;
$container = $('#mw-edittools-charinsert');
if (!$container.length) {
return;
}
$sections = $container.find('.mw-edittools-section');
if ($sections.length <= 1) {
// Only care if there is more than one
return;
}
$select = $('<select>').css('display', 'inline');
initial = conf.initialSubset;
if (isNaN(initial) || initial < 0 || initial >= $select.length) {
initial = 0;
}
$sections.each(function (i, el) {
var $section, sectionTitle, $option;
$section = $(el);
sectionTitle = $section.data('sectionTitle');
$option = $('<option>')
.text(sectionTitle)
.prop('value', i)
.prop('selected', i === initial);
$select.append($option);
});
$select.change(editTools.handleOnchange);
$container.prepend($select);
editTools.chooseSection(initial);
},
/**
* Handle onchange event of the <select>
*
* @context {Element}
* @param e {jQuery.Event}
*/
handleOnchange: function () {
editTools.chooseSection(Number($(this).val()));
return true;
},
/**
* Toggle the currently visible section
*
* @param sectionNr {Number}
* @param setFocus {Boolean}
*/
chooseSection: function (sectionNr) {
var $choise = $sections.eq(sectionNr);
if ($choise.length !== 1) {
return;
}
// Making these buttons is a little slow,
// If we made them all at once the browser would hang
// for over 2 seconds, so instead we're doing it on-demand
// for each section. No need to do it twice thoguh, so remember
// in data whether it was done already
if (!$choise.data('charInsert.buttonsMade')) {
$choise.data('charInsert.buttonsMade', true);
// editTools.makeButtons($choise);
}
$choise.show();
$sections.not($choise).hide();
},
};
$(document).ready(editTools.setup);
}(jQuery, mediaWiki));