মিডিয়াউইকি:Common.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য
বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
NahidSultan (আলোচনা | অবদান) LinkFA+ |
আফতাবুজ্জামান (আলোচনা | অবদান) specialchars ঠিক করা |
||
৫৭৯ নং লাইন: | ৫৭৯ নং লাইন: | ||
/** |
/** |
||
* ইতালীয় উইকিপিডিয়া থেকে (:it:MediaWiki:Common.js) |
|||
* Bengali Wikipedia specific |
|||
* Aggiunge il menu a tendina per selezionare un sottoinsieme di caratteri speciali |
|||
* Maintainers: [[User:jayantanth]] |
|||
* সতর্কতা: তালিকার ক্রম অবশ্যই মিডিয়াউইকি:Edittools'র মত হতে হবে! |
|||
*/ |
*/ |
||
/* select subsection of special characters */ |
|||
function scegliSubsetCaratteri(s) { |
|||
// To enable [[MediaWiki:Edittools.js]] |
|||
var l = document.getElementById('specialchars').getElementsByTagName('p'); |
|||
var load_edittools = true; |
|||
for (var i = 0; i < l.length ; i++) { |
|||
// extra drop down menu on editing for adding special characters |
|||
l[i].style.display = i == s ? 'inline' : 'none'; |
|||
importScript( 'MediaWiki:Edittools.js' ); |
|||
l[i].style.visibility = i == s ? 'visible' : 'hidden'; |
|||
// Editpage scripts |
|||
} |
|||
if( wgAction == 'edit' || wgAction == 'submit' ) { |
|||
importScript( 'MediaWiki:Editpage.js' ); |
|||
} |
} |
||
function aggiungiMenuSubsetCaratteri() { |
|||
var specialchars = document.getElementById('specialchars'); |
|||
if (specialchars) { |
|||
var menu = "<select style=\"display:inline\" onChange=\"scegliSubsetCaratteri(selectedIndex)\">"; |
|||
menu += "<option>যোগ করুন</option>"; |
|||
menu += "<option>বাংলা বর্ণমালা</option>"; |
|||
menu += "<option>বাংলা যুক্তবর্ণ</option>"; |
|||
menu += "<option>আইপিএ</option>"; |
|||
menu += "<option>গ্রিক বর্ণমালা</option>"; |
|||
menu += "<option>গাণিতিক চিহ্ন</option>"; |
|||
menu += "</select>"; |
|||
specialchars.innerHTML = menu + specialchars.innerHTML; |
|||
/* default subset - try to use a cookie some day */ |
|||
scegliSubsetCaratteri(0); |
|||
} |
|||
} |
|||
$(aggiungiMenuSubsetCaratteri); |
|||
// END Menu caratteri speciali |
|||
/* From this line js may be delete after confirmation from Mediawiki developers */ |
/* From this line js may be delete after confirmation from Mediawiki developers */ |
||
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML |
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML |
১৬:১১, ১ আগস্ট ২০১৪ তারিখে সংশোধিত সংস্করণ
/**
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
* loaded for all users on every wiki page. If possible create a gadget that is
* enabled by default instead of adding it here (since gadgets are fully
* optimized ResourceLoader modules with possibility to add dependencies etc.)
*
* Since common.js isn't a gadget, there is no place to declare it's
* dependencies, so we have to lazy load them with mw.loader.using on demand and
* then execute the rest in the callback. In most cases these dependencies will
* be loaded (or loading) already and the callback will not be delayed. In case a
* dependency hasn't arrived yet it'll make sure those are loaded before this.
*/
mw.loader.using( 'mediawiki.util', function() {
/* Begin of mw.loader.using callback */
/**
* Redirect User:Name/skin.js and skin.css to the current skin's pages
* (unless the 'skin' page really exists)
* @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
* @rev: 2
*/
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) == 2 ) {
var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
// Make sure there was a part before and after the slash
// And that the latter is 'skin.js' or 'skin.css'
if ( titleParts.length == 2 ) {
var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
if ( titleParts.slice(-1) == 'skin.js' ) {
window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
} else if ( titleParts.slice(-1) == 'skin.css' ) {
window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
}
}
}
/** Map addPortletLink to mw.util
*/
window.addPortletLink = function() {
return mw.util.addPortletLink.apply( mw.util, arguments );
};
/** extract a URL parameter from the current URL **********
*
* @deprecated: Use mw.util.getParamValue with proper escaping
*/
window.getURLParamValue = function() {
return mw.util.getParamValue.apply( mw.util, arguments );
};
/** &withCSS= and &withJS= URL parameters *******
* Allow to try custom scripts from MediaWiki space
* without editing personal .css or .js files
*/
var extraCSS = mw.util.getParamValue("withCSS");
if ( extraCSS && extraCSS.match(/^MediaWiki:[^&<>=%]*\.css$/) ) {
importStylesheet(extraCSS);
}
var extraJS = mw.util.getParamValue("withJS");
if ( extraJS && extraJS.match(/^MediaWiki:[^&<>=%]*\.js$/) ) {
importScript(extraJS);
}
/* Import more specific scripts if necessary */
if (wgAction == 'edit' || wgAction == 'submit' || wgPageName == 'Special:Upload') { //scripts specific to editing pages
importScript('MediaWiki:Common.js/edit.js');
}
else if (mw.config.get('wgPageName') == 'Special:Watchlist') { //watchlist scripts
mw.loader.load(mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=MediaWiki:Common.js/watchlist.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
}
if ( wgNamespaceNumber == 6 ) {
importScript('MediaWiki:Common.js/file.js');
}
/** For sysops *****************************************
*
* Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]],
*
*/
if ( $.inArray( 'sysop', wgUserGroups) > -1 ) {
if ( !window.disableSysopJS ) {
$(function(){
importScript('MediaWiki:Sysop.js');
});
}
}
/** WikiMiniAtlas *******************************************************
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
/* Scripts specific to Internet Explorer */
if ($.client.profile().name == 'msie') {
/** Internet Explorer bug fix **************************************************
*
* Description: Fixes IE horizontal scrollbar bug
* Maintainers: [[User:Tom-]]?
*/
var oldWidth;
var docEl = document.documentElement;
var fixIEScroll = function() {
if (!oldWidth || docEl.clientWidth > oldWidth) {
doFixIEScroll();
} else {
setTimeout(doFixIEScroll, 1);
}
oldWidth = docEl.clientWidth;
};
var doFixIEScroll = function () {
docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
};
document.attachEvent("onreadystatechange", fixIEScroll);
document.attachEvent("onresize", fixIEScroll);
// In print IE (7?) does not like line-height
mw.util.addCSS('@media print { sup, sub, p, .documentDescription { line-height: normal; } }');
// IE overflow bug
mw.util.addCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } '
+ 'div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');
// IE zoomfix
// Use to fix right floating div/table inside tables
mw.util.addCSS('.iezoomfix div, .iezoomfix table { zoom: 1; }');
// Import scripts specific to Internet Explorer 6
if ($.client.profile().versionBase == '6') {
importScript('MediaWiki:Common.js/IE60Fixes.js');
}
}
/* Fixes for Windows font rendering */
if ($.client.profile().platform == 'win') {
mw.util.addCSS('.IPA, .Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; }');
}
/* Helper script for .hlist class in common.css
* Maintainer: [[User:Edokter]]
*/
if ( $.client.profile().name == 'msie' ) {
/* remove interpunct from last list items in IE 8 */
if ( $.client.profile().versionBase == '8' ) {
$( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
.addClass( 'nopunct' );
}
/* Generate interpuncts and parens for IE < 8 */
if ( $.client.profile().versionBase < '8' ) {
$( '.hlist' ).find( 'dt + dd, dt + dt' ).prev()
.append( '<b>:</b> ' );
$( '.hlist' ).find( 'dd + dd, dd + dt, li + li' ).prev()
.append( '<b>·</b> ' );
$( '.hlist' ).find( 'dl dl, ol ol, ul ul' )
.prepend( '( ' ).append( ') ' );
}
}
/* Test if an element has a certain class
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*
* @deprecated: Use $(element).hasClass() instead.
*/
window.hasClass = ( function() {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/**
* Interwiki links to featured articles
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:R. Koot]]
*/
function LinkFA() {
if ( document.getElementById( 'p-lang' ) ) {
var InterwikiLinks = document.getElementById( 'p-lang' ).getElementsByTagName( 'li' );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
var className = InterwikiLinks[i].className.match(/interwiki-[-\w]+/);
if ( document.getElementById( className + '-fa' ) ) {
InterwikiLinks[i].className += ' FA';
InterwikiLinks[i].title = 'এই নিবন্ধটি অন্য একটি ভাষায় নির্বাচিত নিবন্ধ।';
} else if ( document.getElementById( className + '-ga' ) ) {
InterwikiLinks[i].className += ' GA';
InterwikiLinks[i].title = 'এই নিবন্ধটি অন্য একটি ভাষায় ভালো নিবন্ধ।';
}
}
}
}
mw.hook( 'wikipage.content' ).add( LinkFA );
/**
* Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Maintainers: [[User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = 'আড়াল করো';
var expandCaption = 'দেখাও';
window.collapseTable = function ( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
var i;
if ( Button.firstChild.data === collapseCaption ) {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
};
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = {};
var Tables = document.getElementsByTagName( 'table' );
var i;
function handleButtonLink( index, e ) {
window.collapseTable( index );
e.preventDefault();
}
for ( i = 0; i < Tables.length; i++ ) {
if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
if ( !HeaderRow ) continue;
var Header = HeaderRow.getElementsByTagName( 'th' )[0];
if ( !Header ) continue;
NavigationBoxes[ tableIndex ] = Tables[i];
Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
var Button = document.createElement( 'span' );
var ButtonLink = document.createElement( 'a' );
var ButtonText = document.createTextNode( collapseCaption );
Button.className = 'collapseButton'; /* Styles are declared in Common.css */
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', '#' );
$( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, tableIndex ) );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
Header.insertBefore( Button, Header.firstChild );
tableIndex++;
}
}
for ( i = 0; i < tableIndex; i++ ) {
if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
window.collapseTable( i );
}
else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
var element = NavigationBoxes[i];
while ((element = element.parentNode)) {
if ( $( element ).hasClass( 'outercollapse' ) ) {
window.collapseTable ( i );
break;
}
}
}
}
}
mw.hook( 'wikipage.content' ).add( createCollapseButtons );
/**
* Dynamic Navigation Bars (experimental)
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
/* set up the words in your language */
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
/**
* Shows and hides content and picture (if available) of navigation bars
* Parameters:
* indexNavigationBar: the index of navigation bar to be toggled
**/
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
var NavChild;
if ( !NavFrame || !NavToggle ) {
return false;
}
/* if shown now */
if ( NavToggle.firstChild.data === NavigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
/* if hidden now */
} else if ( NavToggle.firstChild.data === NavigationBarShow ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
event.preventDefault();
};
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
var NavFrame;
var NavChild;
/* iterate over all < div >-elements */
var divs = document.getElementsByTagName( 'div' );
for ( var i = 0; (NavFrame = divs[i]); i++ ) {
/* if found a navigation bar */
if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
indexNavigationBar++;
var NavToggle = document.createElement( 'a' );
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', '#' );
$( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
/**
* Check if any children are already hidden. This loop is here for backwards compatibility:
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
* to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
* the content visible without JavaScript support), the new recommended way is to add the class
* "collapsed" to the NavFrame itself, just like with collapsible tables.
*/
for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
if ( NavChild.style.display === 'none' ) {
isCollapsed = true;
}
}
}
if ( isCollapsed ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
}
var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
NavToggle.appendChild( NavToggleText );
/* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
}
}
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
/**
* Main Page layout fixes
*
* Description: Adds an additional link to the complete list of languages available.
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/
if ( mw.config.get( 'wgTitle' ) == mw.config.get( 'wgMainPageTitle' ) ) {
$(function () {
mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'পূর্ণাঙ্গ তালিকা', 'interwiki-completelist', 'সকল উইপিডিয়ার তালিকা');
var nstab = document.getElementById('ca-nstab-main');
if (nstab && mw.config.get( 'wgUserLanguage' ) == 'bn') {
while (nstab.firstChild) nstab = nstab.firstChild;
nstab.nodeValue = mw.config.get( 'wgTitle' );
}
});
}
/** Table sorting fixes ************************************************
*
* Description: Disables code in table sorting routine to set classes on even/odd rows
* Maintainers: [[User:Random832]]
*/
ts_alternate_row_colors = false;
/***** uploadwizard_newusers ********
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
*
* Maintainers: [[User:Krimpet]]
*/
function uploadwizard_newusers() {
if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") {
var oldDiv = document.getElementById("autoconfirmedusers"),
newDiv = document.getElementById("newusers");
if (oldDiv && newDiv) {
if (typeof wgUserGroups == "object" && wgUserGroups) {
for (i = 0; i < wgUserGroups.length; i++) {
if (wgUserGroups[i] == "autoconfirmed") {
oldDiv.style.display = "block";
newDiv.style.display = "none";
return;
}
}
}
oldDiv.style.display = "none";
newDiv.style.display = "block";
return;
}
}
}
$(uploadwizard_newusers);
/** IPv6 AAAA connectivity testing
var __ipv6wwwtest_factor = 100;
var __ipv6wwwtest_done = 0;
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==42)) {
importScript("MediaWiki:Common.js/IPv6.js");
}
**/
/**
* Magic editintros ****************************************************
*
* Description: Adds editintros on disambiguation pages and BLP pages.
* Maintainers: [[User:RockMFR]]
*/
function addEditIntro( name ) {
$( '.mw-editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
} );
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
$( function () {
if ( document.getElementById( 'disambigbox' ) ) {
addEditIntro( 'Template:Disambig_editintro' );
}
} );
$( function () {
var cats = document.getElementById( 'mw-normal-catlinks' );
if ( !cats ) {
return;
}
cats = cats.getElementsByTagName( 'a' );
for ( var i = 0; i < cats.length; i++ ) {
if ( cats[i].title === 'বিষয়শ্রেণী:জীবিত ব্যক্তি' || cats[i].title === 'বিষয়শ্রেণী:সম্ভাব্য জীবিত ব্যক্তি' ) {
addEditIntro( 'Template:BLP_editintro' );
break;
}
}
} );
}
/**
* Description: Stay on the secure server as much as possible
* Maintainers: [[User:TheDJ]]
*/
if ( mw.config.get('wgServer') == 'https://secure.wikimedia.org' ) {
/* Old secure server */
importScript( 'MediaWiki:Common.js/secure.js');
} else if( document.location && document.location.protocol && document.location.protocol == "https:" ) {
/* New secure servers */
importScript('MediaWiki:Common.js/secure new.js');
}
/** Text area function for the account creation process */
jQuery(function(){
if (!(document.getElementById('signupuserpagefillmagic'))) return;
/*
* Puts an userpage edit-box inside a div with the ID 'signupuserpagefillmagic'
* Created for [[:outreach:Account Creation Improvement Project]] by
* [[:sv:User:Sertion]] on the behalf of [[:outreach:User:Hannibal]]
*
* Below are variables for internationalization. Please use \n for linebreaks
* and escape all single quotation marks (') with \'
*/
var preComment = '<!-- BELOW IS THE TEXT ABOUT YOU. YOU CAN CHANGE IT COMPLETELY OR IN PARTS AND THEN COME BACK TO IT. AFTER YOU ARE DONE, SCROLL DOWN A BIT FURTHER AND CLICK "SAVE PAGE".--\>{'+'{New user bar}}\n',
postComment = '\n\n<!-- NOW, CLICK THE "SAVE PAGE" BUTTON. CONGRATULATIONS, YOU\'VE JUST MADE YOUR FIRST EDIT TO WIKIPEDIA. --\>',
preSubmitButton ='Do not forget to click SAVE PAGE when you get to the next page!',
submitText = 'Create my user page for me now!',
SUPeditSummary = 'New user page through [[:outreach:Account Creation Improvement Project|Outreach:ACIP]]',
preFilltemplate = 'Replace this example text with information about you. \n\n';
/*
* The actual magic:
* Inserts a form with a single visible field that simulates the normal
* edit-field. It uses the variables from above to set a text example (pre
* filled), an automated edit summary and the label of the submit button.
* 'fakewpTextbox1' is used to hide the assembling of the final output that
* is made below.
*/
jQuery('#signupuserpagefillmagic').html('<form action="'+wgServer+wgScript+'?title='+wgFormattedNamespaces[2]+':'+wgUserName+'&action=submit" method="post"><textarea id="fakewpTextbox1" style="width:46em;height:20em;">'+preFilltemplate+'</textarea><textarea name="wpTextbox1" id="wpTextbox1" style="display:none;"></textarea><input type="hidden" name="wpSummary" id="wpSummary" value="'+SUPeditSummary+'" /><br/>'+preSubmitButton+'<br/><input type="submit" value="'+submitText+'"/></form>');
// Waits for the form to be submitted.
jQuery('#signupuserpagefillmagic form').live('submit',function(r){
// Stops the form from submitting
r.preventDefault();
/*
* Uses the previously defined variables preComment and postComment
* to assemble the final output in the hidden textarea.
*/
$('#wpTextbox1').text( preComment + jQuery('#fakewpTextbox1').text() + postComment );
/*
* Submits the form.
* For unknown reasons jQuery('#signupuserpagefillmagic form').submit() crashes
* Firefox (only tested in version 4.0). This method seam to work cross browser.
*/
document.getElementById('signupuserpagefillmagic').getElementsByTagName('form')[0].submit();
});
});
/* End of mw.loader.using callback */
} );
/**
* ইতালীয় উইকিপিডিয়া থেকে (:it:MediaWiki:Common.js)
* Aggiunge il menu a tendina per selezionare un sottoinsieme di caratteri speciali
* সতর্কতা: তালিকার ক্রম অবশ্যই মিডিয়াউইকি:Edittools'র মত হতে হবে!
*/
/* select subsection of special characters */
function scegliSubsetCaratteri(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
function aggiungiMenuSubsetCaratteri() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = "<select style=\"display:inline\" onChange=\"scegliSubsetCaratteri(selectedIndex)\">";
menu += "<option>যোগ করুন</option>";
menu += "<option>বাংলা বর্ণমালা</option>";
menu += "<option>বাংলা যুক্তবর্ণ</option>";
menu += "<option>আইপিএ</option>";
menu += "<option>গ্রিক বর্ণমালা</option>";
menu += "<option>গাণিতিক চিহ্ন</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML;
/* default subset - try to use a cookie some day */
scegliSubsetCaratteri(0);
}
}
$(aggiungiMenuSubsetCaratteri);
// END Menu caratteri speciali
/* From this line js may be delete after confirmation from Mediawiki developers */
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML
function pickUpText(aParentElement) {
var str = '';
function pickUpTextInternal(aElement) {
var child = aElement.firstChild;
while (child) {
if (child.nodeType == 1) // ELEMENT_NODE
pickUpTextInternal(child);
else if (child.nodeType == 3) // TEXT_NODE
str += child.nodeValue;
child = child.nextSibling;
}
}
pickUpTextInternal(aParentElement);
return str;
}
//fix edit summary prompt for undo
//this code fixes the fact that the undo function combined with the "no edit summary prompter" causes problems if leaving the
//edit summary unchanged
//this was added by [[User:Deskana]], code by [[User:Tra]]
$(function () {
if (document.location.search.indexOf('undo=') != -1
&& document.getElementsByName('wpAutoSummary')[0]) {
document.getElementsByName('wpAutoSummary')[0].value='';
}
});
/** Add dismiss button to watchlist-message *************************************
*
* Description: Hide the watchlist message for one week.
* Maintainers: [[User:Ruud Koot|Ruud Koot]]
*/
function addDismissButton() {
var watchlistMessage = document.getElementById('watchlist-message');
if ( watchlistMessage == null ) return;
if ( document.cookie.indexOf( 'hidewatchlistmessage=yes' ) != -1 ) {
watchlistMessage.style.display = 'none';
}
var Button = document.createElement( 'span' );
var ButtonLink = document.createElement( 'a' );
var ButtonText = document.createTextNode( 'dismiss' );
ButtonLink.setAttribute( 'id', 'dismissButton' );
ButtonLink.setAttribute( 'href', 'javascript:dismissWatchlistMessage();' );
ButtonLink.setAttribute( 'title', 'Hide this message for one week' );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
watchlistMessage.appendChild( Button );
}
function dismissWatchlistMessage() {
var e = new Date();
e.setTime( e.getTime() + (7*24*60*60*1000) );
document.cookie = 'hidewatchlistmessage=yes; expires=' + e.toGMTString() + '; path=/';
var watchlistMessage = document.getElementById('watchlist-message');
watchlistMessage.style.display = 'none';
}
$( addDismissButton );
// Choice of multiple search engines
// Autor: Jakob Voss, Guillaume (tret de de:MediaWiki:SpezialSuche.js)
// Version: 0.3.8
// Published as Public Domain
// Map of search engines and some OpenSearch-based fields
var searchEngines = {
mediawiki: {
ShortName: "মিডিয়াউইকি অনুসন্ধান",
Template: '/w/index.php?search={searchTerms}'
},
globalwpsearch: {
ShortName: "সকল উইকিপিডিয়া",
Template: 'http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}'
},
google: {
ShortName: "গুগল",
Template: 'http://www.google.cat/search?as_sitesearch=bn.wikipedia.org&hl=bn&q={searchTerms}'
},
wikiwix: {
ShortName: "উইকিউইক্স",
Template: 'http://www.wikiwix.com/index.php?action={searchTerms}&lang=en'
},
yahoo: {
ShortName: "ইয়াহু!",
Template: 'http://search.yahoo.com/search?p={searchTerms}&vs=bn.wikipedia.org'
},
wlive: {
ShortName: "উইন্ডোজ লাইভ",
Template: 'http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://bn.wikipedia.org'
}
};
function externalSearchEngines() {
if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return;
var mainNode = document.getElementById('powersearch');
if (!mainNode) mainNode = document.getElementById('search');
if (!mainNode) return;
var beforeNode = document.getElementById('mw-search-top-table');
if (!beforeNode) return;
beforeNode = beforeNode.nextSibling;
if (!beforeNode) return;
var firstEngine = 'mediawiki';
var choices = document.createElement('div');
choices.setAttribute('id','searchengineChoices');
choices.style.textAlign = 'center';
var lsearchbox = document.getElementById('searchText');
var initValue = lsearchbox.value;
var space = '';
for (var id in searchEngines) {
var engine = searchEngines[id];
if(engine.ShortName)
{
if (space) choices.appendChild(space);
space = document.createTextNode(' ');
var attr = {
type: 'radio',
name: 'searchengineselect',
value: id,
onFocus: 'changeSearchEngine(this.value)',
id: 'searchengineRadio-'+id
};
var html = '<input';
for (var a in attr) html += ' ' + a + '="' + attr[a] + '"';
html += ' />';
var span = document.createElement('span');
span.innerHTML = html;
choices.appendChild( span );
var label;
if (engine.Template.indexOf('http') === 0) {
label = document.createElement('a');
label.href = engine.Template.replace('{searchTerms}', initValue).replace('{language}', 'fr');
} else {
label = document.createElement('label');
}
label.appendChild( document.createTextNode( engine.ShortName ) );
choices.appendChild( label );
}
}
mainNode.insertBefore(choices, beforeNode);
var input = document.createElement('input');
input.id = 'searchengineextraparam';
input.type = 'hidden';
mainNode.insertBefore(input, beforeNode);
changeSearchEngine(firstEngine, initValue);
}
function changeSearchEngine(selectedId, searchTerms) {
var currentId = document.getElementById('searchengineChoices').currentChoice;
if (selectedId == currentId) return;
document.getElementById('searchengineChoices').currentChoice = selectedId;
var radio = document.getElementById('searchengineRadio-' + selectedId);
radio.checked = 'checked';
var engine = searchEngines[selectedId];
var p = engine.Template.indexOf('?');
var params = engine.Template.substr(p+1);
var form;
if ( document.forms.search ) {
form = document.forms.search;
} else {
form = document.getElementById('powersearch');
}
form.setAttribute('action', engine.Template.substr(0,p));
var l = ('' + params).split('&');
for (var idx = 0;idx < l.length;idx++) {
p = l[idx].split('=');
var pValue = p[1];
var input;
if (pValue == '{language}') {
} else if (pValue == '{searchTerms}') {
input = document.getElementById('searchText');
input.name = p[0];
} else {
input = document.getElementById('searchengineextraparam');
input.name = p[0];
input.value = pValue;
}
}
}
if (mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Search') {
$(externalSearchEngines);
}
/**
* Correctly handle PNG transparency in Internet Explorer 6.
* http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
*
* Adapted for Wikipedia by Remember_the_dot and Edokter.
*
* http://homepage.ntlworld.com/bobosola/pnginfo.htm states "This page contains more information for
* the curious or those who wish to amend the script for special needs", which I take as permission to
* modify or adapt this script freely. I release my changes into the public domain.
*/
function PngFix(){
if (document.body.filters && !window.PngFixDisabled) {
var documentImages = document.images;
var documentCreateElement = document.createElement;
var funcEncodeURI = encodeURI;
for (var i = 0; i < documentImages.length;) {
var img = documentImages[i];
var imgSrc = img.src;
if (imgSrc.substr(imgSrc.length - 3).toLowerCase() == 'png' && !img.onclick) {
if (img.useMap) {
img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(imgSrc) + "')";
img.src = '//upload.wikimedia.org/wikipedia/commons/c/ce/Transparent.gif';
i++;
} else {
var outerSpan = documentCreateElement('span');
var innerSpan = documentCreateElement('span');
var outerSpanStyle = outerSpan.style;
var innerSpanStyle = innerSpan.style;
var imgCurrentStyle = img.currentStyle;
outerSpan.id = img.id;
outerSpan.title = img.title;
outerSpan.className = img.className;
outerSpanStyle.backgroundImage = imgCurrentStyle.backgroundImage;
outerSpanStyle.borderWidth = imgCurrentStyle.borderWidth;
outerSpanStyle.borderStyle = imgCurrentStyle.borderStyle;
outerSpanStyle.borderColor = imgCurrentStyle.borderColor;
outerSpanStyle.display = 'inline-block';
outerSpanStyle.fontSize = '0';
outerSpanStyle.verticalAlign = 'middle';
if (img.parentElement.href) outerSpanStyle.cursor = 'hand';
innerSpanStyle.width = '1px';
innerSpanStyle.height = '1px';
innerSpanStyle.display = 'inline-block';
innerSpanStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + funcEncodeURI(imgSrc) + "')";
outerSpan.appendChild(innerSpan);
img.parentNode.replaceChild(outerSpan, img);
}
} else {
i++;
}
}
}
}
if (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.substr(22, 1) == '6'){
$(window).load(PngFix);
}
/**
* Remove need for CSS hacks regarding MSIE and IPA.
*/
if(navigator.userAgent.indexOf('MSIE') != -1 && document.createStyleSheet) {
document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');
}
/**
* Import more specific scripts if necessary
*/
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
/* file description page scripts; SVG image rendering */
importScript( 'MediaWiki:Common.js/file.js' );
}
/* Above line js may be delete after confirmation from Mediawiki developers */
/* End of Bengali Wikipedia specific */
/* DO NOT ADD CODE BELOW THIS LINE */