- Portals
- The Current Year
- ED in the News
- Admins
- Help ED Rebuild
- Archive
- ED Bookmarklet
- Donate Bitcoin
Contact an admin on Discord or EDF if you want an account. Also fuck bots.
MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
imported>TabbyGarf No edit summary |
||
Line 35: | Line 35: | ||
}); | }); | ||
}); | }); | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | |||
/* Collapsible toggle */ | |||
$(function(){ | |||
$(".collapsibletoggle").find(".collapsibletoggletext").click(function(){ | |||
$(this).closest(".collapsibletoggle").find(".collapsibletoggletext").toggleClass("hiddentext"); | |||
}); | |||
}); | |||
/* Cycle forwards or backwards through elements one at a time via click */ | |||
$(function(){ | |||
$(".cyclesequence").find(".cyclesequencelinknext").click(function(){ | |||
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").length === 0) { | |||
$(this).closest(".cyclesequence").find(".cyclesequenceitem:first").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext"); | |||
} | |||
else { | |||
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext"); | |||
} | |||
}); | |||
}); | |||
$(function(){ | |||
$(".cyclesequence").find(".cyclesequencelinkprev").click(function(){ | |||
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").length === 0) { | |||
$(this).closest(".cyclesequence").find(".cyclesequenceitem:last").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext"); | |||
} | |||
else { | |||
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext"); | |||
} | |||
}); | |||
}); | |||
/* Click link to show one or more items and hide other items */ | |||
$(function(){ | |||
$(".morphcontainer").find(".morphlink").click(function(){ | |||
var $correspondingContent = $(this).data("correspondingcontent"); | |||
$(this).closest(".morphcontainer").find(".morphcontent").filter("."+$correspondingContent).removeClass("hiddentext"); | |||
$(this).closest(".morphcontainer").find(".morphcontent").not("."+$correspondingContent).addClass("hiddentext"); | |||
}); | |||
}); | |||
/* Blinking text */ | |||
setInterval(function () { | |||
var elements = document.getElementsByClassName('blink'); | |||
for (index = 0; index < elements.length; index++) { | |||
if (elements[index].style.visibility === 'visible') { | |||
elements[index].style.visibility = 'hidden'; | |||
} else { | |||
elements[index].style.visibility = 'visible'; | |||
} | |||
} | |||
}, 1000); |
Revision as of 20:09, 13 June 2021
/* Any JavaScript here will be loaded for all users on every page load. */
setInterval(function () {
var elements = document.getElementsByClassName('blink');
for (index = 0; index < elements.length; index++) {
if (elements[index].style.visibility === 'visible') {
elements[index].style.visibility = 'hidden';
} else {
elements[index].style.visibility = 'visible';
}
}
}, 1000);
/* Cycle forwards or backwards through elements one at a time via click */
$(function(){
$(".cyclesequence").find(".cyclesequencelinknext").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:first").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
});
$(function(){
$(".cyclesequence").find(".cyclesequencelinkprev").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:last").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
});
/* Any JavaScript here will be loaded for all users on every page load. */
/* Collapsible toggle */
$(function(){
$(".collapsibletoggle").find(".collapsibletoggletext").click(function(){
$(this).closest(".collapsibletoggle").find(".collapsibletoggletext").toggleClass("hiddentext");
});
});
/* Cycle forwards or backwards through elements one at a time via click */
$(function(){
$(".cyclesequence").find(".cyclesequencelinknext").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:first").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").next(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
});
$(function(){
$(".cyclesequence").find(".cyclesequencelinkprev").click(function(){
if ($(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").length === 0) {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:last").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
else {
$(this).closest(".cyclesequence").find(".cyclesequenceitem:visible").prev(".cyclesequenceitem").removeClass("hiddentext").siblings(".cyclesequenceitem").addClass("hiddentext");
}
});
});
/* Click link to show one or more items and hide other items */
$(function(){
$(".morphcontainer").find(".morphlink").click(function(){
var $correspondingContent = $(this).data("correspondingcontent");
$(this).closest(".morphcontainer").find(".morphcontent").filter("."+$correspondingContent).removeClass("hiddentext");
$(this).closest(".morphcontainer").find(".morphcontent").not("."+$correspondingContent).addClass("hiddentext");
});
});
/* Blinking text */
setInterval(function () {
var elements = document.getElementsByClassName('blink');
for (index = 0; index < elements.length; index++) {
if (elements[index].style.visibility === 'visible') {
elements[index].style.visibility = 'hidden';
} else {
elements[index].style.visibility = 'visible';
}
}
}, 1000);