User:Soxra/monobook.js: Difference between revisions

From the Kingdom Hearts Wiki, the Kingdom Hearts encyclopedia
Jump to navigationJump to search
(Quick change...)
(Undo revision 573055 by Soxra (talk))
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(document).ready(function() {
$(document).ready(function () {
/* Recent Changes Preview */
    /* Force input boxes to have input box class */
$(".page-Special_RecentChanges").each(function() {
    $(":text, input[type='text'], input[type='password'], input[type='search'], textarea, input#wpSummary").addClass("input-text-box");
var openTimer = undefined;
 
var currTimer = undefined;
    /* Improvement Box Tabber */
var currAjax = undefined;
    $(".improvementBox").find(".improveTabLinkBox a").click(function () {
$("head").append($("<link rel='stylesheet' href='http://www.khwiki.net/load.php?debug=false&lang=en&modules=mediawiki.legacy.diff&only=styles&skin=monobook&*' type='text/css'/>"));
        $(".improvementBox").find("#improveTabs > div").hide();
$("<div/>",{
        $(".improvementBox").find("#improveTabs > div" + $(this).attr("href")).show();
id:"rc-preview-div",
        return false;
style:"position:absolute;height:300px;width:50%;background:#fff;border:1px solid #888;z-index:500;padding:10px;box-shadow:2px 2px 6px rgba(0,0,0,0.5);border-radius:8px",
    });
}).hide().appendTo("body");
$("table.mw-enhanced-rc a").live("mouseover",function() {
var $link = $(this);
var subtxt = $link.text().substr(-7);
if (subtxt == "diff" || subtxt == "prev" || subtxt == "changes") {
if (currAjax) currAjax.abort();
if (currTimer) clearTimeout(currTimer);
if (openTimer) clearTimeout(openTimer);
openTimer = setTimeout(function() {
var otop = $link.offset().top;
var oleft = $link.offset().left;
var wide = $link.width();
$("div#rc-preview-div").css({
top:otop-150,
left:oleft+wide+5,
}).html("Loading...").show();
currAjax = $.ajax({
url:"http://www.khwiki.net/index.php",
method:"GET",
data:$link.attr("href").substr(11),
dataType:"text",
success:function(msg, status, obj) {
while (msg.charCodeAt(0) < 32)
msg = msg.substr(1);
$("div#rc-preview-div").html("<div style='height:24px;font-size:18px;font-weight:bold'><a href='"+$link.attr("href")+"'>"+$link.attr("title")+"</a></div><div style='height:276px;font-size:110%;width:auto;overflow-y:auto'><table class='diff'>"+$(msg).find("table.diff").html()+"</table></div>").hover(function() {
if (currTimer) clearTimeout(currTimer);
},function() {
$("div#rc-preview-div").hide().html("");
}).find("#mw-diff-otitle4, #mw-diff-ntitle4").hide();
},
});
if (openTimer) clearTimeout(openTimer);
},1000);
}
}).live("mouseout",function() {
if (currTimer) clearTimeout(currTimer);
if (openTimer) clearTimeout(openTimer);
currTimer = setTimeout(function() {
$("div#rc-preview-div").hide().html("");
if (currTimer) clearTimeout(currTimer);
if (openTimer) clearTimeout(openTimer);
},1000);
});
});
});
});

Latest revision as of 01:23, 8 August 2012

$(document).ready(function () {
    /* Force input boxes to have input box class */
    $(":text, input[type='text'], input[type='password'], input[type='search'], textarea, input#wpSummary").addClass("input-text-box");

    /* Improvement Box Tabber */
    $(".improvementBox").find(".improveTabLinkBox a").click(function () {
        $(".improvementBox").find("#improveTabs > div").hide();
        $(".improvementBox").find("#improveTabs > div" + $(this).attr("href")).show();
        return false;
    });
});