MediaWiki:Common.js

From HEROsector01
Jump to navigationJump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$("#flow-container").css("overflow","visible");

window.onload = function() {
  var a=document.getElementById("table1").offsetHeight;
  var b=document.getElementById("row1").offsetHeight;
  var c=document.getElementById("row2").offsetHeight;
  var d=document.getElementById("row3").offsetHeight;

  var total=b + c + d;
  var height=a - total;
  var final=height - 46;

  switch (navigator.appName)
  {
  case "Microsoft Internet Explorer":
  var final=height - 47;
  break;
  default:
  var final=height - 46;
  }
  
  document.getElementById("newsalign").style.height=final + "px";
  var pageloadmp=document.getElementById("mp-home").innerHTML;
  jQuery("#content-home").html(pageloadmp);
  var scrollheight = final - 26;
	jQuery(document).ready(function(){
				
		jQuery('#scrollbar1').tinyscrollbar({ sizethumb: 50, size: scrollheight });
		
	});

  jQuery("#scrollbar1 .viewport").css("height",final + "px");
  jQuery("#scrollbar1 .overview").css("height",final + "px");
}

jQuery(window).resize(function() {
  var a=document.getElementById("table1").offsetHeight;
  var b=document.getElementById("row1").offsetHeight;
  var c=document.getElementById("row2").offsetHeight;
  var d=document.getElementById("row3").offsetHeight;

  var total=b + c + d;
  var height=a - total;
  var final=height - 46;

  switch (navigator.appName)
  {
  case "Microsoft Internet Explorer":
  var final=height - 47;
  break;
  default:
  var final=height - 46;
  }
  
  document.getElementById("newsalign").style.height=final + "px";
  var pageloadmp=document.getElementById("mp-home").innerHTML;
  jQuery("#content-home").html(pageloadmp);
  var scrollheight = final - 26;
	jQuery(document).ready(function(){
				
		jQuery('#scrollbar1').tinyscrollbar({ sizethumb: 50, size: scrollheight });
		
	});

  jQuery("#scrollbar1 .viewport").css("height",final + "px");
  jQuery("#scrollbar1 .overview").css("height",final + "px");
}
);

function mpfade(id) {
  jQuery(".mpbox-switch-content").fadeOut('slow', function() {
      var mptext=document.getElementById("mp-" + id).innerHTML;
      jQuery("#content-home").html(mptext);
      jQuery(".mpbox-switch-content").fadeIn('slow', function() {
          // Switch complete.
      });
  });
}

function letsfade( type, id ){
	if(type==='to'){
		if($("#faded").length == 0){
		$('<div id="faded" style="float:left;width:100%;display:none;">').appendTo("#flow-container");
		}
		var h = $("#flow-content").height();
		$("#flow-container").css("height",h);
		//$("#flow-content").fadeOut(100);
		$("#faded").load("/wiki/Template:MP"+id+" #bodyContent > *", function(){
 			$('<div style="cursor:pointer; position:absolute; right:20px; top:50px;"><img src="http://www.brickshelf.com/gallery/HS01/HS01/backbutton2.png" id="BackButtonId"></div>').prependTo("#faded");
			$("#BackButtonId").click(function(){
				letsfade();
			});
		});	
		$("#flow-content").delay(500).fadeOut(500);
		$("#faded").delay(500).fadeIn(500);
	}else{
		$("#faded").fadeOut(500);
		$("#flow-content").fadeIn(500);
//.delay(1000)
	}
}

function mpslide( type, id ){
    if(type==='to'){
        var $toContent = $("#toContent"),
            w = $toContent.width();
        $toContent.load("/wiki/Template:MP"+id+" #bodyContent > *", function(){
                $("<div>")
                    .css({
                        'cursor':'pointer',
                        'position':'relative',
                        'float':'right'
                    })
                    .append(
                        $("<img>")
                            .prop("src","http://biosector01.com/images/mpnav/backbutton.png")
                            .prop("id", "BackButtonId")
                    )
                    .prependTo("#toContent")
                    .closest("#toContent")
                    $("div > img").click(function(){
                        mpslide();
                    });
                $(this)
                    .closest("#flow-content")
                    .animate({'marginLeft':'-' + w},400);
            });
    } else {
        $("#flow-content")
            .animate({
                'marginLeft':'0'
            }, 400, function(){
                $(this)
                    .find("#toContent")
                    .text("");
            });
    }
}

function ucfirst(str) {
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}

$(document).ready(function() {
    $("#navIcons>img").mouseover(function() {
        var rolloverUrl = $(this).attr('src').replace(/(.png)/, "1.png");
        $(this).attr('src', rolloverUrl);
    });
    
    $("#navIcons>img").mouseout(function() {
        var rolloverUrl = $(this).attr('src').replace(/(1.png)/, ".png");
        $(this).attr('src', rolloverUrl);
    });
    
    $("#navIcons>img").click(function() {
        var letsFadeto = $(this).attr('src').replace(/(.*?)(\/nav\/)(.*?)(1.png)/, "$3");
        letsfade('to', ucfirst(letsFadeto));
    });

    $("#miniNavIcons>img").click(function() {
        var letsFadeto = $(this).attr('src').replace(/(.*?)(\/nav\/)(.*?)(m.png)/, "$3");
        letsfade('to', ucfirst(letsFadeto));
    });
});


//Stuff for the tabber.  Please do not edit.

if($("#startertab").html() == "1"){
$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info1').show();
}
if($("#startertab").html() == "2"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info2').show();
}
if($("#startertab").html() == "3"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info1').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info3').show();
}
if($("#startertab").html() == "4"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info1').hide();$('#info5').hide();$('#info6').hide();$('#info4').show();
}
if($("#startertab").html() == "5"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info1').hide();$('#info6').hide();$('#info5').show();
}
if($("#startertab").html() == "6"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info1').hide();$('#info6').show();
}
if($("#startertab").html() == "1sub"){
$('#info1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo1').show();
}
if($("#startertab").html() == "2sub"){
$('#subinfo1').hide();$('#info2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo2').show();
}
if($("#startertab").html() == "3sub"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#info3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info1').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo3').show();
}
if($("#startertab").html() == "4sub"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#info4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info1').hide();$('#info5').hide();$('#info6').hide();$('#subinfo4').show();
}
if($("#startertab").html() == "5sub"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#info5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info1').hide();$('#info6').hide();$('#subinfo5').show();
}
if($("#startertab").html() == "6sub"){
$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#info6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info1').hide();$('#subinfo6').show();
}

$(".tab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info1').show();});
$(".tab2").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info2').show();});
$(".tab3").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info1').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info3').show();});
$(".tab4").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info1').hide();$('#info5').hide();$('#info6').hide();$('#info4').show();});
$(".tab5").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info1').hide();$('#info6').hide();$('#info5').show();});
$(".tab6").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info1').hide();$('#info6').show();});

$(".tabhover").hover(function() {$(this).css("background","rgba(255,255,255,0.4)");}, function() {$(this).css("background","rgba(255,255,255,0.2)");});
$(".primetabhover").hover(function() {$(this).css("background","rgba(255,255,255,0.4)");}, function() {$(this).css("background","rgba(255,255,255,0.3)");});

$(".1subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info1').show();});
$(".2subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info2').show();});
$(".3subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info1').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#info3').show();});
$(".4subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info1').hide();$('#info5').hide();$('#info6').hide();$('#info4').show();});
$(".5subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info1').hide();$('#info6').hide();$('#info5').show();});
$(".6subtab1").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info1').hide();$('#info6').show();});

$(".1subtab2").click(function() {$('#info1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo1').show();});
$(".2subtab2").click(function() {$('#subinfo1').hide();$('#info2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo2').show();});
$(".3subtab2").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#info3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info1').hide();$('#info4').hide();$('#info5').hide();$('#info6').hide();$('#subinfo3').show();});
$(".4subtab2").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#info4').hide();$('#subinfo5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info1').hide();$('#info5').hide();$('#info6').hide();$('#subinfo4').show();});
$(".5subtab2").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#info5').hide();$('#subinfo6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info1').hide();$('#info6').hide();$('#subinfo5').show();});
$(".6subtab2").click(function() {$('#subinfo1').hide();$('#subinfo2').hide();$('#subinfo3').hide();$('#subinfo4').hide();$('#subinfo5').hide();$('#info6').hide();$('#info2').hide();$('#info3').hide();$('#info4').hide();$('#info5').hide();$('#info1').hide();$('#subinfo6').show();});