MediaWiki:Common.js
From Tardis Wiki, the free Doctor Who reference
Clear your cache often around here
After changes are made to this site's CSS or Javascript, you have to bypass your browser's cache to see the changes. You can always do this by going to your browser's preferences panel. But many browsers also offer keyboard shortcuts to save you that trouble. The following shortcuts work in the versions of the browsers that Tardis currently supports. They may not work in earlier versions.
- Firefox: hold down Shift while performing a page reload.
- Opera offers no default keyboard shortcut, but you can create a custom keyboard shortcut with the value Clear disk cache
- Safari users should simultaneously hold down ⌘ + Option + E. You may need to enable the Develop menu first
- Chrome: press Ctrl + F5 or Shift + F5 while performing a page reload.
/* ================
TABLE stuff
================ */
//$("tr:odd").addClass("zebra-stripe"); (adversely affects TOCs for a reason I've not yet determined)
$("table").delegate('td','mouseover mouseleave', function(e) {
if (e.type == 'mouseover') {
$(this).parent().addClass("hover");
$("colgroup").eq($(this).index()).addClass("hover2");
}
else {
$(this).parent().removeClass("hover");
$("colgroup").eq($(this).index()).removeClass("hover2");
}
});
/* ================
ROTATING PICS
helps with infobox
images of characters
with mulitple
actors, principally
[[The Doctor]] and
[[The Master]].
Also has some helper
CSS elsewhere.
================
globals defaults:true, window:false, $:false
First of all we need to detect whether browser
supports animation natively or it needs a javascript
polyfill.
The detection code by the courtesy of Christian Heilmann
http://hacks.mozilla.org/2011/09/detecting-and-generating-css-animations-in-javascript/ */
var animation = false,
elm = document.createElement('detect'),
animationstring = 'animation',
keyframeprefix = '',
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
pfx = '';
if( elm.style.animationName ) { animation = true; }
if( animation === false ) {
for( var i = 0; i < domPrefixes.length; i++ ) {
if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) {
pfx = domPrefixes[ i ];
animationstring = pfx + 'Animation';
keyframeprefix = '-' + pfx.toLowerCase() + '-';
animation = true;
break;
}
}
}
(function ($) {
$.slowEach = function (array, interval, callback) {
if (!array.length) {
return;
}
var i = 0;
function next() {
if (callback.call(array[i], i, array[i]) !== false) {
if (++i < array.length) {
setTimeout(next, interval);
}
}
}
next();
return array;
};
$.fn.dissolve = function (options) {
var op = $.extend(defaults, options),
$that = $(this),
interval = op.visibleItemDuration + op.transitionDuration;
return $.slowEach(this, interval, function () {
var $this = $(this);
$this
.animate({
opacity: 1
}, op.transitionDuration, function () {
function initCarousel() {
$that.dissolve(options);
}
if ($this.is(':last-child')) {
setTimeout(initCarousel, op.visibleItemDuration);
}
})
.delay(op.visibleItemDuration)
.animate({
opacity: 0
}, op.transitionDuration);
});
};
var defaults = {
visibleItemDuration: 4000,
transitionDuration: 1000
};
}(window.jQuery));
$(function () {
if( animation === false ) {
$('.dissolve .item').dissolve({
// TUNE YOUR CAROUSEL HERE
// duration of an item being visible in miliseconds
visibleItemDuration: 4000,
// duration of a transition between items in miliseconds
transitionDuration: 1000
});
}
});
/* ================
AJAX
customisation
================ */
window.ajaxPages = ["Special:RecentChanges","Special:WikiActivity","Special:Watchlist","Special:Log","Special:Contributions"];
window.ajaxRefresh = 30000
AjaxRCRefreshText = 'Auto-refresh via AJAX';
AjaxRCRefreshHoverText = 'Automatically refreshes the page';
/* ================
ARCHIVE TOOL
customisation
================ */
var ArchiveToolConfig = {
archiveListTemplate: 'ArchCat',
archivePageTemplate: 'ArchPage',
archiveSubpage: 'Archive',
userLang: true
};
/* ================
SPOILER ALERT
customisation
================ */
/**
* SpoilerAlert
* documentation at: http://dev.wikia.com/wiki/SpoilerAlert
* © Peter Coester, 2012
*
* __NOWYSIWYG__
*/
window.SpoilerAlertJS = {
question: 'This section may contain spoilers about unreleased stories. Are you sure you want to read it?',
yes : 'Hit me with your best shot',
no : 'Get me the hell out of here',
fadeDelay : 1000
};
/* ================
AutoCreateUserPages
customisation
================ */
/**
* documentation at: https://dev.fandom.com/wiki/AutoCreateUserPages
*/
window.AutoCreateUserPagesConfig = {
content: {
2: '{{Remove this message to start building your user page}}',
3: '<div id=tech style="line-height:140%; margin-bottom:20px"><div id=sfh style="font-size:150%;line-height:140%;text-align:center;margin-bottom:20px">'''Welcome to the [[File:Wiki-wordmark.png|Tardis:About]] {{BASEPAGENAME}}'''</div>{{tardis manual}}
Thanks for your recent [[Special:Contributions/{{PAGENAME}}|edits]]! We hope you'll keep on editing with us. This is a great time to have joined us, because now you can play the '''[[Help:Game of Rassilon|Game of Rassilon]]''' with us and win cool stuff! Well, okay, ''badges''. That have no monetary value. And that largely only you can see. But still: they're cool!
We've got a couple of important quirks for a Fandom wiki, so let's get them out of the way first.
<span id="ssh" style="font-size:125%">'''British English, please'''</span>
We generally use [[British]] [[English]] 'round these parts, so if you use another form of English, please be sure you set your [[Help:spell checking|spell checker]] to BrEng, and take a gander at our [[Help:spelling cheat card|spelling cheat card]].
<span id=ssh style="font-size:125%">'''Spoilers aren't cool'''</span>
We have a strict definition of "spoiler" that you may find a bit unusual. Basically, a spoiler, to us, is anything that comes from a story which has not been released yet. So, even if you've got some info from a [[British Broadcasting Corporation|BBC]] press release or official trailer, it basically can't be referenced here. In other words, '''you gotta wait until the episode has finished its premiere broadcast to start editing about its contents.''' Please check the '''[[Tardis:spoiler policy|spoiler policy]]''' for more details.
<span id=ssh style="font-size:125%">'''Other useful stuff'''</span>
Aside from those two things, we also have some pages that you should probably read when you get a chance, like:
* [[Tardis:Help|the listing of all our help, policy and guideline pages]]
* [[Tardis:Manual of Style|our Manual of Style]]
* [[Tardis:Image use policy|our image use policy]]
* [[Tardis:User page policy|our user page policy]]
If you're brand new to wiki editing — and we all were, once! — you probably want to check out these tutorials at Wikipedia, the world's largest wiki:
* [[Wikipedia:Wikipedia:How to edit a page|How to edit a page]]
* [[Wikipedia:Wikipedia:Tutorial|Editing, policy, conduct, and structure tutorial]]
* [[Wikipedia:Wikipedia:Picture tutorial|Picture tutorial]]
Remember that you should always sign your comments on talk and vote pages using four tildes like this: <div style="font-family:'Georgia', 'Times New Roman', serif; font-size:200%;text-align:center;">~ ~ ~ ~</div>
Thanks for becoming a member of the TARDIS crew! If you have any questions, see the [[Tardis:Help| Help pages]], add a question to one of [[Special:Forum|the Forums]] or ask an [[Tardis:Administrators|admin]].
</div>
'
},
summary: 'Welcome to Tardis!'
};