User:Dzylon-fduser/wikia.js

/* For Infinity Blade Wiki. By User:Dzylon */ $(function {    function IBWprefButton {        if (typeof localStorage.IBWpref !== 'undefined') {            $("#WikiHeader .buttons").prepend("");            $(".removeIBWpref").on("click", function { if (confirm('Are you sure you want to remove your game preference?')) { localStorage.removeItem("IBWpref"); $(".removeIBWpref").remove; }           });        }    }    IBWprefButton;    if ($(".gameDisambig").length > 0 && typeof(Storage) !== "undefined") {        if (typeof localStorage.IBWpref !== 'undefined') {            if (localStorage.IBWpref === "ib1") {                if ($(".bgred > a").hasClass('new') !== true) {                    window.location.replace((document.URL) + "_%28IB1%29");                }            } else if (localStorage.IBWpref === "ib2") {                if ($(".bgblue > a").hasClass('new') !== true) {                    window.location.replace((document.URL) + "_%28IB2%29");                }            }        } else {            function setPref(a) {            var pref = a;            localStorage.setItem('IBWpref', pref);                IBWprefButton;                var prefName;                if (pref === "ib1") {                    prefName = "Infinity Blade I"; } else { prefName = "Infinity Blade II"; }               function gamePrefConfirm { $("#gamePreferenceConfirm").animate({height:'285px'}, 700); $("#gamePreferenceConfirm span").replaceWith(" Your preference has been saved. From now on, you will be immediately brought to the " + prefName + " page - you can always navigate to the other page using the box in the upper-left hand of the article. If you wish to reset your game preference so that you can configure it again, you can click the small gear icon in the upper-right portion of the site body (to the left of the \"Contribute\" dropdown). Please note that this feature may not work in certain circumstances, including:The " + prefName + " article does not yet exist.You follow a link that specifically points to the other game's page.You clear your cache.You browse the site in your browser's \"private browsing\" mode.If you are experiencing issues, please contact administrator Dzylon. ");                   $("#gamePreferenceConfirm div").animate({height:'250px'}, 700);                }                function optOutConfirm {                    $("#gamePreferenceConfirm").animate({height:'130px'}, 700);                    $("#gamePreferenceConfirm span").replaceWith(" No preference was set, and this message should no longer be displayed. If you change your mind, you can click the small gear icon in the upper-right portion of the site body (to the left of the \"Contribute\" dropdown) to reset the message. If you are experiencing issues, please contact administrator Dzylon. ");                   $("#gamePreferenceConfirm div").animate({height:'110px'}, 700);                }                $("#gamePreference div").slideUp(700);                $("#gamePreference").animate({height:'25px'}, 750);                if (pref === "optOut") {                    optOutConfirm;                } else {                    gamePrefConfirm;                }            }            $(".gameDisambig tr:last-child").after("<tr id='gamePreference'><td class='bglight' colspan='2'> The Infinity Blade Wiki features many weapons and other items found in both Infinity Blade I and Infinity Blade II. To handle the variants, we use these \"disambiguation\" pages. If you'd like, you can set which game's info you'd like to display first. For example, if you select Infinity Blade II below, you'll be brought to the Infinity Blade II page first if there are two pages available. Don't worry, we'll remember your choice. You should only need to select an option once. <button id='ib1pref'>Infinity Blade I <button id='ib2pref'>Infinity Blade II <button id='nvmpref'>No thanks   ");            $(".gameDisambig #gamePreference").after("<tr id='gamePreferenceConfirm'><td colspan='2' class='bg'>    ");            $("#ib1pref").on("click", function { var a = "ib1"; setPref(a); });            $("#ib2pref").on("click", function { var a = "ib2"; setPref(a); });            $("#nvmpref").on("click", function { var a = "optOut"; setPref(a); });        }    } });