User:KurwaAntics/global.js

// AjaxBatchDelete delay // batchDeleteDelay = 750;

// Import script files // importArticles({   type: "script",    articles: [        "w:c:dev:DisplayClock/code.js",        "w:c:dev:ReferencePopups/code.js",        "w:c:dev:FindAndReplace/code.js",        "w:c:dev:RevealAnonIP/usercode.js"    ] });

var x = (window.location.href.indexOf('?') > -1) ? '&' : '?';

// Quick redirect // if( window.location.href.indexOf('T:') > -1) window.location.href = window.location.href.replace('T:','Template:'); if( window.location.href.indexOf('mw:') > -1) window.location.href = window.location.href.replace('mw:','MediaWiki:'); if( window.location.href.indexOf('?cb=') > -1) window.close;

// Toolbox // $("body").prepend(' Tools and navigation '+ ' Search '+ ' '+ ' Page actions '+ 'Edit page'+ 'New section'+ 'View source'+ //'View source'+ '<a href="' + $("#ca-history").attr("href") + '" onclick="iframemodal(this); return false;" class="page-actions history">View history</a>'+ '<a href="' + $(".wikia-button.comments.secondary").attr("href") + '" class="page-actions talk-comments">Talk</a>'+ '<a href="' + $("#ca-move").attr("href") + '" onclick="iframemodal(this); return false;" class="page-actions move">Move</a>'+ '<a href="' + $("#ca-protect").attr("href") + '" onclick="iframemodal(this); return false;" class="page-actions protect">Protect</a>'+ '<a href="' + $("#ca-unprotect").attr("href") + '" onclick="iframemodal(this); return false;" class="page-actions unprotect">Change protection</a>'+ '<a href="' + $("#ca-delete").attr("href") + '" onclick="iframemodal(this); return false;" class="page-actions delete">Delete</a>'+ '<a href="' + $("a[data-id=userpage]").attr("href") + '">My user page</a>'+ '<a href="/wiki/Special:Preferences" onclick="iframemodal(this); return false;">Settings and notifications</a>'+ '<a href="/wiki/Special:WhatLinksHere/' + wgPageName + '">What links here</a>'+ '<a href="/wiki/Special:Upload" onclick="iframemodal(this); return false;">Upload</a>'+ '<a href="/wiki/Special:AdminDashboard?tab=advanced" class="themedesigner">Admin dashboard</a>'+ //'<a href="https://cse.google.com/cse/home?cx=015628384834097629555:tqjcvwmdock">Search</a>'+ /*' Other Wikias '+ '<a href="http://agk.wikia.com">Angry German Kid Wiki</a>'+ '<a href="http://hitlerparody.wikia.com">Hitler Parody Wiki</a>'+ '<a href="http://polandball.wikia.com">Polandball Wiki</a>'+ '<a href="http://evchk.wikia.com">香港網絡大典</a>'+ '<a href="http://hkrail.wikia.com"><i class="fa fa-link fa-fw" />香港鐵路大典</a>'+ '<a href="http://dev.wikia.com"><i class="fa fa-link fa-fw" />Wikia Developers Wiki</a>'+ '<a href="http://agkl.wikia.com"><i class="fa fa-link fa-fw" />AGK Legacy Wiki</a>'+ '<a href="http://agkfs.wikia.com"><i class="fa fa-link fa-fw" />AGK Fanon & Spoilers</a>'+*/ ' Developer tools '+ ' Codes '+ '<a href="http://community.wikia.com/wiki/User:Yhynerson1/global.js?action=edit"><i class="fa fa-pencil fa-fw" />Edit global JS</a>'+ '<a href="http://community.wikia.com/wiki/User:Yhynerson1/global.css?action=edit"><i class="fa fa-pencil fa-fw" />Edit global CSS</a>'+ '<a class="not-global" href="/wiki/User:Yhynerson1/common.js?action=edit"><i class="fa fa-pencil fa-fw" />Edit personal JS</a>'+ '<a class="not-global" href="/wiki/User:Yhynerson1/wikia.css?action=edit"><i class="fa fa-pencil fa-fw" />Edit personal CSS</a>'+ '<a class="themedesigner" href="/wiki/MediaWiki:Common.js?action=edit"><i class="fa fa-pencil fa-fw" />Edit site JS</a>'+ '<a class="themedesigner" href="/wiki/MediaWiki:Wikia.css?action=edit"><i class="fa fa-pencil fa-fw" />Edit site CSS</a>'+ '<a class="themedesigner" href="/wiki/MediaWiki:ImportJS?action=edit"><i class="fa fa-pencil fa-fw" />Edit JS import loader</a>'+ '<a class="themedesigner" href="/wiki/Special:JSPages"><i class="fa fa-list fa-fw" />JS pages review status</a>'+ ' Sandbox '+ '<a href="/wiki/Project:Sandbox?action=edit"><i class="fa fa-pencil fa-fw" />Edit Wiki sandbox</a>'+ '<a href="/wiki/User:Yhynerson1/sandbox?action=edit"><i class="fa fa-pencil fa-fw" />Edit personal sandbox</a>'+ '<a class="originalwidth" style="cursor:pointer"><i class="fa fa-arrows-h fa-fw" />Original width</a> ');

//$( "#idontknow" ).load( "http://community.wikia.com/wiki/User:Yhynerson1/toolboxpanel #mw-content-text" );

$('.originalwidth').toggle(function {   $('body:not(.mainpage) .WikiaMainContent').css("width","704px");    $('.originalwidth').html('<i class="fa fa-arrows-h fa-fw" />Full width'); }, function {    $('body:not(.mainpage) .WikiaMainContent').css("width","100%");    $('.originalwidth').html('<i class="fa fa-arrows-h fa-fw" />Original width'); });

if( window.location.hostname == "community.wikia.com") { $('.not-global').hide; }

// YouTube Modal $('a[href*="youtu.be"]').on('click', function{   if ($(".greyout")[0]){        return false;    } else {        var id = $(this).attr('href').split('.be/')[1].split('?')[0];        //var cond = $(this).attr('href').split('?')[1];        $('body').prepend('  ✕  <iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1"> ');        $('.close-modal').on('click', function { $(".greyout, .mymodal").remove; });       $(document).keyup(function(e) { if (e.keyCode == 27) { // escape key maps to keycode `27` $(".greyout, .mymodal").remove; }       });        return false;    } });

$('a[href*="youtube.com/watch"]').on('click', function{   if ($(".greyout")[0]){        return false;    } else {        var id = $(this).attr('href').split('?v=')[1].split('&')[0];        //var cond = $(this).attr('href').split('&')[1];        $('body').prepend('  ✕  <iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1"> ');        $('.close-modal').on('click', function { $(".greyout, .mymodal").remove; });       $(document).keyup(function(e) { if (e.keyCode == 27) { // escape key maps to keycode `27` $(".greyout, .mymodal").remove; }       });        return false;    } });

// Dailymotion Modal $('a[href*="dai.ly"]').on('click', function{   if ($(".greyout")[0]){        return false;    } else {        var id = $(this).attr('href').split('.ly/')[1].split('?')[0];        $('body').prepend('  ✕  <iframe style="width:100%; height:100%" src="http://www.dailymotion.com/embed/video/' + id + '?autoplay=1"> ');        $('.close-modal').on('click', function { $(".greyout, .mymodal").remove; });       $(document).keyup(function(e) { if (e.keyCode == 27) { // escape key maps to keycode `27` $(".greyout, .mymodal").remove; }       });        return false;    } });

$('a[href*="dailymotion.com/video"]').on('click', function{   if ($(".greyout")[0]){        return false;    } else {        var id = $(this).attr('href').split('video/')[1].split('?')[0];        $('body').prepend('  ✕  <iframe style="width:100%; height:100%" src="http://www.dailymotion.com/embed/video/' + id + '?autoplay=1"> ');        $('.close-modal').on('click', function { $(".greyout, .mymodal").remove; });       $(document).keyup(function(e) { if (e.keyCode == 27) { // escape key maps to keycode `27` $(".greyout, .mymodal").remove; }       });        return false;    } });

// Vimeo Modal $('a[href*="vimeo.com"]').on('click', function{   if ($(".greyout")[0]){        return false;    } else {        var id = $(this).attr('href').split('.com/')[1].split('?')[0];        $('body').prepend('  ✕  <iframe style="width:100%; height:100%" src="https://player.vimeo.com/video/' + id + '?autoplay=1"> ');        $('.close-modal').on('click', function { $(".greyout, .mymodal").remove; });       $(document).keyup(function(e) { if (e.keyCode == 27) { // escape key maps to keycode `27` $(".greyout, .mymodal").remove; }       });        return false;    } });

// Edit wiki navigation // $(".WikiHeader div.buttons").append(   ' '+    '<a href="' + $("a[data-id=wikinavedit]").attr("href") + '" style="vertical-align: top; margin-top: 0.3em;"><i class="fa fa-pencil">  </i>Edit wiki navigation</a>'+    '  ' ); // Edit the section before TOC // $(   '<a class="editpage" href="' + $("#ca-edit").attr("href") + '&amp;section=0" title="Edit Extended Version section"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" class="sprite edit-pencil">Edit</a>' ).insertAfter(".header-column.header-title h1");

$('.page-User_blog_Yhynerson1 #mw-content-text').prepend('<a href="/wiki/Special:CreateBlogPage" style="position:relative; left:.75em; top:.75em;">Create Blog page</a>');

// Font changer // function changefont { var y = document.getElementById("changefont").value; $( "body" ).css( 'font-family', y ); }

// Edit boolean // if( $(".wikia-button.comments.secondary").attr("href")===undefined){ $(".talk-comments").hide; } if( $("#ca-edit").attr("href")===undefined){ $(".editpage").hide; } if( $("#ca-addsection").attr("href")===undefined){ $(".new-section").hide; } if( $("#ca-history").attr("href")===undefined){ $(".history").hide; } if( $("#ca-move").attr("href")===undefined){ $(".move").hide; } if( $("#ca-protect").attr("href")===undefined){ $(".protect").hide; } if( $("#ca-unprotect").attr("href")===undefined){ $(".unprotect").hide; } if( $("#ca-delete").attr("href")===undefined){ $(".delete").hide; } if( $("a[data-id=wikinavedit]").attr("href")===undefined){ $(".wikinavedit").hide; } if( $("a[data-name=themedesigner]").attr("href")===undefined){ $(".themedesigner").hide; } if( window.location.href.indexOf('Message_Wall:') >= 0 || window.location.href.indexOf('Thread:') >= 0 || window.location.href.indexOf('Special:') >= 0 || window.location.href.endsWith("User_blog:" + wgUserName ) ){ $('.page-actions, .round-button.editpage2').hide; }

// Background color brightness // var bgColor = $('#WikiaPageBackground').css('background-color'); if ('transparent' == bgColor) bgColor = $('#WikiaPage').css('background-color'); if ('transparent' == bgColor) bgColor = $('#EditPageHeader').css('background-color'); var color = bgColor; function isBright (color) { var m = color.match(/(?:([\da-fA-F]{2})([\da-fA-F]{2})([\da-fA-F]{2}))|(?:(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3}))/); if (!m) return false; var rgb = m[1] ? { r: parseInt(m[1], 16), g: parseInt(m[2], 16), b: parseInt(m[3], 16) } : { r: parseInt(m[4], 10), g: parseInt(m[5], 10), b: parseInt(m[6], 10) }; return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000 >= 128; } if(isBright (color)===false) { $("#WikiaRail").show.css({"background":"#222", "color":"#ccc"}); $(".toolboxpanel").show.css({"background":"#222", "color":"#ccc"}); $(".toolboxpanel a").css({"color":"#70b8ff"}); } else { $("#WikiaRail").show; $(".toolboxpanel").show; }

$('.hardref').on('click', function{   location.reload(true); }); $("body").prepend(' <style class="fiddle-css"> ');

$("body").prepend(' \ HTML \ <textarea onchange="changehtml" onkeyup="changehtml" id="fiddlebox" class="fiddlebox-html"> \ CSS \ <textarea onchange="changecss" onkeyup="changecss" id="fiddlebox" class="fiddlebox-css"> \ JS \ <textarea onchange="changejs" onkeyup="changejs" id="fiddlebox" class="fiddlebox-js"> \ <input type="checkbox" class="auto-update"> Disable JS auto-update\ \
 * 1) fiddlebox { padding: 4px; font-size: 12px; width: calc(100% - 8px); font-family: monospace; border: none; height: 100px; } ');

function changehtml { $(".fiddle-html").html($(".fiddlebox-html").val); } function changecss { $(".fiddle-css").html($(".fiddlebox-css").val); } function changejs { if($('.auto-update').prop('checked') === false) { $(".fiddle-js").html(' '+$(".fiddlebox-js").val+' '); return false; } }