MediaWiki:Common.js

(Difference between revisions)
Jump to: navigation, search
Line 26: Line 26:
 
ph.each(function(i) {
 
ph.each(function(i) {
 
$(this).click(function() {
 
$(this).click(function() {
var li = $('.photogal li')[i],
+
var li = $('.photogal li')[i];
lnk = img.parentNode.href;
+
 
$('.photogal .thumbcaption')[0].innerHTML = $('.thumbcaption',li)[0].innerText;
 
$('.photogal .thumbcaption')[0].innerHTML = $('.thumbcaption',li)[0].innerText;
img.src = this.src.substring(0,this.src.lastIndexOf('/')).replace('/thumb','');
+
img.src = this.src.replace('200px','800px');
img.parentNode.href = lnk.substring(0,lnk.lastIndexOf(':')+1)+img.src.substring(img.src.lastIndexOf('/')+1);
+
img.parentNode.href = this.parentNode.href;
 
ph.each(function(j) { this.style.opacity = i === j ? 0.66 : 1 });
 
ph.each(function(j) { this.style.opacity = i === j ? 0.66 : 1 });
 
return false;
 
return false;

Revision as of 00:44, 4 December 2013

/* Any JavaScript here will be loaded for all users on every page load. */
if(mw.config.get('wgArticleId') == 1736) {
$( document ).ready( function() {
	var sli = $("#photoGroups .holder ul")[0];
	    sli.parentNode.style.height = "200px";
	$("#photoGroups p").each(function(i) {
 	    	$(this).mouseenter(function() {
			$(sli).stop();
			$(sli).animate({marginTop:"-"+(200+i*200)+"px"});
		});
	});
})};
$('.xpand a').click(function() {
	var c = this.firstChild.nodeValue,
	d = c.substring(0,c.length-1);
	this.innerHTML = c.charCodeAt(c.length-1) === 9658 ? d+'\u25BC' : d+'\u25BA';
	$('#arch').slideToggle('slow');
	return false;
});
var ph = $('.photogal ul .thumbimage');
if (ph[0]) {
	ph[0].style.opacity = 0.66;
	var img = $('.photogal img')[0];
	img.removeAttribute('width');
	$('.photogal .thumbinner')[0].style.width = '';
	ph.each(function(i) {
		$(this).click(function() {
			var li = $('.photogal li')[i];
			$('.photogal .thumbcaption')[0].innerHTML = $('.thumbcaption',li)[0].innerText;
			img.src = this.src.replace('200px','800px');
			img.parentNode.href = this.parentNode.href;
			ph.each(function(j) { this.style.opacity = i === j ? 0.66 : 1 });
			return false;
		});
	});
}
Personal tools
Navigation
societies
additional
Views
Namespaces
Variants
Toolbox
Actions