User:Hulothe/global.js

AjaxDiff = { expiry: "3 days", reason: "Spam" };

importArticles({   type: 'script',    articles: [        'u:dev:PortableCSSPad/code.js',        'u:dev:MiniComplete/code.js',        'u:wikimarks:Client.js',        'u:dev:View_Source/code.js',        'u:dev:QQX/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:AutoEditDropdown/code.js',        'u:dev:CategoryRenameAuto-update/code.js',        'u:dev:AjaxDiff/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:LastEdited/code.js'     ] });

//Edit count tab $(function {   var loc = window.location.href;    var username = (wgTitle == "Contributions") ? loc.substring(loc.lastIndexOf("/")+1) : wgTitle;    $('.tabs-container > ul.tabs').append('Editcount'); });

/* Wikimarks */ addOnloadHook( function {    $( '.WikiNav .wikimarks-logo' ).html( 'Outils' ); } );

//Special CSS controller jQuery(function ($) {   if (mw.config.get('wgCanonicalSpecialPageName') === 'CSS') {        $(".css-editor").prepend(" 100% ");    }    var countcss = 0;    $("#buttom-css").click(function  { countcss += 1; if (countcss == 1) { $(this).text("Default"); $(".css-editor-wrapper").css("width", "100%"); $(".css-side-bar").css("display", "none"); $(".ace_gutter").css("display", "none"); $(".ace_scroller").css("left", "0px"); }       if (countcss == 2) { $(this).text("100%"); $(".css-editor-wrapper").css("width", "auto"); $(".css-side-bar").css("display", "block"); $(".ace_gutter").css("display", "block"); $(".ace_scroller").css("left", "49px"); countcss = 0 }   }); });

var lien = 'Factory'; var lien2 = 'C.C.'; var lien3 = 'WLB'; $('.toolbar > ul.tools').append(lien).append(lien2).append(lien3);

importScriptPage('User:Monchoman45/ChatHacks.js', 'c');

/* var specialpages = [ "Special:BrokenRedirects", "Special:DoubleRedirects", "Special:DeadendPages", "Special:BrokenRedirects", "Special:LonelyPages", "Special:UnusedFiles", "Special:UnusedTemplates" ]; if (specialpages.indexOf(mw.config.get('wgPageName')) !== -1) { $('#WikiaArticle').prepend('<textarea id="output-box" rows="10" cols="100"> '); if ("Special:UnusedFiles".indexOf(wgPageName) !== -1) { $('div.thumb img').each(function {       $('#output-box').append('File:'+$(this).attr('data-image-name')+'\n')}); } else { $('ol.special').find('li').each(function {       var text = $(this).find('a').first.text;        document.getElementById('output-box').value += text + '\n';}); } }
 * Display a list of text for certain special pages
 * Written by Shining-Armor
 * Added support for Special:UnusedFiles by Ozuzanna

if ((wgAction == 'submit' || wgAction == 'edit') && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://img2.wikia.nocookie.net/__cb1408628901/common/avatars/thumb/f/ff/4572079.png/20px-4572079.png", "speedTip": "Create user page", "tagOpen": "", "tagClose": "", "sampleText": ""}; } $( document ).ready(function {    function getUtilisateur(e) {        function insertAtCaret(element, text, type) {            if (document.selection) {                // Internet Explorer                element.focus;                var sel = document.selection.createRange;                sel.text = text;                element.focus;            } else if (element.selectionStart || element.selectionStart === 0) {                // Firefox and WebKit-based browsers                var debuta = element.selectionStart;                var fin = element.selectionEnd;                var scrollTop = element.scrollTop;                if (type === "insert") {                    element.value = element.value.substring(0, debuta) + text + element.value.substring(fin, element.value.length);                    element.focus;                    element.selectionStart = debuta + text.length; element.selectionEnd = fin + text.length; element.scrollTop = scrollTop; } else { var tèxte = element.value.substr(debuta - 1, 1); if (tèxte == "\t") { element.value = element.value.substring(0, debuta - 1) + element.value.substring(fin, element.value.length); element.focus; element.selectionStart = debuta - 1; element.selectionEnd = fin - 1; element.scrollTop = scrollTop; }               }            }        }        function quoraAcabat(param) { if($(this).val == param) { $('#estatut').text('À jour'); $('#estatut').removeClass('rouge').addClass('vert'); $( '.global-navigation .start-wikia-container .bubble' ).removeClass( 'red' ).addClass( 'green' ); } else { $('#estatut').text('Pas à jour'); $('#estatut').removeClass('vert').addClass('rouge'); $( '.global-navigation .start-wikia-container .bubble' ).removeClass( 'green' ).addClass( 'red' ); }                   }        if($( '#aaatextarea' ).length) { $('#aaatextarea, .aaa-actions').show; } else { $( 'body' ).prepend(' .vert{color:green}.rouge{color:red}.aaa-actions div{clear:none;float:left}#crotz:hover, #publicar:hover{background-color:#271e1c;border-radius:15px!important;border:1px solid dimgrey!important} '); $( 'body' ).append('<textarea id="aaatextarea" style="z-index: 6000000; position: fixed; left: 0px; top: 0px; padding: 20px; font-family: monaco,monospace; font-size: 15px; color: #9ac; height: 99%; width: 100%; background-color: #1d1e1c"> <div id="estatut" class="vert" style=" height: 106px; transition: 0.2s; font-size: 14px; padding: 50px; align: center;">À jour <div id="publicar" style="padding: 5px;border: 1px solid transparent;border-radius: 15px;transition: 0.5s;cursor: pointer;font-size: 300%;font-family: fantasy;padding: 30px;margin-right: 20px;">Publier <div id="crotz" style="padding: 5px;border: 1px solid transparent;border-radius: 15px;transition: 1s;cursor: pointer;"><div style="background: url(\'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Noun_project_-_supprimer_round.svg/200px-Noun_project_-_supprimer_round.svg.png\'); height: 90px; width: 90px;background-size: contain;background-repeat: no-repeat;">  <div class="successhehe" style="font-size: 230px; opacity: 0.1; font-weight: bold; position: fixed; color: green; display: none; z-index: 6000000">Succès ! ');           $.getJSON("/api.php?action=query&format=json&prop=revisions&titles=A_faire&rvprop=content&cb=" + new Date.getTime, function(data) { if(data.query.pages[-1] === undefined) { var page_Data = data.query.pages, page_Content; for (var page_id in page_Data) { page_Content = page_Data[page_id].revisions[0]["*"]; // updated page content }                   $(document).resize(function {                        $('.successhehe').css('top', (($(window).height / 2) - ($( '.successhehe' ).height / 2)) + 'px').css('left', (($(window).width / 2) - ($( '.successhehe' ).width / 2)) + 'px');                        $('#aaatextarea').css('height', ($(window).height - 32) + 'px');                    }); $(document).trigger('resize'); $('#aaatextarea').text(page_Content); ;(function($){                       $.fn.extend({ acabat: function(callback,timeout){ timeout = timeout || 1e3; // 1 second default timeout var timeoutReference, doneTyping = function(el){ if (!timeoutReference) return; timeoutReference = null; callback.call(el); };                               return this.each(function(i,el){                                    var $el = $(el);                                    $el.is(':input') && $el.on('keyup keypress input paste', function(e){ if (e.type=='keyup' && e.keyCode!=8) return; if (timeoutReference) clearTimeout(timeoutReference); timeoutReference = setTimeout(function{                                           doneTyping(el);                                        }, timeout); }).on('blur',function{ doneTyping(el); });                               });                            }                        });                    })(jQuery); $( '#aaatextarea' ).acabat(function {                       quoraAcabat.call(this, page_Content);                    }).keydown(function (event) {                        if (9 === event.which) {                            event.preventDefault;                            if (!event.shiftKey) {                                insertAtCaret(this, '\t', 'insert');                            } else {                                insertAtCaret(this, '', 'remove');                            }                            quoraAcabat.call('#aaatextarea', page_Content);                        }                    }); } else { alert('La page demandée n\'existe pas'); }           });            $( '#publicar' ).on('click', function { $.ajax({                   url: mw.util.wikiScript( 'api' ),                    data: {                        format: 'json',                        action: 'edit',                        title: 'A faire',                        text: $( '#aaatextarea' ).val,                        token: mw.user.tokens.get("editToken")                    },                    dataType: 'json',                    type: 'POST',                    success: function( data ) {                        if ( data && data.edit && data.edit.result == 'Success' ) {                            $(".successhehe").fadeIn('fast');                            setTimeout(function { $(".successhehe").fadeOut; }, 800);                           var page_Content = $( '#aaatextarea' ).val;                            $('#estatut').text('À jour');                            $('#estatut').removeClass('rouge').addClass('vert');                            $( '.global-navigation .start-wikia-container .bubble' ).removeClass( 'red' ).addClass( 'green' );                        } else if ( data && data.error ) {                            alert( 'Error: API returned error code "' + data.error.code + '": ' + data.error.info );                        } else {                            alert( 'Error: Unknown result from API.' );                        }                    },                    error: function( xhr ) {                        alert( 'Error: Request failed.' );                    }                }); });       }        $( '#crotz' ).click(function { $( '#aaatextarea, .aaa-actions' ).hide; });   }    $( '.global-navigation .start-wikia-container .start-wikia' ).replaceWith('<a href="http://fr.wkhlttst.wikia.com/wiki/A_faire"><div style="cursor:pointer" class="tieira start-wikia" title="Tièira de causas de far"> À faire  <a/>');    $( '.global-navigation .start-wikia-container' ).prepend( ' ' );    $( '.tieira' ).click(function(e) { if(wgDBname === 'frhulothe') { e.preventDefault; getUtilisateur; }   });    if(wgDBname === 'frhulothe' && wgPageName === "A_faire") {        getUtilisateur;    } });

//importScriptURI('https://internal.wikia-inc.com/index.php?title=MediaWiki:ForcePreview.js&action=raw&ctype=text/javascript');

/* Founder Help */ /*if (mw.config.get('wgNamespaceNumber') !== 1200 || wgCanonicalNamespace !== "Mur") { return false; }*/ console.log('Je suis là.'); $('.WikiaFooter .tools-menu, .WikiaBarWrapper .tools-menu').append('Founder Help</a></li>'); var founderHelpText = '\ <form method="" name="" class="WikiaForm"> \ \       <textarea id="fh-texte" style="width: 680px; height: 200px">Bonjour,\n\nJe suis Hulothe, Assistant francophone. Nous faisons actuellement le tour des wikias pour voir si les administrateurs ont besoin d\'aide.\n\nSi quoi que ce soit te vient à l\'esprit, n\'hésite pas à m\'en faire part (par exemple, la conception de modèle, les extensions, les tâches nécessitant un robot, etc...). Si c\'est faisable, je serais ravi de te donner un coup de pouce !\n\nBonne journée,\n \ \ '; $('#fh-wall-button').click(function {    $.showCustomModal('User rights', founderHelpText, { id: 'form-main', width: 700, buttons: [{ message: 'Publier', defaultButton: true, handler: function { posterFhelp; }	       },{          message: 'Tu / Vous', defaultButton: true, handler: function { changerRegistre; }       },{          message: 'Annuler', defaultButton: true, handler: function { $('#form-main').closeModal; }       }]    }); }); function posterFhelp { $.post(mw.util.wikiScript('wikia'), {       controller   : 'WallExternal',        method       : 'postNewMessage',        pagenamespace: '1200',        pagetitle    : $('.UserProfileMasthead .masthead-info h1').text,        messagetitle : 'Besoin d\'aide ?',        body         : $('textarea#fh-texte').text + '\n' + '',        format       : 'json'    }); setTimeout((function{ location.reload; }), 2000);			} function changerRegistre { var newtext, letextedefh = $('textarea#fh-texte').text; newtext = letextedefh.replace(/ te /g, ' vous ').replace('site ', 'sitez '); $('textarea#fh-texte').text(newtext); }

(function (window, document, $) {   'use strict';    $(function  { var keys = [], whpas = '65,83,39,39', com = '70,82,67,39,39', hp = '72,80,39,39', wlb = '87,76,66,39,39', cc = '67,67,39,39', search = '70,70,39', moi = '77,79,73,39,39'; $(document).keydown(function (e) {           keys.push(e.keyCode);            if (keys.toString.indexOf(whpas) > -1) {                window.location.assign('http://fr.whpas.wikia.com/');                keys.length = 0;            } else if (keys.toString.indexOf(com) > -1) {                window.location.assign('http://fr.c.wikia.com/');                keys.length = 0;                            } else if (keys.toString.indexOf(hp) > -1) {                window.location.assign('http://fr.hp.wikia.com/');                keys.length = 0;                            } else if (keys.toString.indexOf(wlb) > -1) {                window.location.assign('http://wlb.wikia.com/');                keys.length = 0;                            } else if (keys.toString.indexOf(cc) > -1) {                window.location.assign('http://c.wikia.com/');                keys.length = 0; } else if (keys.toString.indexOf(moi) > -1) { window.location.assign('http://fr.wkhlttst.wikia.com/'); keys.length = 0; } else if (keys.toString.indexOf(search) > -1) { $('#searchInput').focus; keys.length = 0; }       });    }); }(this, this.document, this.jQuery));

/* * Ajoute les contributions et la liste de suivi au menu déroulant des comptes utilisateurs * Auteur original inconnu * Autres auteurs : Ryan PM et Cqm de RuneScape Wiki + Hulothe */ (function ($, console, document, rswiki) {   'use strict';    $('#AccountNavigation > li > .subnav > li:first-child').after( $('').attr({           'id': 'MyContribs'        }).append(            $('<a/>').attr({ 'href': '/wiki/Special:MyContributions' }).text('Contributions')       ),

$('').attr({           'id': 'Liste'        }).append(            $('<a/>').attr({ 'href': 'http://ombredumordor.wikia.com/' }).text('Ombre du Mordor')       ),

$('').attr({           'id': 'DevWiki'        }).append(            $('<a/>').attr({ 'href': 'http://dev.wikia.com/wiki/Special:WikiActivity' }).text('Développeurs')       ) ); }(this.jQuery, this.console, this.document, this.rswiki = this.rswiki || {}));