User:Netsu/common.js

$("body").css({

"position": "relative", "width":   "1000px", "margin":  "auto"

});

$("pre").css({

"white-space": "pre-wrap"

});

$("a.internal > img").each(function {

var src = $(this).attr("src");

if(src.indexOf("magnify-clip") === -1) return true; // атрибут target blank для иконки под картинкой $(this).parent("a").attr("target", "_blank"); //    $("body").prepend(src + " "); return true;

});

$("a.image").each(function {

var src = $(this).children("img").attr("src"); var attrhref = $(this).attr("href");

if ($(this).children("img").attr("width") > 800) $(this).children("img").attr("width", "800").removeAttr("height");

var matches = src.match(/(http:|)\/\/(.*?)\/thumb\/(.)\/(..)\/(.*?)\//);

if (!matches) {

$(this).attr({     href: src,      target: "_blank"    });

return true;

}

$(this).attr({   href: "http://" + matches[2] + "/" + matches[3] + "/" + matches[4] + "/" + matches[5],    target: "_blank"  });

return true;

});

function getHostname(url) {

var hostnameRegexp = new RegExp("^(http(s|):|)\/\/[^/]+"); var m = url.match(hostnameRegexp); return m ? m[0].replace("http://", "").replace("https://", "").replace("www\.", "").replace("//", "") : null;

}

$("a").each(function {

var linkHref = $(this).attr("href"); if (!linkHref) return true; linkHref = getHostname(linkHref);

if (linkHref !== location.host && linkHref !== null) $(this).attr("target", "_blank"); // $("body").prepend(linkHref + " " + location.host + " "); return true;

});

mw.loader.using('mediawiki.action.edit', function {        var button = {                id: 'button-comment',                imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png',                speedTip: 'Comment visible only for editors',                tagOpen: '',                sampleText: 'Insert comment here'        };        mw.toolbar.addButton( button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id       ); });

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/c/c9/Button_strike.png", "speedTip": "Зачеркнутый", "tagOpen": ' ', "tagClose": ' ', "sampleText": "Зачеркнутый"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/f/fd/Button_underline.png", "speedTip": "Подчеркнутый", "tagOpen": ' ', "tagClose": ' ', "sampleText": "Подчеркнутый"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/1/1d/Button_redirect_rus.png", "speedTip": "Перенаправление", "tagOpen": "\#перенаправление \[\[", "tagClose": "\]\]", "sampleText": "название страницы"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/3/3c/Button_cat_ru.png", "speedTip": "Категория", "tagOpen": 'Категория:',    "tagClose": '', "sampleText": "Название категории"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/2/2f/Button_head_A1.png", "speedTip": "Заголовок 1-го уровня", "tagOpen": "\n==", "tagClose": "==", "sampleText": "Заголовок"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/7/78/Button_head_A2.png", "speedTip": "Заголовок 2-го уровня", "tagOpen": "\n===", "tagClose": "===", "sampleText": "Заголовок"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/4/4f/Button_head_A3.png", "speedTip": "Заголовок 3-го уровня", "tagOpen": "\n====", "tagClose": "====", "sampleText": "Заголовок"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/1/14/Button_head_A4.png", "speedTip": "Заголовок 4-го уровня", "tagOpen": "\n=====", "tagClose": "=====", "sampleText": "Заголовок"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile":"http://aniwiki.net/images/8/8c/Button_head_A5.png", "speedTip": "Заголовок 5-го уровня", "tagOpen": "\n======", "tagClose": "======", "sampleText": "Заголовок"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/0/0c/Button_Link_DifferentName.png", "speedTip": "Название страницы|Текст который нужен на странице", "tagOpen": ,    "tagClose": , "sampleText": "Текст"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/3/3e/Sharp_button.png", "speedTip": "Линк на заголовок", "tagOpen": ,    "tagClose": , "sampleText": "Текст ссылки"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/e/ea/Button_align_left.png", "speedTip": "Слева", "tagOpen": ' ', "tagClose": ' ', "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/5/5f/Button_center.png", "speedTip": "По центру", "tagOpen": ' ', "tagClose": ' ', "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/a/a5/Button_align_right.png", "speedTip": "Справа", "tagOpen": ' ', "tagClose": ' ', "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://aniwiki.net/images/b/bf/Br.png", "speedTip": "br ", "tagOpen": ' ',    "tagClose": '', "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/31/Sub-button-bg.png", "speedTip": "", "tagOpen": ' ', "tagClose": ' ', "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ea/Sup-button-bg.png", "speedTip": "", "tagOpen": ' ', "tagClose": ' ', "sampleText": ""};