Разлика между версии на „МедияУики:Common.js“

От Читалие
Направо към: навигация, търсене
(Нова страница: jQuery(function($) { var extraSymbols = [ { action: { type: "encapsulate", options: { pre: "⟨", post: "⟩" } }, label: "⟨⟩" }, "△", "◇" ]; $...)
 
Ред 5: Ред 5:
 
label: "⟨⟩"
 
label: "⟨⟩"
 
},
 
},
"△",
+
"△", "▽", "◇"
"◇"
 
 
];
 
];
 +
var addExtraSymbols = function(pages, symbols) {
 +
$.each(symbols, function(i, symbol){
 +
pages.symbols.characters.push(symbol);
 +
});
 +
};
 +
var reorderPages = function(pages) {
 +
var newPages = {};
 +
newPages = {
 +
'symbols': pages.symbols,
 +
'greek': pages.greek,
 +
'cyrillic' : pages.cyrillic
 +
};
 +
$.each(pages, function(i, v){
 +
newPages[i] = pages[i];
 +
});
 +
return newPages;
 +
};
 
$('#wpTextbox1').on('wikiEditor-toolbar-buildSection-characters', function (event, section) {
 
$('#wpTextbox1').on('wikiEditor-toolbar-buildSection-characters', function (event, section) {
$.each(extraSymbols, function(i, symbol){
+
addExtraSymbols(section.pages, extraSymbols);
section.pages.symbols.characters.push(symbol);
+
section.pages = reorderPages(section.pages);
});
+
});
 +
$('#wpTextbox1').on('wikiEditor-toolbar-buildSection-main', function (event, section) {
 +
section.groups.format.tools.htmlbold = {
 +
action: { type: "encapsulate", options: { pre: "<b>", post: "</b>" } },
 +
label: "Получер текст чрез маркер <b>",
 +
icon: '//upload.wikimedia.org/wikipedia/commons/a/ae/Toolbaricon_bold_b.png',
 +
group: "format", section: "main", type: "button"
 +
};
 +
section.groups.format.tools.htmlitalic = {
 +
action: { type: "encapsulate", options: { pre: "<i>", post: "</i>" } },
 +
label: "Курсивен текст чрез маркер <i>",
 +
icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbaricon_italic_i.png',
 +
group: "format", section: "main", type: "button"
 +
};
 
});
 
});
 
});
 
});

Версия от 17:13, 25 ноември 2012

jQuery(function($) {
	var extraSymbols = [
		{
			action: { type: "encapsulate", options: { pre: "⟨", post: "⟩" } },
			label: "⟨⟩"
		},
		"△", "▽", "◇"
	];
	var addExtraSymbols = function(pages, symbols) {
		$.each(symbols, function(i, symbol){
			pages.symbols.characters.push(symbol);
		});
	};
	var reorderPages = function(pages) {
		var newPages = {};
		newPages = {
			'symbols': pages.symbols,
			'greek': pages.greek,
			'cyrillic' : pages.cyrillic
		};
		$.each(pages, function(i, v){
			newPages[i] = pages[i];
		});
		return newPages;
	};
	$('#wpTextbox1').on('wikiEditor-toolbar-buildSection-characters', function (event, section) {
		addExtraSymbols(section.pages, extraSymbols);
		section.pages = reorderPages(section.pages);
	});
	$('#wpTextbox1').on('wikiEditor-toolbar-buildSection-main', function (event, section) {
		section.groups.format.tools.htmlbold = {
			action: { type: "encapsulate", options: { pre: "<b>", post: "</b>" } },
			label: "Получер текст чрез маркер <b>",
			icon: '//upload.wikimedia.org/wikipedia/commons/a/ae/Toolbaricon_bold_b.png',
			group: "format", section: "main", type: "button"
		};
		section.groups.format.tools.htmlitalic = {
			action: { type: "encapsulate", options: { pre: "<i>", post: "</i>" } },
			label: "Курсивен текст чрез маркер <i>",
			icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbaricon_italic_i.png',
			group: "format", section: "main", type: "button"
		};
	});
});