MediaWiki:Neowikimon.js

$(document).ready( function {   $("#link,#closeLink").click( function  { popup('popUpDiv')}); });

function toggle(div_id) { var el = document.getElementById(div_id); if ( el.style.display == 'none' ) {	el.style.display = 'block';} else {el.style.display = 'none';} } function blanket_size(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportheight = window.innerHeight; } else { viewportheight = document.documentElement.clientHeight; }	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) { blanket_height = viewportheight; } else { if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) { blanket_height = document.body.parentNode.clientHeight; } else { blanket_height = document.body.parentNode.scrollHeight; }	}	var blanket = document.getElementById('blanket'); blanket.style.height = blanket_height + 'px'; var popUpDiv = document.getElementById(popUpDivVar); popUpDiv_height=blanket_height/2-200;//200 is half popup's height popUpDiv.style.top = popUpDiv_height + 'px'; } function window_pos(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerHeight; } else { viewportwidth = document.documentElement.clientHeight; }	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) { window_width = viewportwidth; } else { if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) { window_width = document.body.parentNode.clientWidth; } else { window_width = document.body.parentNode.scrollWidth; }	}	var popUpDiv = document.getElementById(popUpDivVar); window_width=window_width/2-200;//200 is half popup's width popUpDiv.style.left = window_width + 'px'; } function popup(windowname) { blanket_size(windowname); window_pos(windowname); toggle('blanket'); toggle(windowname); }

$(function{           var overlay = $(' ');

$('.closephoto').click(function {                $('.popup').hide;                overlay.appendTo(document.body).remove;                return false;            });

$('.photoclick').click(function {                overlay.show;                overlay.appendTo(document.body);                $('.popup').show;                return false;            }); });

/*Test*/

(function($, undefined) {   var open = [];

var opts = { selector: '.dropdown2', toggle: 'dropdown2-toggle', open: 'dropdown2-open', nest: true };

$(document).on('click.dropdown2 touchstart.dropdown2', function(e)   {        // Close the last open dropdown2 if click is from outside the target dropdown2        if ( open.length && ( ! opts.nest || ! open[ open.length - 1 ].find( e.target ).length ) )        {            open.pop.removeClass( opts.open );        }

var $this = $(e.target);

// If target is a dropdown2 then toggle it... if ( $this.hasClass( opts.toggle ) ) {           e.preventDefault;

$this = $this.closest( opts.selector );

if ( ! $this.hasClass( opts.open ) ) {               open.push( $this.addClass( opts.open ) ); }           else {               open.pop.removeClass( opts.open ); }       }    });

})(jQuery);

/* Tester */

$(document).ready(function { $('#neotab-wrapper li:first').addClass('active'); $('#neotab-body > div').hide; $('#neotab-body > div:first').show; $('#neotab-wrapper p').click(function { $('#neotab-wrapper li').removeClass('active'); $(this).parent.addClass('active'); var activeTab = $(this).attr('class'); $('#neotab-body > div:visible').hide; $(activeTab).show; return false; });

});

/* Tester 2 */

$(document).ready(function { $('#feattab-wrapper li:first').addClass('active'); $('#feattab-body > div').hide; $('#feattab-body > div:first').show; $('#feattab-wrapper p').click(function { $('#feattab-wrapper li').removeClass('active'); $(this).parent.addClass('active'); var activeTab = $(this).attr('class'); $('#feattab-body > div:visible').hide; $(activeTab).show; return false; });

});

/* Tester 3 */

$(document).ready(function { $('#portaltab-wrapper li:first').addClass('active'); $('#portaltab-body > div').hide; $('#portaltab-body > div:first').show; $('#portaltab-wrapper p').click(function { $('#portaltab-wrapper li').removeClass('active'); $(this).parent.addClass('active'); var activeTab = $(this).attr('class'); $('#portaltab-body > div:visible').hide; $(activeTab).show; return false; });

});

/* Test 4 */ $(document).ready(function { $('#popuptab-wrapper li:first').addClass('active'); $('#popuptab-body > div').hide; $('#popuptab-body > div:first').show; $('#popuptab-wrapper p').click(function { $('#popuptab-wrapper li').removeClass('active'); $(this).parent.addClass('active'); var activeTab = $(this).attr('class'); $('#popuptab-body > div:visible').hide; $(activeTab).show; return false; });

});

// ************************************************** // Experimental javascript countdown timer (Splarka) // Version 0.0.3 // ************************************************** // // Usage example: // //  Only January 01 2007 00:00:00 PST until New years. // //  Javascript disabled.

function updatetimer(i) { var now = new Date; var then = timers[i].eventdate; var diff = count=Math.floor((then.getTime-now.getTime)/1000);

// catch bad date strings if(isNaN(diff)) { timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **' ; return; }

// determine plus/minus if(diff<0) { diff = -diff; var tpm = ''; } else { var tpm = ''; }

// calcuate the diff var left = (diff%60) + ' seconds'; diff=Math.floor(diff/60); if(diff > 0) left = (diff%60) + ' minutes ' + left; diff=Math.floor(diff/60); if(diff > 0) left = (diff%24) + ' hours ' + left; diff=Math.floor(diff/24); if(diff > 0) left = diff + ' days ' + left timers[i].firstChild.nodeValue = tpm + left;

// a setInterval is more efficient, but calling setTimeout // makes errors break the script rather than infinitely recurse timeouts[i] = setTimeout('updatetimer(' + i + ')',1000); }

function checktimers { //hide 'nocountdown' and show 'countdown' var nocountdowns = getElementsByClassName(document, 'span', 'nocountdown'); for(var i in nocountdowns) nocountdowns[i].style.display = 'none' var countdowns = getElementsByClassName(document, 'span', 'countdown'); for(var i in countdowns) countdowns[i].style.display = 'inline'

//set up global objects timers and timeouts. timers = getElementsByClassName(document, 'span', 'countdowndate'); //global timeouts = new Array; // generic holder for the timeouts, global if(timers.length == 0) return; for(var i in timers) { timers[i].eventdate = new Date(timers[i].firstChild.nodeValue); updatetimer(i); //start it up  } } addOnloadHook(checktimers);

// ************************************************** // - end -  Experimental javascript countdown timer // ****************

$(document).ready(function { $('#cssmenu li.active').addClass('open').children('ul').show;	$('#cssmenu li.has-sub>p').on('click', function{ $(this).removeAttr('class'); var element = $(this).parent('li'); if (element.hasClass('open')) { element.removeClass('open'); element.find('li').removeClass('open'); element.find('ul').slideUp(200); }		else { element.addClass('open'); element.children('ul').slideDown(200); element.siblings('li').children('ul').slideUp(200); element.siblings('li').removeClass('open'); element.siblings('li').find('li').removeClass('open'); element.siblings('li').find('ul').slideUp(200); }	});

});