صارف:Yethrosh/insertVectorButtons.js

آزاد دائرۃ المعارف، ویکیپیڈیا سے

تفصیل کے لیے کھولیں کے بٹن پر کلک کریں یاددہانی: محفوظ کرنے کے بعد تازہ ترین تبدیلیوں کو دیکھنے کے لیے آپ کو اپنے براؤزر کا کیش صاف کرنا ہوگا۔

  • فائرفاکس/ سفاری: جب Reload پر کلک کریں تو Shift دبا کر رکھیں، یا Ctrl-F5 یا Ctrl-R دبائیں (Mac پر R- )
  • گوگل کروم: Ctrl-Shift-R دبائیں (Mac پر Shift-R-⌘)
  • انٹرنیٹ ایکسپلورر: جب Refresh پر کلک کریں تو Ctrl یا Ctrl-F5 دبائیں
  • اوپیرا: Tools → Preferences میں جائیں اور کیش صاف کریں

/**
 * Insert Vector Buttons
 * Created on April 6th, 2010
 *
 * @revision 2014-06-50
 * @source meta.wikimedia.org/wiki/User:Krinkle/Scripts/insertVectorButtons
 *
 * Thi script is released in the public domain.
 */
if ( $.fn.wikiEditor && typeof kCustomMainInsertButton === 'undefined' && ( wgAction == 'edit' || wgAction == 'submit' ) ) {
	window.kCustomMainInsertButton = function (imageId, imageFile, speedTip, tagOpen, tagClose, sampleText, callbackFunc) {
		// Reason for the a[b]-method instead of the much shorter a.b-method
		// is to dynamicly set the object name imageId
		var wikiOptions = {'section': 'main', 'group': 'insert', 'tools': {}};
		wikiOptions.tools[imageId] = {
			label: speedTip,
			type: 'button',
			icon: imageFile,
			action: {
				type: 'callback',
				execute: function () {
					$('#wpTextbox1').textSelection('encapsulateSelection',{
						pre: tagOpen,
						peri: sampleText,
						post: tagClose
					});
					if (callbackFunc) { callbackFunc(); }
				}
			}
		};
		$('#wpTextbox1').wikiEditor('addToToolbar', wikiOptions);
	};
 
	jQuery(function () {
		if (typeof kCustomMainInsertButton_config !== 'undefined') {
			kCustomMainInsertButton_config();
		}
	});
 
} else {
	window.kCustomMainInsertButton = function () {};
}