User:DarkLight300/global.js

//

importArticles({   type: 'script',    articles: [        'u:dev:PageCreator/code2.js',        'u:dev:GlobalEditcount/code.js',        'u:dev:LastEdited/code.js',        'u:dev:ClearSandbox/code.js',        'u:dev:MarkForDeletion/code.js',        'u:dev:EditConflictAlert/code.js',        'u:dev:BackToTopButton/code.js',        'u:dev:HoverEditCount/code.js',        'u:dev:EditBio/code.js',        'u:dev:Rollback/code.js',        'u:dev:WHAM/code.2.js',        'u:dev:PortableCSSPad/code.js',        'u:dev:WallGreetingButton/code.js',        'u:dev:MassEdit/code.js',        'u:dev:PiniginsUserInfo/code.js',        'u:dev:WHAM/code.2.js',    ] });

window.massEditConfig = { editSummary: "hi", editInterval: 3000 };

$(function {   if ((mw.config.get('skin') !== 'oasis' && wgNamespaceNumber !== 0) || (window.UsefulDropdown)) {        return;    }

var i18n = { en: { // English buttonTitle: 'Quick Stuff', protect: 'Protect', ajaxContent: 'AJAX Refresh', quickDelete: 'Quick Delete', stubTemplate: '+Stub', deleteTemplate: '+Delete', addCustomTemplate: '+Custom Template', contentRefreshed: 'Content Refreshed!' },       fr: { // French buttonTitle: 'Utile', protect: 'Protéger', ajaxContent: 'Contenu Ajax', quickDelete: 'Suppression rapide', stubTemplate: 'Modèle de stub', deleteTemplate: 'Modèle de suppression', // is this correct? Idek addCustomTemplate: 'Ajouter un modèle personnalisé', contentRefreshed: 'Contenu actualisé' },       be: { // Belarusian buttonTitle: 'Карысныя функцыі', protect: 'Абараніць', ajaxContent: 'AJAX-абнаўленне', quickDelete: 'Хуткае выдаленне', stubTemplate: 'Дадаць шаблон Stub', deleteTemplate: 'Дадаць шаблон Delete', addCustomTemplate: 'Карыстацкі шаблон', contentRefreshed: 'Змесціва абноўлена!' },       ru: { // Russian buttonTitle: 'Полезные функции', protect: 'Защитить', ajaxContent: 'AJAX-обновление', quickDelete: 'Быстрое удаление', stubTemplate: 'Добавить шаблон Stub', deleteTemplate: 'Добавить шаблон Delete', addCustomTemplate: 'Пользовательский шаблон', contentRefreshed: 'Содержимое обновлено!' },       uk: { // Ukrainian buttonTitle: 'Корисні функції', protect: 'Захистити', ajaxContent: 'AJAX-оновлення', quickDelete: 'Швидке видалення', stubTemplate: 'Додати шаблон Stub', deleteTemplate: 'Додати шаблон Delete', addCustomTemplate: 'Користувальницький шаблон', contentRefreshed: 'Вміст оновлено!' },       zh: { // Chinese buttonTitle: '快捷工具', protect: '保护页面', ajaxContent: 'AJAX 刷新', quickDelete: '快速删除', stubTemplate: '+小作品模板', deleteTemplate: '+删除模板', addCustomTemplate: '自定义模板', contentRefreshed: '内容刷新成功！' },       'zh-hant': { // Chinese-Traditional buttonTitle: '快捷工具', protect: '保護頁面', ajaxContent: 'AJAX 刷新', quickDelete: '快速刪除', stubTemplate: '+小作品模板', deleteTemplate: '+刪除模板', addCustomTemplate: '自定義模板', contentRefreshed: '內容刷新成功！' },       pl: { // Polish buttonTitle: 'Przydatne', protect: 'Zabezpiecz', ajaxContent: 'AJAX Refresh', quickDelete: 'Szybkie usuwanie', stubTemplate: '+Zalążek', deleteTemplate: '+EK', addCustomTemplate: '+Inny szablon', contentRefreshed: 'Treść odświeżona!' }   };

var lang = mw.config.get('wgContentLanguage'), elementContent = $.extend(i18n.en, i18n[lang.split('-')[0]], i18n[lang]);

$('.page-header__contribution-buttons').append("" +       "" +        " " + elementContent.buttonTitle + " " +        "" +        "" +        "" +        "  " +        "" +        "" +        "" + elementContent.protect + "" +        "" + elementContent.ajaxContent + "</li>" + "" + elementContent.quickDelete + "</a></li>" + "" + elementContent.stubTemplate + "</a></li>" + "" + elementContent.deleteTemplate + "</a></li>" + "" + elementContent.addCustomTemplate + "</a></li>" + "</ul>" + "  ");    // Protection     $('a#num1').click(function { var protectiontime = prompt('Expiry:'); var protectionreason = prompt('Protection Reason:'); if (protectiontime) { new mw.Api.post({               action: 'protect',                title: mw.config.get('wgPageName'),                reason: protectionreason,                expiry: protectiontime,                protections: 'edit=sysop',                token: mw.user.tokens.get('editToken')            }).done(function(d) {                if (d.error) {                    new BannerNotification('Error while protecting article: ' + d.error.code, 'error').show;                } else {                    new BannerNotification('Successfully protected article', 'success').show;                }            }).fail(function {                new BannerNotification('Error while protecting article', 'error').show;            }); }   });

// AJAX refresh $('a#num2').on("click", function refreshArticle {       var $temp = $(' ');        $temp.load(window.location.href + ' #mw-content-text', function { var $newContent = $temp.children('#mw-content-text'); if ($newContent.length) { $('#mw-content-text').replaceWith($newContent); mw.util.$content = $newContent;

}           }

);       $temp.remove;        new BannerNotification(elementContent.contentRefreshed, 'success').show;    });

// Adding stub template $('a#num3').click(function {       new mw.Api.post({ action: 'edit', title: wgPageName, summary: "Adding to help needed.", prependtext: " \n", token: mw.user.tokens.get('editToken') }).done(function(d) { if (d.error) { new BannerNotification('Error adding template: ' + d.error.code, 'error').show; } else { new BannerNotification('Successfully added to help needed!', 'success').show; }       }).fail(function { new BannerNotification('Error while adding template', 'error').show; });   });

// adding deletion template $('a#num4').click(function {       new mw.Api.post({ action: 'edit', title: wgPageName, summary: "Adding to candiates for deletion", prependtext: " \n", token: mw.user.tokens.get('editToken') }).done(function(d) { if (d.error) { new BannerNotification('Error adding template: ' + d.error.code, 'error').show; } else { new BannerNotification('Successfully added to candidates for deletion!', 'success').show; }       }).fail(function { new BannerNotification('Error while adding template', 'error').show; });   });

//Adding ability to have any other template via an input box.

// adding deletion template $('a#num5').click(function {       var templatename = prompt('Template Name:');        new mw.Api.post({ action: 'edit', title: wgPageName, summary: "Adding template", prependtext: " \n", token: mw.user.tokens.get('editToken') }).done(function(d) { if (d.error) { new BannerNotification('Error adding template: ' + d.error.code, 'error').show; } else { new BannerNotification('Successfully added template!', 'success').show; }       }).fail(function { new BannerNotification('Error while adding template', 'error').show; });   });

// Quick Deletion of article $('a#num7').click(function {       new mw.Api.post({ action: 'delete', title: wgPageName, reason: "Housekeeping", token: mw.user.tokens.get('editToken') })           .done(function { location.reload; });   });

window.UsefulDropdown = true; });