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:fr.harrypotter:Mediawiki:Contribs.js',        'u:dev:PageMakerPro/code.js',        'u:dev:QQX/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:AutoEditDropdown/code.js',        'u:dev:CategoryRenameAuto-update/code.js',        'u:fr.harrypotter:MediaWiki:CdT.js',        'u:dev:AjaxDiff/code.js',        'u:dev:FindAndReplace/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) {            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 startPos = element.selectionStart;                var endPos = element.selectionEnd;                var scrollTop = element.scrollTop;                element.value = element.value.substring(0, startPos) + text + element.value.substring(endPos, element.value.length);                element.focus;                element.selectionStart = startPos + text.length;                element.selectionEnd = startPos + text.length; element.scrollTop = scrollTop; }       }        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; 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 }                   $('.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'); $('#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 {                       if($(this).val == page_Content) {                            $('#estatut').text('À jour');                            $('#estatut').removeClass('rouge').addClass('vert');                        } else {                            $('#estatut').text('Pas à jour');                            $('#estatut').removeClass('vert').addClass('rouge');                        }                    }).keydown(function (event) {                        if (9 === event.which) {                            insertAtCaret(this, '\t');                            return false;                        }                    }); } 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');                        } 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/>');    $( '.tieira' ).click(function(e) { if(wgDBname === 'frhulothe') { e.preventDefault; getUtilisateur; }   });    });

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