ميدياويكي:Gadget-WikiEditor.js

من كوبتيكبيديا
اذهب إلى التنقل اذهب إلى البحث
لم تعد النسخة القابلة للطباعة مدعومة وقد تحتوي على أخطاء في العرض. يرجى تحديث علامات متصفحك المرجعية واستخدام وظيفة الطباعة الافتراضية في متصفحك بدلا منها.

ملاحظة: بعد النشر، أنت قد تحتاج إلى إفراغ الكاش الخاص بمتصفحك لرؤية التغييرات.

  • فايرفوكس / سافاري: أمسك Shift أثناء ضغط Reload، أو اضغط على إما Ctrl-F5 أو Ctrl-R (⌘-R على ماك)
  • جوجل كروم: اضغط Ctrl-Shift-R (⌘-Shift-R على ماك)
  • إنترنت إكسبلورر/إيدج: أمسك Ctrl أثناء ضغط Refresh، أو اضغط Ctrl-F5
  • أوبرا: اضغط Ctrl-F5.
//removings
var customizeToolbar=function(){$("#wpTextbox1").wikiEditor("removeFromToolbar",{section:"main",group:"format",tool:"bold"}).wikiEditor("removeFromToolbar",{section:"main",group:"format",tool:"italic"}).wikiEditor("removeFromToolbar",{section:"main",group:"insert"}).wikiEditor("removeFromToolbar",{section:"help"}).wikiEditor("removeFromToolbar",{section:"characters"})};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)})}})}

var customizeToolbar = function() {
	/*code goes here*/

/*	//§action 
	$("#wpTextbox1").wikiEditor("addToToolbar", {
		section: "main",
		group: "format", //"action" actually
		tools: {


		}
	});*/




	//§insert
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'section': 'main',
		'groups': {
			'ins': { // "insert"
				'label': '' // or use labelMsg for a localized label, see above
			}
		}
	});
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'section': 'main',
		'group': 'ins',
		'tools': {
			save: {
				label: "حفظ",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/f/f6/Toolbar_save_changes.png",
				action: {
					type: "callback",
					execute: function(context) {
						$('#editform').submit();
					}
				}
			},
			preview: {
				label: "معاينة",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/b/bd/Toolbar_preview.png",
				action: {
					type: "callback",
					execute: function(context) {
						$('#wpPreview').click();
					}
				}
			},
			bold: {
				label: "b",
				type: "button",
				icon: "//commons.wikimedia.org/w/load.php?modules=oojs-ui.styles.icons-editing-styling&image=bold&format=rasterized&lang=ar&version=29d8adb8cee9",
				action: {
					type: "encapsulate",
					options: {
						pre: "'''",
						peri: "\{\{نسخ:اسم_الصفحة_الأساسي\}\}",
						post: "'''",
					}
				}
			},
			internallink: {
				label: "wl",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/4/48/Toolbar_Insert_link.png",
				action: {
					type: "encapsulate",
					options: {
						pre: "[[",
						peri: "en:",
						post: "]]",
					}
				}
			},
			template: {
				label: "tl",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png",
				action: {
					type: "encapsulate",
					options: {
						pre: "{{",
						peri: "توضيح",
						post: "}}",
					}
				}
			},
			ref: {
				label: "ref",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/a/a1/Toolbaricon_insert_reference_plus.png",
				action: {
					type: "encapsulate",
					options: {
						pre: "<ref>\n",
						peri: "[]",
						post: "\n</ref>",
					}
				}
			},
			references: {
				label: "refs",
				type: "button",
				icon: "//upload.wikimedia.org/wikipedia/commons/3/34/Toolbar_references.png",
				action: {
					type: "encapsulate",
					options: {
						pre: "==مراجع==\n{{مراجع}}",
					}
				}
			}

		}
	});



	//§format
	$('#wpTextbox1').wikiEditor('addToToolbar', {
		'section': 'main',
		'groups': {
			'form': { // "format"
				'label': '' // or use labelMsg for a localized label, see above
			}
		}
	});
/*	$("#wpTextbox1").wikiEditor("addToToolbar", {
		section: "main",
		group: "form",
		tools: {

		}
	});*/

	/*code ends here*/
};

/* 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() {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if (mw.user.options.get('usebetatoolbar') == 1) {
			$.when(
				mw.loader.using('ext.wikiEditor'), $.ready
			).then(customizeToolbar);
		}
	});
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook('ext.lqt.textareaCreated').add(customizeToolbar);

mw.util.addCSS('*[class^="group group-codeeditor"]{float: left !important;}');