1,492
edits
FlyingRagnar (talk | contribs) No edit summary |
Rigel Kent (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded | /** Begin shared desktop + mobile view script **/ | ||
/* Make sure any changes are copied to MediaWiki:Mobile.js and vice versa. */ | |||
/* Any JavaScript here will be loaded in desktop and mobile view skins on every page load. */ | |||
/* Any JavaScript here will be loaded in both desktop view and mobile view skins on every page load. */ | |||
/*************************************** | /*************************************** | ||
| Line 40: | Line 45: | ||
for( var j = 0; j < children.length; j++ ) { | for( var j = 0; j < children.length; j++ ) { | ||
if ( children[j].nodeName == "UL" ) { | if ( children[j].nodeName == "UL" ) { | ||
var Tlinks = children[j].getElementsByTagName( " | var Tlinks = children[j].getElementsByTagName( "li" ); | ||
for( var k = h; k < Tlinks.length; k++ ) { | for( var k = h; k < Tlinks.length; k++ ) { | ||
Tlinks[k]. | Tlinks[k].innerHTML = '<a href="#tabs' + tabGroup + '-' + (k+1) + '">' + Tlinks[k].innerHTML + '</a>'; | ||
} | } | ||
} else if ( children[j].nodeName == "DIV" ) { | } else if ( children[j].nodeName == "DIV" ) { | ||
| Line 74: | Line 79: | ||
mw.loader.using( 'jquery.ui.accordion', function() {accordionVideos();} ); | mw.loader.using( 'jquery.ui.accordion', function() {accordionVideos();} ); | ||
} ); | } ); | ||
/*********************************************************** | |||
* Name: dragscroll | |||
* Description: Scrolls a .dragscroll's contents when clicked and dragged. | |||
* Additional Notes: https://github.com/asvd/dragscroll | |||
*/ | |||
/** | |||
* @fileoverview dragscroll - scroll area by dragging | |||
* @version 0.0.5 | |||
* | |||
* @license MIT, see http://github.com/asvd/intence | |||
* @copyright 2015 asvd <heliosframework@gmail.com> | |||
*/ | |||
(function (root, factory) { | |||
if (typeof define === 'function' && define.amd) { | |||
define(['exports'], factory); | |||
} else if (typeof exports !== 'undefined') { | |||
factory(exports); | |||
} else { | |||
factory((root.dragscroll = {})); | |||
} | |||
}(this, function (exports) { | |||
var _window = window; | |||
var _document = document; | |||
var mousemove = 'mousemove'; | |||
var mouseup = 'mouseup'; | |||
var mousedown = 'mousedown'; | |||
var EventListener = 'EventListener'; | |||
var addEventListener = 'add'+EventListener; | |||
var removeEventListener = 'remove'+EventListener; | |||
var dragged = []; | |||
var reset = function(i, el) { | |||
for (i = 0; i < dragged.length;) { | |||
el = dragged[i++]; | |||
el[removeEventListener](mousedown, el.md, 0); | |||
_window[removeEventListener](mouseup, el.mu, 0); | |||
_window[removeEventListener](mousemove, el.mm, 0); | |||
} | |||
dragged = _document.getElementsByClassName('dragscroll'); | |||
for (i = 0; i < dragged.length;) { | |||
(function(el, lastClientX, lastClientY, pushed){ | |||
el[addEventListener]( | |||
mousedown, | |||
el.md = function(e) { | |||
pushed = 1; | |||
lastClientX = e.clientX; | |||
lastClientY = e.clientY; | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
}, 0 | |||
); | |||
_window[addEventListener]( | |||
mouseup, el.mu = function() {pushed = 0;}, 0 | |||
); | |||
_window[addEventListener]( | |||
mousemove, | |||
el.mm = function(e, scroller) { | |||
scroller = el.scroller||el; | |||
if (pushed) { | |||
scroller.scrollLeft -= | |||
(- lastClientX + (lastClientX=e.clientX)); | |||
scroller.scrollTop -= | |||
(- lastClientY + (lastClientY=e.clientY)); | |||
} | |||
}, 0 | |||
); | |||
})(dragged[i++]); | |||
} | |||
} | |||
if (_document.readyState == 'complete') { | |||
reset(); | |||
} else { | |||
_window[addEventListener]('load', reset, 0); | |||
} | |||
exports.reset = reset; | |||
})); | |||
/** End shared desktop + mobile view script **/ | |||
edits