सदस्य:स/common.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 दबाएँ।
/* global mw, $, importStylesheet, importScript */
/* jshint strict:false, browser:true */
/* Remove when https://phabricator.wikimedia.org/T113642 fixed */
$( function () {
$( '#contentSub' ).insertBefore( '.ext-wpb-pagebanner' ).addClass( 'visible' );
$( '.ext-wpb-pagebanner' ).addClass( 'bugfix-T113642' );
} );
/* End https://phabricator.wikimedia.org/T113642 */
mw.loader.using( ['mediawiki.util', 'jquery.client'], function () {
/* Begin of mw.loader.using callback */
// Add listing buttons in edit toolbar
var customizeToolbar = function() {
$( function() {
if ( typeof $.fn.wikiEditor != 'undefined' ) {
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'reference'
});
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'groups': {
'listings': {
'label': 'स्थान जोड़ें' // or use labelMsg for a localized label, see above
}
}
} );
function currentLastEditDate() {
// return the date as "2015-01-15"
var d = new Date();
var year = d.getFullYear();
// Date.getMonth() returns 0-11
var month = d.getMonth() + 1;
if (month < 10) month = '0' + month;
var day = d.getDate();
if (day < 10) day = '0' + day;
return year + '-' + month + '-' + day;
}
var CURRENT_LAST_EDIT_DATE = currentLastEditDate();
var LISTING_TOOLBAR_ITEMS = {
'see': {
label: 'देखने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Italian_traffic_signs_-_icona_museo.svg/22px-Italian_traffic_signs_-_icona_museo.svg.png',
options: {
pre: '* \{\{see\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'do': {
label: 'करने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/3/30/Pictograms-nps-bicycle_trail-2.svg/22px-Pictograms-nps-bicycle_trail-2.svg.png',
options: {
pre: '* \{\{do\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'buy': {
label: 'खरीदने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Italian_traffic_signs_-_icona_supermercato.svg/22px-Italian_traffic_signs_-_icona_supermercato.svg.png',
options: {
pre: '* \{\{buy\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'eat': {
label: 'खाने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Italian_traffic_signs_-_icona_ristorante.svg/22px-Italian_traffic_signs_-_icona_ristorante.svg.png',
options: {
pre: '* \{\{eat\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'drink': {
label: 'पीने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Verre_cocktail.svg/22px-Verre_cocktail.svg.png',
options: {
pre: '* \{\{drink\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'sleep': {
label: 'सोने लायक जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/2/25/Pictograms-nps-lodging.svg/22px-Pictograms-nps-lodging.svg.png',
options: {
pre: '* \{\{sleep\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| checkin= | checkout= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
},
'listing': {
label: 'अन्य जगह', // or use labelMsg for a localized label, see above
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Italian_traffic_signs_-_icona_informazioni.svg/22px-Italian_traffic_signs_-_icona_informazioni.svg.png',
options: {
pre: '* \{\{listing\n| name=',
post: ' | alt= | url= | email=\n| address= | lat= | long= | directions=\n| phone= | tollfree= | fax=\n| hours= | price=\n| lastedit=' + CURRENT_LAST_EDIT_DATE + '\n| content=\n}}' // text to be inserted
}
}
};
$.each(LISTING_TOOLBAR_ITEMS, function(index, element) {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'listings',
'tools': {
'Listings': {
label: element.label,
type: 'button',
icon: element.icon,
action: {
type: 'encapsulate',
options: element.options
}
}
}
} );
});
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor', function () {
$(document).ready( customizeToolbar );
} );
}
} );
}
/* End of mw.loader.using callback */
} );
/* DO NOT ADD CODE BELOW THIS LINE */