From 16f7a6328cb735387c051fa440a1438b48d2b755 Mon Sep 17 00:00:00 2001 From: "Nicolas A. Tonne" Date: Fri, 10 Oct 2014 11:58:49 +0200 Subject: [PATCH 1/3] fixed stuff --- admin.php | 47 -- change.php | 124 --- favicon.ico | Bin 34494 -> 0 bytes index.php | 21 +- iscroll.js | 2006 -------------------------------------------- list.js | 114 --- lists/tritoen.json | 2 +- nochan.php | 38 - search.js | 95 --- style.css | 84 -- timedifference.php | 13 - videos.php | 8 - visualize.js | 5 - youtube.js | 292 ------- 14 files changed, 9 insertions(+), 2840 deletions(-) delete mode 100755 admin.php delete mode 100755 change.php delete mode 100755 favicon.ico delete mode 100755 iscroll.js delete mode 100755 list.js delete mode 100755 nochan.php delete mode 100755 search.js delete mode 100755 style.css delete mode 100755 timedifference.php delete mode 100755 videos.php delete mode 100755 visualize.js delete mode 100755 youtube.js diff --git a/admin.php b/admin.php deleted file mode 100755 index aceeb86e..00000000 --- a/admin.php +++ /dev/null @@ -1,47 +0,0 @@ - - - Zöff - - - - - - - -
-
- -
- -

Admin Settingspanel

- -
-
-
-
-
-
- - - - - - -
-
-
- - - \ No newline at end of file diff --git a/change.php b/change.php deleted file mode 100755 index b9dd4856..00000000 --- a/change.php +++ /dev/null @@ -1,124 +0,0 @@ -= 0){ - - //print_r($i); - // echo "IIII: ",$i; - unset($data[3][$i]); - unset($data[0][$i]); - unset($data[2][$i]); - $underVote = array_search($votes-1, $data[2]); #nenennenenen feiiiiiiiiiiiiiiiiil - - if($underVote == 0)$underVote=1; - else if($underVote == false)$underVote=count($data[2]); - array_splice($data[3], $underVote, 0, array($name)); - array_splice($data[2], $underVote, 0, array($votes)); - array_splice($data[0], $underVote, 0, array($id)); - file_put_contents($list, json_encode($data)); - echo "Vote registrated. I hope"; - } -} -else if(isset($_GET['skip'])){ //skip song request - $viewers=$data[4][0]; - $skips=count($data[5]); - if(!in_array($guid, $data[5])){ - array_push($data[5], $guid); - $skips+=1; - $data[5][0]=$skips; - if($skips>=$viewers/2){ - nextSong(); - echo("skipped!"); - } - file_put_contents($list, json_encode($data)); - } - echo($skips."/".$viewers); - -} -else{ print($file); } - -function nextSong(){ - global $data; - array_push($data[0], $data[0][0]); - array_shift($data[0]); - - array_push($data[2], 0); //reset votes - array_shift($data[2]); - - array_push($data[3], $data[3][0]); - array_shift($data[3]); - - array_shift($data[4]); - array_push($data[4], 1); - - $data[5]=array(); - $data[1][0] = time(); -} -?> \ No newline at end of file diff --git a/favicon.ico b/favicon.ico deleted file mode 100755 index 9d09876d5fa2612be161a338e32a14eb41935c0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34494 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 S{cm9r`8L;;?-`eAnD+l&v`N?i diff --git a/index.php b/index.php index 35e89f7c..acdcb0e6 100755 --- a/index.php +++ b/index.php @@ -1,11 +1,6 @@ - Zöff - - - - - +
@@ -13,7 +8,7 @@ Zöff @@ -39,11 +34,11 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/iscroll.js b/iscroll.js deleted file mode 100755 index 32b1ad5b..00000000 --- a/iscroll.js +++ /dev/null @@ -1,2006 +0,0 @@ -/*! iScroll v5.1.2 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */ -(function (window, document, Math) { -var rAF = window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - window.msRequestAnimationFrame || - function (callback) { window.setTimeout(callback, 1000 / 60); }; - -var utils = (function () { - var me = {}; - - var _elementStyle = document.createElement('div').style; - var _vendor = (function () { - var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'], - transform, - i = 0, - l = vendors.length; - - for ( ; i < l; i++ ) { - transform = vendors[i] + 'ransform'; - if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1); - } - - return false; - })(); - - function _prefixStyle (style) { - if ( _vendor === false ) return false; - if ( _vendor === '' ) return style; - return _vendor + style.charAt(0).toUpperCase() + style.substr(1); - } - - me.getTime = Date.now || function getTime () { return new Date().getTime(); }; - - me.extend = function (target, obj) { - for ( var i in obj ) { - target[i] = obj[i]; - } - }; - - me.addEvent = function (el, type, fn, capture) { - el.addEventListener(type, fn, !!capture); - }; - - me.removeEvent = function (el, type, fn, capture) { - el.removeEventListener(type, fn, !!capture); - }; - - me.prefixPointerEvent = function (pointerEvent) { - return window.MSPointerEvent ? - 'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10): - pointerEvent; - }; - - me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) { - var distance = current - start, - speed = Math.abs(distance) / time, - destination, - duration; - - deceleration = deceleration === undefined ? 0.0006 : deceleration; - - destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 ); - duration = speed / deceleration; - - if ( destination < lowerMargin ) { - destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin; - distance = Math.abs(destination - current); - duration = distance / speed; - } else if ( destination > 0 ) { - destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0; - distance = Math.abs(current) + destination; - duration = distance / speed; - } - - return { - destination: Math.round(destination), - duration: duration - }; - }; - - var _transform = _prefixStyle('transform'); - - me.extend(me, { - hasTransform: _transform !== false, - hasPerspective: _prefixStyle('perspective') in _elementStyle, - hasTouch: 'ontouchstart' in window, - hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed - hasTransition: _prefixStyle('transition') in _elementStyle - }); - - // This should find all Android browsers lower than build 535.19 (both stock browser and webview) - me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion)); - - me.extend(me.style = {}, { - transform: _transform, - transitionTimingFunction: _prefixStyle('transitionTimingFunction'), - transitionDuration: _prefixStyle('transitionDuration'), - transitionDelay: _prefixStyle('transitionDelay'), - transformOrigin: _prefixStyle('transformOrigin') - }); - - me.hasClass = function (e, c) { - var re = new RegExp("(^|\\s)" + c + "(\\s|$)"); - return re.test(e.className); - }; - - me.addClass = function (e, c) { - if ( me.hasClass(e, c) ) { - return; - } - - var newclass = e.className.split(' '); - newclass.push(c); - e.className = newclass.join(' '); - }; - - me.removeClass = function (e, c) { - if ( !me.hasClass(e, c) ) { - return; - } - - var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'); - e.className = e.className.replace(re, ' '); - }; - - me.offset = function (el) { - var left = -el.offsetLeft, - top = -el.offsetTop; - - // jshint -W084 - while (el = el.offsetParent) { - left -= el.offsetLeft; - top -= el.offsetTop; - } - // jshint +W084 - - return { - left: left, - top: top - }; - }; - - me.preventDefaultException = function (el, exceptions) { - for ( var i in exceptions ) { - if ( exceptions[i].test(el[i]) ) { - return true; - } - } - - return false; - }; - - me.extend(me.eventType = {}, { - touchstart: 1, - touchmove: 1, - touchend: 1, - - mousedown: 2, - mousemove: 2, - mouseup: 2, - - pointerdown: 3, - pointermove: 3, - pointerup: 3, - - MSPointerDown: 3, - MSPointerMove: 3, - MSPointerUp: 3 - }); - - me.extend(me.ease = {}, { - quadratic: { - style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', - fn: function (k) { - return k * ( 2 - k ); - } - }, - circular: { - style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1) - fn: function (k) { - return Math.sqrt( 1 - ( --k * k ) ); - } - }, - back: { - style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', - fn: function (k) { - var b = 4; - return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1; - } - }, - bounce: { - style: '', - fn: function (k) { - if ( ( k /= 1 ) < ( 1 / 2.75 ) ) { - return 7.5625 * k * k; - } else if ( k < ( 2 / 2.75 ) ) { - return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75; - } else if ( k < ( 2.5 / 2.75 ) ) { - return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375; - } else { - return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375; - } - } - }, - elastic: { - style: '', - fn: function (k) { - var f = 0.22, - e = 0.4; - - if ( k === 0 ) { return 0; } - if ( k == 1 ) { return 1; } - - return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 ); - } - } - }); - - me.tap = function (e, eventName) { - var ev = document.createEvent('Event'); - ev.initEvent(eventName, true, true); - ev.pageX = e.pageX; - ev.pageY = e.pageY; - e.target.dispatchEvent(ev); - }; - - me.click = function (e) { - var target = e.target, - ev; - - if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) { - ev = document.createEvent('MouseEvents'); - ev.initMouseEvent('click', true, true, e.view, 1, - target.screenX, target.screenY, target.clientX, target.clientY, - e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, - 0, null); - - ev._constructed = true; - target.dispatchEvent(ev); - } - }; - - return me; -})(); - -function IScroll (el, options) { - this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; - this.scroller = this.wrapper.children[0]; - this.scrollerStyle = this.scroller.style; // cache style for better performance - - this.options = { - - resizeScrollbars: true, - - mouseWheelSpeed: 20, - - snapThreshold: 0.334, - -// INSERT POINT: OPTIONS - - startX: 0, - startY: 0, - scrollY: true, - directionLockThreshold: 5, - momentum: true, - - bounce: true, - bounceTime: 600, - bounceEasing: '', - - preventDefault: true, - preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ }, - - HWCompositing: true, - useTransition: true, - useTransform: true - }; - - for ( var i in options ) { - this.options[i] = options[i]; - } - - // Normalize options - this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ''; - - this.options.useTransition = utils.hasTransition && this.options.useTransition; - this.options.useTransform = utils.hasTransform && this.options.useTransform; - - this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough; - this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; - - // If you want eventPassthrough I have to lock one of the axes - this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY; - this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX; - - // With eventPassthrough we also need lockDirection mechanism - this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; - this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; - - this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing; - - this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling; - - if ( this.options.tap === true ) { - this.options.tap = 'tap'; - } - - if ( this.options.shrinkScrollbars == 'scale' ) { - this.options.useTransition = false; - } - - this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; - -// INSERT POINT: NORMALIZATION - - // Some defaults - this.x = 0; - this.y = 0; - this.directionX = 0; - this.directionY = 0; - this._events = {}; - -// INSERT POINT: DEFAULTS - - this._init(); - this.refresh(); - - this.scrollTo(this.options.startX, this.options.startY); - this.enable(); -} - -IScroll.prototype = { - version: '5.1.2', - - _init: function () { - this._initEvents(); - - if ( this.options.scrollbars || this.options.indicators ) { - this._initIndicators(); - } - - if ( this.options.mouseWheel ) { - this._initWheel(); - } - - if ( this.options.snap ) { - this._initSnap(); - } - - if ( this.options.keyBindings ) { - this._initKeys(); - } - -// INSERT POINT: _init - - }, - - destroy: function () { - this._initEvents(true); - - this._execEvent('destroy'); - }, - - _transitionEnd: function (e) { - if ( e.target != this.scroller || !this.isInTransition ) { - return; - } - - this._transitionTime(); - if ( !this.resetPosition(this.options.bounceTime) ) { - this.isInTransition = false; - this._execEvent('scrollEnd'); - } - }, - - _start: function (e) { - // React to left mouse button only - if ( utils.eventType[e.type] != 1 ) { - if ( e.button !== 0 ) { - return; - } - } - - if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) { - return; - } - - if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { - e.preventDefault(); - } - - var point = e.touches ? e.touches[0] : e, - pos; - - this.initiated = utils.eventType[e.type]; - this.moved = false; - this.distX = 0; - this.distY = 0; - this.directionX = 0; - this.directionY = 0; - this.directionLocked = 0; - - this._transitionTime(); - - this.startTime = utils.getTime(); - - if ( this.options.useTransition && this.isInTransition ) { - this.isInTransition = false; - pos = this.getComputedPosition(); - this._translate(Math.round(pos.x), Math.round(pos.y)); - this._execEvent('scrollEnd'); - } else if ( !this.options.useTransition && this.isAnimating ) { - this.isAnimating = false; - this._execEvent('scrollEnd'); - } - - this.startX = this.x; - this.startY = this.y; - this.absStartX = this.x; - this.absStartY = this.y; - this.pointX = point.pageX; - this.pointY = point.pageY; - - this._execEvent('beforeScrollStart'); - }, - - _move: function (e) { - if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { - return; - } - - if ( this.options.preventDefault ) { // increases performance on Android? TODO: check! - e.preventDefault(); - } - - var point = e.touches ? e.touches[0] : e, - deltaX = point.pageX - this.pointX, - deltaY = point.pageY - this.pointY, - timestamp = utils.getTime(), - newX, newY, - absDistX, absDistY; - - this.pointX = point.pageX; - this.pointY = point.pageY; - - this.distX += deltaX; - this.distY += deltaY; - absDistX = Math.abs(this.distX); - absDistY = Math.abs(this.distY); - - // We need to move at least 10 pixels for the scrolling to initiate - if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) { - return; - } - - // If you are scrolling in one direction lock the other - if ( !this.directionLocked && !this.options.freeScroll ) { - if ( absDistX > absDistY + this.options.directionLockThreshold ) { - this.directionLocked = 'h'; // lock horizontally - } else if ( absDistY >= absDistX + this.options.directionLockThreshold ) { - this.directionLocked = 'v'; // lock vertically - } else { - this.directionLocked = 'n'; // no lock - } - } - - if ( this.directionLocked == 'h' ) { - if ( this.options.eventPassthrough == 'vertical' ) { - e.preventDefault(); - } else if ( this.options.eventPassthrough == 'horizontal' ) { - this.initiated = false; - return; - } - - deltaY = 0; - } else if ( this.directionLocked == 'v' ) { - if ( this.options.eventPassthrough == 'horizontal' ) { - e.preventDefault(); - } else if ( this.options.eventPassthrough == 'vertical' ) { - this.initiated = false; - return; - } - - deltaX = 0; - } - - deltaX = this.hasHorizontalScroll ? deltaX : 0; - deltaY = this.hasVerticalScroll ? deltaY : 0; - - newX = this.x + deltaX; - newY = this.y + deltaY; - - // Slow down if outside of the boundaries - if ( newX > 0 || newX < this.maxScrollX ) { - newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX; - } - if ( newY > 0 || newY < this.maxScrollY ) { - newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY; - } - - this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; - this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; - - if ( !this.moved ) { - this._execEvent('scrollStart'); - } - - this.moved = true; - - this._translate(newX, newY); - -/* REPLACE START: _move */ - - if ( timestamp - this.startTime > 300 ) { - this.startTime = timestamp; - this.startX = this.x; - this.startY = this.y; - } - -/* REPLACE END: _move */ - - }, - - _end: function (e) { - if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { - return; - } - - if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { - e.preventDefault(); - } - - var point = e.changedTouches ? e.changedTouches[0] : e, - momentumX, - momentumY, - duration = utils.getTime() - this.startTime, - newX = Math.round(this.x), - newY = Math.round(this.y), - distanceX = Math.abs(newX - this.startX), - distanceY = Math.abs(newY - this.startY), - time = 0, - easing = ''; - - this.isInTransition = 0; - this.initiated = 0; - this.endTime = utils.getTime(); - - // reset if we are outside of the boundaries - if ( this.resetPosition(this.options.bounceTime) ) { - return; - } - - this.scrollTo(newX, newY); // ensures that the last position is rounded - - // we scrolled less than 10 pixels - if ( !this.moved ) { - if ( this.options.tap ) { - utils.tap(e, this.options.tap); - } - - if ( this.options.click ) { - utils.click(e); - } - - this._execEvent('scrollCancel'); - return; - } - - if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) { - this._execEvent('flick'); - return; - } - - // start momentum animation if needed - if ( this.options.momentum && duration < 300 ) { - momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 }; - momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 }; - newX = momentumX.destination; - newY = momentumY.destination; - time = Math.max(momentumX.duration, momentumY.duration); - this.isInTransition = 1; - } - - - if ( this.options.snap ) { - var snap = this._nearestSnap(newX, newY); - this.currentPage = snap; - time = this.options.snapSpeed || Math.max( - Math.max( - Math.min(Math.abs(newX - snap.x), 1000), - Math.min(Math.abs(newY - snap.y), 1000) - ), 300); - newX = snap.x; - newY = snap.y; - - this.directionX = 0; - this.directionY = 0; - easing = this.options.bounceEasing; - } - -// INSERT POINT: _end - - if ( newX != this.x || newY != this.y ) { - // change easing function when scroller goes out of the boundaries - if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) { - easing = utils.ease.quadratic; - } - - this.scrollTo(newX, newY, time, easing); - return; - } - - this._execEvent('scrollEnd'); - }, - - _resize: function () { - var that = this; - - clearTimeout(this.resizeTimeout); - - this.resizeTimeout = setTimeout(function () { - that.refresh(); - }, this.options.resizePolling); - }, - - resetPosition: function (time) { - var x = this.x, - y = this.y; - - time = time || 0; - - if ( !this.hasHorizontalScroll || this.x > 0 ) { - x = 0; - } else if ( this.x < this.maxScrollX ) { - x = this.maxScrollX; - } - - if ( !this.hasVerticalScroll || this.y > 0 ) { - y = 0; - } else if ( this.y < this.maxScrollY ) { - y = this.maxScrollY; - } - - if ( x == this.x && y == this.y ) { - return false; - } - - this.scrollTo(x, y, time, this.options.bounceEasing); - - return true; - }, - - disable: function () { - this.enabled = false; - }, - - enable: function () { - this.enabled = true; - }, - - refresh: function () { - var rf = this.wrapper.offsetHeight; // Force reflow - - this.wrapperWidth = this.wrapper.clientWidth; - this.wrapperHeight = this.wrapper.clientHeight; - -/* REPLACE START: refresh */ - - this.scrollerWidth = this.scroller.offsetWidth; - this.scrollerHeight = this.scroller.offsetHeight; - - this.maxScrollX = this.wrapperWidth - this.scrollerWidth; - this.maxScrollY = this.wrapperHeight - this.scrollerHeight; - -/* REPLACE END: refresh */ - - this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0; - this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0; - - if ( !this.hasHorizontalScroll ) { - this.maxScrollX = 0; - this.scrollerWidth = this.wrapperWidth; - } - - if ( !this.hasVerticalScroll ) { - this.maxScrollY = 0; - this.scrollerHeight = this.wrapperHeight; - } - - this.endTime = 0; - this.directionX = 0; - this.directionY = 0; - - this.wrapperOffset = utils.offset(this.wrapper); - - this._execEvent('refresh'); - - this.resetPosition(); - -// INSERT POINT: _refresh - - }, - - on: function (type, fn) { - if ( !this._events[type] ) { - this._events[type] = []; - } - - this._events[type].push(fn); - }, - - off: function (type, fn) { - if ( !this._events[type] ) { - return; - } - - var index = this._events[type].indexOf(fn); - - if ( index > -1 ) { - this._events[type].splice(index, 1); - } - }, - - _execEvent: function (type) { - if ( !this._events[type] ) { - return; - } - - var i = 0, - l = this._events[type].length; - - if ( !l ) { - return; - } - - for ( ; i < l; i++ ) { - this._events[type][i].apply(this, [].slice.call(arguments, 1)); - } - }, - - scrollBy: function (x, y, time, easing) { - x = this.x + x; - y = this.y + y; - time = time || 0; - - this.scrollTo(x, y, time, easing); - }, - - scrollTo: function (x, y, time, easing) { - easing = easing || utils.ease.circular; - - this.isInTransition = this.options.useTransition && time > 0; - - if ( !time || (this.options.useTransition && easing.style) ) { - this._transitionTimingFunction(easing.style); - this._transitionTime(time); - this._translate(x, y); - } else { - this._animate(x, y, time, easing.fn); - } - }, - - scrollToElement: function (el, time, offsetX, offsetY, easing) { - el = el.nodeType ? el : this.scroller.querySelector(el); - - if ( !el ) { - return; - } - - var pos = utils.offset(el); - - pos.left -= this.wrapperOffset.left; - pos.top -= this.wrapperOffset.top; - - // if offsetX/Y are true we center the element to the screen - if ( offsetX === true ) { - offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2); - } - if ( offsetY === true ) { - offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2); - } - - pos.left -= offsetX || 0; - pos.top -= offsetY || 0; - - pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left; - pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top; - - time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time; - - this.scrollTo(pos.left, pos.top, time, easing); - }, - - _transitionTime: function (time) { - time = time || 0; - - this.scrollerStyle[utils.style.transitionDuration] = time + 'ms'; - - if ( !time && utils.isBadAndroid ) { - this.scrollerStyle[utils.style.transitionDuration] = '0.001s'; - } - - - if ( this.indicators ) { - for ( var i = this.indicators.length; i--; ) { - this.indicators[i].transitionTime(time); - } - } - - -// INSERT POINT: _transitionTime - - }, - - _transitionTimingFunction: function (easing) { - this.scrollerStyle[utils.style.transitionTimingFunction] = easing; - - - if ( this.indicators ) { - for ( var i = this.indicators.length; i--; ) { - this.indicators[i].transitionTimingFunction(easing); - } - } - - -// INSERT POINT: _transitionTimingFunction - - }, - - _translate: function (x, y) { - if ( this.options.useTransform ) { - -/* REPLACE START: _translate */ - - this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ; - -/* REPLACE END: _translate */ - - } else { - x = Math.round(x); - y = Math.round(y); - this.scrollerStyle.left = x + 'px'; - this.scrollerStyle.top = y + 'px'; - } - - this.x = x; - this.y = y; - - - if ( this.indicators ) { - for ( var i = this.indicators.length; i--; ) { - this.indicators[i].updatePosition(); - } - } - - -// INSERT POINT: _translate - - }, - - _initEvents: function (remove) { - var eventType = remove ? utils.removeEvent : utils.addEvent, - target = this.options.bindToWrapper ? this.wrapper : window; - - eventType(window, 'orientationchange', this); - eventType(window, 'resize', this); - - if ( this.options.click ) { - eventType(this.wrapper, 'click', this, true); - } - - if ( !this.options.disableMouse ) { - eventType(this.wrapper, 'mousedown', this); - eventType(target, 'mousemove', this); - eventType(target, 'mousecancel', this); - eventType(target, 'mouseup', this); - } - - if ( utils.hasPointer && !this.options.disablePointer ) { - eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); - eventType(target, utils.prefixPointerEvent('pointermove'), this); - eventType(target, utils.prefixPointerEvent('pointercancel'), this); - eventType(target, utils.prefixPointerEvent('pointerup'), this); - } - - if ( utils.hasTouch && !this.options.disableTouch ) { - eventType(this.wrapper, 'touchstart', this); - eventType(target, 'touchmove', this); - eventType(target, 'touchcancel', this); - eventType(target, 'touchend', this); - } - - eventType(this.scroller, 'transitionend', this); - eventType(this.scroller, 'webkitTransitionEnd', this); - eventType(this.scroller, 'oTransitionEnd', this); - eventType(this.scroller, 'MSTransitionEnd', this); - }, - - getComputedPosition: function () { - var matrix = window.getComputedStyle(this.scroller, null), - x, y; - - if ( this.options.useTransform ) { - matrix = matrix[utils.style.transform].split(')')[0].split(', '); - x = +(matrix[12] || matrix[4]); - y = +(matrix[13] || matrix[5]); - } else { - x = +matrix.left.replace(/[^-\d.]/g, ''); - y = +matrix.top.replace(/[^-\d.]/g, ''); - } - - return { x: x, y: y }; - }, - - _initIndicators: function () { - var interactive = this.options.interactiveScrollbars, - customStyle = typeof this.options.scrollbars != 'string', - indicators = [], - indicator; - - var that = this; - - this.indicators = []; - - if ( this.options.scrollbars ) { - // Vertical scrollbar - if ( this.options.scrollY ) { - indicator = { - el: createDefaultScrollbar('v', interactive, this.options.scrollbars), - interactive: interactive, - defaultScrollbars: true, - customStyle: customStyle, - resize: this.options.resizeScrollbars, - shrink: this.options.shrinkScrollbars, - fade: this.options.fadeScrollbars, - listenX: false - }; - - this.wrapper.appendChild(indicator.el); - indicators.push(indicator); - } - - // Horizontal scrollbar - if ( this.options.scrollX ) { - indicator = { - el: createDefaultScrollbar('h', interactive, this.options.scrollbars), - interactive: interactive, - defaultScrollbars: true, - customStyle: customStyle, - resize: this.options.resizeScrollbars, - shrink: this.options.shrinkScrollbars, - fade: this.options.fadeScrollbars, - listenY: false - }; - - this.wrapper.appendChild(indicator.el); - indicators.push(indicator); - } - } - - if ( this.options.indicators ) { - // TODO: check concat compatibility - indicators = indicators.concat(this.options.indicators); - } - - for ( var i = indicators.length; i--; ) { - this.indicators.push( new Indicator(this, indicators[i]) ); - } - - // TODO: check if we can use array.map (wide compatibility and performance issues) - function _indicatorsMap (fn) { - for ( var i = that.indicators.length; i--; ) { - fn.call(that.indicators[i]); - } - } - - if ( this.options.fadeScrollbars ) { - this.on('scrollEnd', function () { - _indicatorsMap(function () { - this.fade(); - }); - }); - - this.on('scrollCancel', function () { - _indicatorsMap(function () { - this.fade(); - }); - }); - - this.on('scrollStart', function () { - _indicatorsMap(function () { - this.fade(1); - }); - }); - - this.on('beforeScrollStart', function () { - _indicatorsMap(function () { - this.fade(1, true); - }); - }); - } - - - this.on('refresh', function () { - _indicatorsMap(function () { - this.refresh(); - }); - }); - - this.on('destroy', function () { - _indicatorsMap(function () { - this.destroy(); - }); - - delete this.indicators; - }); - }, - - _initWheel: function () { - utils.addEvent(this.wrapper, 'wheel', this); - utils.addEvent(this.wrapper, 'mousewheel', this); - utils.addEvent(this.wrapper, 'DOMMouseScroll', this); - - this.on('destroy', function () { - utils.removeEvent(this.wrapper, 'wheel', this); - utils.removeEvent(this.wrapper, 'mousewheel', this); - utils.removeEvent(this.wrapper, 'DOMMouseScroll', this); - }); - }, - - _wheel: function (e) { - if ( !this.enabled ) { - return; - } - - e.preventDefault(); - e.stopPropagation(); - - var wheelDeltaX, wheelDeltaY, - newX, newY, - that = this; - - if ( this.wheelTimeout === undefined ) { - that._execEvent('scrollStart'); - } - - // Execute the scrollEnd event after 400ms the wheel stopped scrolling - clearTimeout(this.wheelTimeout); - this.wheelTimeout = setTimeout(function () { - that._execEvent('scrollEnd'); - that.wheelTimeout = undefined; - }, 400); - - if ( 'deltaX' in e ) { - wheelDeltaX = -e.deltaX; - wheelDeltaY = -e.deltaY; - } else if ( 'wheelDeltaX' in e ) { - wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed; - wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed; - } else if ( 'wheelDelta' in e ) { - wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed; - } else if ( 'detail' in e ) { - wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed; - } else { - return; - } - - wheelDeltaX *= this.options.invertWheelDirection; - wheelDeltaY *= this.options.invertWheelDirection; - - if ( !this.hasVerticalScroll ) { - wheelDeltaX = wheelDeltaY; - wheelDeltaY = 0; - } - - if ( this.options.snap ) { - newX = this.currentPage.pageX; - newY = this.currentPage.pageY; - - if ( wheelDeltaX > 0 ) { - newX--; - } else if ( wheelDeltaX < 0 ) { - newX++; - } - - if ( wheelDeltaY > 0 ) { - newY--; - } else if ( wheelDeltaY < 0 ) { - newY++; - } - - this.goToPage(newX, newY); - - return; - } - - newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0); - newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0); - - if ( newX > 0 ) { - newX = 0; - } else if ( newX < this.maxScrollX ) { - newX = this.maxScrollX; - } - - if ( newY > 0 ) { - newY = 0; - } else if ( newY < this.maxScrollY ) { - newY = this.maxScrollY; - } - - this.scrollTo(newX, newY, 0); - -// INSERT POINT: _wheel - }, - - _initSnap: function () { - this.currentPage = {}; - - if ( typeof this.options.snap == 'string' ) { - this.options.snap = this.scroller.querySelectorAll(this.options.snap); - } - - this.on('refresh', function () { - var i = 0, l, - m = 0, n, - cx, cy, - x = 0, y, - stepX = this.options.snapStepX || this.wrapperWidth, - stepY = this.options.snapStepY || this.wrapperHeight, - el; - - this.pages = []; - - if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) { - return; - } - - if ( this.options.snap === true ) { - cx = Math.round( stepX / 2 ); - cy = Math.round( stepY / 2 ); - - while ( x > -this.scrollerWidth ) { - this.pages[i] = []; - l = 0; - y = 0; - - while ( y > -this.scrollerHeight ) { - this.pages[i][l] = { - x: Math.max(x, this.maxScrollX), - y: Math.max(y, this.maxScrollY), - width: stepX, - height: stepY, - cx: x - cx, - cy: y - cy - }; - - y -= stepY; - l++; - } - - x -= stepX; - i++; - } - } else { - el = this.options.snap; - l = el.length; - n = -1; - - for ( ; i < l; i++ ) { - if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) { - m = 0; - n++; - } - - if ( !this.pages[m] ) { - this.pages[m] = []; - } - - x = Math.max(-el[i].offsetLeft, this.maxScrollX); - y = Math.max(-el[i].offsetTop, this.maxScrollY); - cx = x - Math.round(el[i].offsetWidth / 2); - cy = y - Math.round(el[i].offsetHeight / 2); - - this.pages[m][n] = { - x: x, - y: y, - width: el[i].offsetWidth, - height: el[i].offsetHeight, - cx: cx, - cy: cy - }; - - if ( x > this.maxScrollX ) { - m++; - } - } - } - - this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0); - - // Update snap threshold if needed - if ( this.options.snapThreshold % 1 === 0 ) { - this.snapThresholdX = this.options.snapThreshold; - this.snapThresholdY = this.options.snapThreshold; - } else { - this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold); - this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold); - } - }); - - this.on('flick', function () { - var time = this.options.snapSpeed || Math.max( - Math.max( - Math.min(Math.abs(this.x - this.startX), 1000), - Math.min(Math.abs(this.y - this.startY), 1000) - ), 300); - - this.goToPage( - this.currentPage.pageX + this.directionX, - this.currentPage.pageY + this.directionY, - time - ); - }); - }, - - _nearestSnap: function (x, y) { - if ( !this.pages.length ) { - return { x: 0, y: 0, pageX: 0, pageY: 0 }; - } - - var i = 0, - l = this.pages.length, - m = 0; - - // Check if we exceeded the snap threshold - if ( Math.abs(x - this.absStartX) < this.snapThresholdX && - Math.abs(y - this.absStartY) < this.snapThresholdY ) { - return this.currentPage; - } - - if ( x > 0 ) { - x = 0; - } else if ( x < this.maxScrollX ) { - x = this.maxScrollX; - } - - if ( y > 0 ) { - y = 0; - } else if ( y < this.maxScrollY ) { - y = this.maxScrollY; - } - - for ( ; i < l; i++ ) { - if ( x >= this.pages[i][0].cx ) { - x = this.pages[i][0].x; - break; - } - } - - l = this.pages[i].length; - - for ( ; m < l; m++ ) { - if ( y >= this.pages[0][m].cy ) { - y = this.pages[0][m].y; - break; - } - } - - if ( i == this.currentPage.pageX ) { - i += this.directionX; - - if ( i < 0 ) { - i = 0; - } else if ( i >= this.pages.length ) { - i = this.pages.length - 1; - } - - x = this.pages[i][0].x; - } - - if ( m == this.currentPage.pageY ) { - m += this.directionY; - - if ( m < 0 ) { - m = 0; - } else if ( m >= this.pages[0].length ) { - m = this.pages[0].length - 1; - } - - y = this.pages[0][m].y; - } - - return { - x: x, - y: y, - pageX: i, - pageY: m - }; - }, - - goToPage: function (x, y, time, easing) { - easing = easing || this.options.bounceEasing; - - if ( x >= this.pages.length ) { - x = this.pages.length - 1; - } else if ( x < 0 ) { - x = 0; - } - - if ( y >= this.pages[x].length ) { - y = this.pages[x].length - 1; - } else if ( y < 0 ) { - y = 0; - } - - var posX = this.pages[x][y].x, - posY = this.pages[x][y].y; - - time = time === undefined ? this.options.snapSpeed || Math.max( - Math.max( - Math.min(Math.abs(posX - this.x), 1000), - Math.min(Math.abs(posY - this.y), 1000) - ), 300) : time; - - this.currentPage = { - x: posX, - y: posY, - pageX: x, - pageY: y - }; - - this.scrollTo(posX, posY, time, easing); - }, - - next: function (time, easing) { - var x = this.currentPage.pageX, - y = this.currentPage.pageY; - - x++; - - if ( x >= this.pages.length && this.hasVerticalScroll ) { - x = 0; - y++; - } - - this.goToPage(x, y, time, easing); - }, - - prev: function (time, easing) { - var x = this.currentPage.pageX, - y = this.currentPage.pageY; - - x--; - - if ( x < 0 && this.hasVerticalScroll ) { - x = 0; - y--; - } - - this.goToPage(x, y, time, easing); - }, - - _initKeys: function (e) { - // default key bindings - var keys = { - pageUp: 33, - pageDown: 34, - end: 35, - home: 36, - left: 37, - up: 38, - right: 39, - down: 40 - }; - var i; - - // if you give me characters I give you keycode - if ( typeof this.options.keyBindings == 'object' ) { - for ( i in this.options.keyBindings ) { - if ( typeof this.options.keyBindings[i] == 'string' ) { - this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0); - } - } - } else { - this.options.keyBindings = {}; - } - - for ( i in keys ) { - this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i]; - } - - utils.addEvent(window, 'keydown', this); - - this.on('destroy', function () { - utils.removeEvent(window, 'keydown', this); - }); - }, - - _key: function (e) { - if ( !this.enabled ) { - return; - } - - var snap = this.options.snap, // we are using this alot, better to cache it - newX = snap ? this.currentPage.pageX : this.x, - newY = snap ? this.currentPage.pageY : this.y, - now = utils.getTime(), - prevTime = this.keyTime || 0, - acceleration = 0.250, - pos; - - if ( this.options.useTransition && this.isInTransition ) { - pos = this.getComputedPosition(); - - this._translate(Math.round(pos.x), Math.round(pos.y)); - this.isInTransition = false; - } - - this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0; - - switch ( e.keyCode ) { - case this.options.keyBindings.pageUp: - if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { - newX += snap ? 1 : this.wrapperWidth; - } else { - newY += snap ? 1 : this.wrapperHeight; - } - break; - case this.options.keyBindings.pageDown: - if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { - newX -= snap ? 1 : this.wrapperWidth; - } else { - newY -= snap ? 1 : this.wrapperHeight; - } - break; - case this.options.keyBindings.end: - newX = snap ? this.pages.length-1 : this.maxScrollX; - newY = snap ? this.pages[0].length-1 : this.maxScrollY; - break; - case this.options.keyBindings.home: - newX = 0; - newY = 0; - break; - case this.options.keyBindings.left: - newX += snap ? -1 : 5 + this.keyAcceleration>>0; - break; - case this.options.keyBindings.up: - newY += snap ? 1 : 5 + this.keyAcceleration>>0; - break; - case this.options.keyBindings.right: - newX -= snap ? -1 : 5 + this.keyAcceleration>>0; - break; - case this.options.keyBindings.down: - newY -= snap ? 1 : 5 + this.keyAcceleration>>0; - break; - default: - return; - } - - if ( snap ) { - this.goToPage(newX, newY); - return; - } - - if ( newX > 0 ) { - newX = 0; - this.keyAcceleration = 0; - } else if ( newX < this.maxScrollX ) { - newX = this.maxScrollX; - this.keyAcceleration = 0; - } - - if ( newY > 0 ) { - newY = 0; - this.keyAcceleration = 0; - } else if ( newY < this.maxScrollY ) { - newY = this.maxScrollY; - this.keyAcceleration = 0; - } - - this.scrollTo(newX, newY, 0); - - this.keyTime = now; - }, - - _animate: function (destX, destY, duration, easingFn) { - var that = this, - startX = this.x, - startY = this.y, - startTime = utils.getTime(), - destTime = startTime + duration; - - function step () { - var now = utils.getTime(), - newX, newY, - easing; - - if ( now >= destTime ) { - that.isAnimating = false; - that._translate(destX, destY); - - if ( !that.resetPosition(that.options.bounceTime) ) { - that._execEvent('scrollEnd'); - } - - return; - } - - now = ( now - startTime ) / duration; - easing = easingFn(now); - newX = ( destX - startX ) * easing + startX; - newY = ( destY - startY ) * easing + startY; - that._translate(newX, newY); - - if ( that.isAnimating ) { - rAF(step); - } - } - - this.isAnimating = true; - step(); - }, - handleEvent: function (e) { - switch ( e.type ) { - case 'touchstart': - case 'pointerdown': - case 'MSPointerDown': - case 'mousedown': - this._start(e); - break; - case 'touchmove': - case 'pointermove': - case 'MSPointerMove': - case 'mousemove': - this._move(e); - break; - case 'touchend': - case 'pointerup': - case 'MSPointerUp': - case 'mouseup': - case 'touchcancel': - case 'pointercancel': - case 'MSPointerCancel': - case 'mousecancel': - this._end(e); - break; - case 'orientationchange': - case 'resize': - this._resize(); - break; - case 'transitionend': - case 'webkitTransitionEnd': - case 'oTransitionEnd': - case 'MSTransitionEnd': - this._transitionEnd(e); - break; - case 'wheel': - case 'DOMMouseScroll': - case 'mousewheel': - this._wheel(e); - break; - case 'keydown': - this._key(e); - break; - case 'click': - if ( !e._constructed ) { - e.preventDefault(); - e.stopPropagation(); - } - break; - } - } -}; -function createDefaultScrollbar (direction, interactive, type) { - var scrollbar = document.createElement('div'), - indicator = document.createElement('div'); - - if ( type === true ) { - scrollbar.style.cssText = 'position:absolute;z-index:9999'; - indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px'; - } - - indicator.className = 'iScrollIndicator'; - - if ( direction == 'h' ) { - if ( type === true ) { - scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'; - indicator.style.height = '100%'; - } - scrollbar.className = 'iScrollHorizontalScrollbar'; - } else { - if ( type === true ) { - scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'; - indicator.style.width = '100%'; - } - scrollbar.className = 'iScrollVerticalScrollbar'; - } - - scrollbar.style.cssText += ';overflow:hidden'; - - if ( !interactive ) { - scrollbar.style.pointerEvents = 'none'; - } - - scrollbar.appendChild(indicator); - - return scrollbar; -} - -function Indicator (scroller, options) { - this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el; - this.wrapperStyle = this.wrapper.style; - this.indicator = this.wrapper.children[0]; - this.indicatorStyle = this.indicator.style; - this.scroller = scroller; - - this.options = { - listenX: true, - listenY: true, - interactive: false, - resize: true, - defaultScrollbars: false, - shrink: false, - fade: false, - speedRatioX: 0, - speedRatioY: 0 - }; - - for ( var i in options ) { - this.options[i] = options[i]; - } - - this.sizeRatioX = 1; - this.sizeRatioY = 1; - this.maxPosX = 0; - this.maxPosY = 0; - - if ( this.options.interactive ) { - if ( !this.options.disableTouch ) { - utils.addEvent(this.indicator, 'touchstart', this); - utils.addEvent(window, 'touchend', this); - } - if ( !this.options.disablePointer ) { - utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); - utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this); - } - if ( !this.options.disableMouse ) { - utils.addEvent(this.indicator, 'mousedown', this); - utils.addEvent(window, 'mouseup', this); - } - } - - if ( this.options.fade ) { - this.wrapperStyle[utils.style.transform] = this.scroller.translateZ; - this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms'; - this.wrapperStyle.opacity = '0'; - } -} - -Indicator.prototype = { - handleEvent: function (e) { - switch ( e.type ) { - case 'touchstart': - case 'pointerdown': - case 'MSPointerDown': - case 'mousedown': - this._start(e); - break; - case 'touchmove': - case 'pointermove': - case 'MSPointerMove': - case 'mousemove': - this._move(e); - break; - case 'touchend': - case 'pointerup': - case 'MSPointerUp': - case 'mouseup': - case 'touchcancel': - case 'pointercancel': - case 'MSPointerCancel': - case 'mousecancel': - this._end(e); - break; - } - }, - - destroy: function () { - if ( this.options.interactive ) { - utils.removeEvent(this.indicator, 'touchstart', this); - utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); - utils.removeEvent(this.indicator, 'mousedown', this); - - utils.removeEvent(window, 'touchmove', this); - utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); - utils.removeEvent(window, 'mousemove', this); - - utils.removeEvent(window, 'touchend', this); - utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this); - utils.removeEvent(window, 'mouseup', this); - } - - if ( this.options.defaultScrollbars ) { - this.wrapper.parentNode.removeChild(this.wrapper); - } - }, - - _start: function (e) { - var point = e.touches ? e.touches[0] : e; - - e.preventDefault(); - e.stopPropagation(); - - this.transitionTime(); - - this.initiated = true; - this.moved = false; - this.lastPointX = point.pageX; - this.lastPointY = point.pageY; - - this.startTime = utils.getTime(); - - if ( !this.options.disableTouch ) { - utils.addEvent(window, 'touchmove', this); - } - if ( !this.options.disablePointer ) { - utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this); - } - if ( !this.options.disableMouse ) { - utils.addEvent(window, 'mousemove', this); - } - - this.scroller._execEvent('beforeScrollStart'); - }, - - _move: function (e) { - var point = e.touches ? e.touches[0] : e, - deltaX, deltaY, - newX, newY, - timestamp = utils.getTime(); - - if ( !this.moved ) { - this.scroller._execEvent('scrollStart'); - } - - this.moved = true; - - deltaX = point.pageX - this.lastPointX; - this.lastPointX = point.pageX; - - deltaY = point.pageY - this.lastPointY; - this.lastPointY = point.pageY; - - newX = this.x + deltaX; - newY = this.y + deltaY; - - this._pos(newX, newY); - -// INSERT POINT: indicator._move - - e.preventDefault(); - e.stopPropagation(); - }, - - _end: function (e) { - if ( !this.initiated ) { - return; - } - - this.initiated = false; - - e.preventDefault(); - e.stopPropagation(); - - utils.removeEvent(window, 'touchmove', this); - utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); - utils.removeEvent(window, 'mousemove', this); - - if ( this.scroller.options.snap ) { - var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); - - var time = this.options.snapSpeed || Math.max( - Math.max( - Math.min(Math.abs(this.scroller.x - snap.x), 1000), - Math.min(Math.abs(this.scroller.y - snap.y), 1000) - ), 300); - - if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) { - this.scroller.directionX = 0; - this.scroller.directionY = 0; - this.scroller.currentPage = snap; - this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing); - } - } - - if ( this.moved ) { - this.scroller._execEvent('scrollEnd'); - } - }, - - transitionTime: function (time) { - time = time || 0; - this.indicatorStyle[utils.style.transitionDuration] = time + 'ms'; - - if ( !time && utils.isBadAndroid ) { - this.indicatorStyle[utils.style.transitionDuration] = '0.001s'; - } - }, - - transitionTimingFunction: function (easing) { - this.indicatorStyle[utils.style.transitionTimingFunction] = easing; - }, - - refresh: function () { - this.transitionTime(); - - if ( this.options.listenX && !this.options.listenY ) { - this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none'; - } else if ( this.options.listenY && !this.options.listenX ) { - this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none'; - } else { - this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'; - } - - if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) { - utils.addClass(this.wrapper, 'iScrollBothScrollbars'); - utils.removeClass(this.wrapper, 'iScrollLoneScrollbar'); - - if ( this.options.defaultScrollbars && this.options.customStyle ) { - if ( this.options.listenX ) { - this.wrapper.style.right = '8px'; - } else { - this.wrapper.style.bottom = '8px'; - } - } - } else { - utils.removeClass(this.wrapper, 'iScrollBothScrollbars'); - utils.addClass(this.wrapper, 'iScrollLoneScrollbar'); - - if ( this.options.defaultScrollbars && this.options.customStyle ) { - if ( this.options.listenX ) { - this.wrapper.style.right = '2px'; - } else { - this.wrapper.style.bottom = '2px'; - } - } - } - - var r = this.wrapper.offsetHeight; // force refresh - - if ( this.options.listenX ) { - this.wrapperWidth = this.wrapper.clientWidth; - if ( this.options.resize ) { - this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8); - this.indicatorStyle.width = this.indicatorWidth + 'px'; - } else { - this.indicatorWidth = this.indicator.clientWidth; - } - - this.maxPosX = this.wrapperWidth - this.indicatorWidth; - - if ( this.options.shrink == 'clip' ) { - this.minBoundaryX = -this.indicatorWidth + 8; - this.maxBoundaryX = this.wrapperWidth - 8; - } else { - this.minBoundaryX = 0; - this.maxBoundaryX = this.maxPosX; - } - - this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)); - } - - if ( this.options.listenY ) { - this.wrapperHeight = this.wrapper.clientHeight; - if ( this.options.resize ) { - this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8); - this.indicatorStyle.height = this.indicatorHeight + 'px'; - } else { - this.indicatorHeight = this.indicator.clientHeight; - } - - this.maxPosY = this.wrapperHeight - this.indicatorHeight; - - if ( this.options.shrink == 'clip' ) { - this.minBoundaryY = -this.indicatorHeight + 8; - this.maxBoundaryY = this.wrapperHeight - 8; - } else { - this.minBoundaryY = 0; - this.maxBoundaryY = this.maxPosY; - } - - this.maxPosY = this.wrapperHeight - this.indicatorHeight; - this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)); - } - - this.updatePosition(); - }, - - updatePosition: function () { - var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0, - y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0; - - if ( !this.options.ignoreBoundaries ) { - if ( x < this.minBoundaryX ) { - if ( this.options.shrink == 'scale' ) { - this.width = Math.max(this.indicatorWidth + x, 8); - this.indicatorStyle.width = this.width + 'px'; - } - x = this.minBoundaryX; - } else if ( x > this.maxBoundaryX ) { - if ( this.options.shrink == 'scale' ) { - this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8); - this.indicatorStyle.width = this.width + 'px'; - x = this.maxPosX + this.indicatorWidth - this.width; - } else { - x = this.maxBoundaryX; - } - } else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) { - this.width = this.indicatorWidth; - this.indicatorStyle.width = this.width + 'px'; - } - - if ( y < this.minBoundaryY ) { - if ( this.options.shrink == 'scale' ) { - this.height = Math.max(this.indicatorHeight + y * 3, 8); - this.indicatorStyle.height = this.height + 'px'; - } - y = this.minBoundaryY; - } else if ( y > this.maxBoundaryY ) { - if ( this.options.shrink == 'scale' ) { - this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8); - this.indicatorStyle.height = this.height + 'px'; - y = this.maxPosY + this.indicatorHeight - this.height; - } else { - y = this.maxBoundaryY; - } - } else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) { - this.height = this.indicatorHeight; - this.indicatorStyle.height = this.height + 'px'; - } - } - - this.x = x; - this.y = y; - - if ( this.scroller.options.useTransform ) { - this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ; - } else { - this.indicatorStyle.left = x + 'px'; - this.indicatorStyle.top = y + 'px'; - } - }, - - _pos: function (x, y) { - if ( x < 0 ) { - x = 0; - } else if ( x > this.maxPosX ) { - x = this.maxPosX; - } - - if ( y < 0 ) { - y = 0; - } else if ( y > this.maxPosY ) { - y = this.maxPosY; - } - - x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x; - y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y; - - this.scroller.scrollTo(x, y); - }, - - fade: function (val, hold) { - if ( hold && !this.visible ) { - return; - } - - clearTimeout(this.fadeTimeout); - this.fadeTimeout = null; - - var time = val ? 250 : 500, - delay = val ? 0 : 300; - - val = val ? '1' : '0'; - - this.wrapperStyle[utils.style.transitionDuration] = time + 'ms'; - - this.fadeTimeout = setTimeout((function (val) { - this.wrapperStyle.opacity = val; - this.visible = +val; - }).bind(this, val), delay); - } -}; - -IScroll.utils = utils; - -if ( typeof module != 'undefined' && module.exports ) { - module.exports = IScroll; -} else { - window.IScroll = IScroll; -} - -})(window, document, Math); \ No newline at end of file diff --git a/list.js b/list.js deleted file mode 100755 index 0e07f58b..00000000 --- a/list.js +++ /dev/null @@ -1,114 +0,0 @@ -var list; -var toSend = ""; -var sendURL; -var myScroll; -var scroller = false; -var showToggle =true; -var chan = $("#chan").html(); - -function updateList() -{ - console.log("updating list"); - list = $.ajax({ type: "GET", - url: "change.php", - async: false - }).responseText; - list = $.parseJSON(list); - list[0].shift(); - list[3].shift(); - list[2].shift(); - - setTimeout(function() - { - - $("#wrapper").empty(); - - $.each(list[0], function(j, listeID){ - - var video_title=list[3][j].replace(/\\\'/, "'"); - var video_id = list[0][j]; - var video_thumb = "http://i.ytimg.com/vi/"+video_id+"/default.jpg"; - var odd = ""; if(j%2==0)odd=" oddlist"; - var finalhtml="
"+ - ""+ - "
"+video_title+"
"+ - "
"+list[2][j]+"+-
"+ - "
"; - $("#wrapper").append(finalhtml); - }); - if($("#playlist").height() > $("#player").height()) - { - if(!window.mobilecheck()) - { - $("#playlist").css({height: $("#player").height() - $("#buttons").height()-4}); - $("#playlist").css({overflow: "hidden"}); - if(scroller == false) - { - myScroll = new IScroll('#playlist', { - mouseWheel: true, - scrollbars: false, - scrollY: true, - interactiveScrollbars: false - }); - scroller = true; - }else - { - myScroll.refresh(); - } - } - } - if(window.mobilecheck()) - { - document.getElementById("player").style.display="none"; - ytplayer.pauseVideo(); - } - }, 2500); -} - -function vote(id, vote){ - console.log($.ajax({ - type: "GET", - url: "change.php", - async: false, - data: "vote="+vote+"&id="+id, - success: function() { - console.log("voted "+vote+" on "+id); - if(vote=="pos"){ $("#playlist").addClass("success");} - else{ $("#playlist").addClass("error");} - }, - }).responseText); - setTimeout(function(){ - $("#playlist").removeClass("success"); - $("#playlist").removeClass("error"); - },1500); -} - -function skip(){ - console.log($.ajax({ - type: "GET", - url: "change.php", - async: false, - data: "skip", - success: function() { - console.log("voted to skip song"); - $("#buttons").addClass("success"); - }, - }).responseText); - setTimeout(function(){ - $("#playlist").removeClass("success"); - },1500); -} - -function show(){ - if(showToggle){ - showToggle=false; - $("#toptitle").empty(); - $("#chan").addClass("bigChan"); - $("#chan").html("zoff.no/"+chan); - }else{ - showToggle=true; - $("#toptitle").html("Zöff"); - $("#chan").removeClass("bigChan"); - $("#chan").html(chan); - } -} \ No newline at end of file diff --git a/lists/tritoen.json b/lists/tritoen.json index 4160eee2..330625e5 100755 --- a/lists/tritoen.json +++ b/lists/tritoen.json @@ -1 +1 @@ -[["-1jPUB7gRyg","llyiQ4I-mcQ","GMoud3dub6U","tenz01ic1D8","byp94CCWKSI","87JabMupbB8","iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE"],[1412882300],[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!","\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)","Bodybangers Inc. - Kompani Linge 2012","LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)"],[3],[]] \ No newline at end of file +[["GMoud3dub6U","tenz01ic1D8","byp94CCWKSI","87JabMupbB8","iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE","-1jPUB7gRyg","llyiQ4I-mcQ"],[1412934952],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)","Bodybangers Inc. - Kompani Linge 2012","LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)","Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!"],[1],[]] \ No newline at end of file diff --git a/nochan.php b/nochan.php deleted file mode 100755 index d25ea44e..00000000 --- a/nochan.php +++ /dev/null @@ -1,38 +0,0 @@ - - -
Zöff
-
- - - ";} ?> - -
- -
-
-
Active Channels
- ".urldecode($channel)."";} ?> -
-
- - - - - \ No newline at end of file diff --git a/search.js b/search.js deleted file mode 100755 index d07bfdae..00000000 --- a/search.js +++ /dev/null @@ -1,95 +0,0 @@ -$(document).ready(function() - { - - $("#search").focus(); - - $('#base').bind("keyup keypress", function(e) { - var code = e.keyCode || e.which; - if (code == 13) { - e.preventDefault(); - return false; - } - }); - var old_input=""; - $(".search_input").focus(); - setTimeout(function(){ - $(".search_input").keyup(function() - { - var search_input = $(this).val(); - if(search_input != old_input){ - old_input=search_input; - $("#results").html(''); - if(search_input != ""){ - var keyword= encodeURIComponent(search_input); - - var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=25&v=2&alt=jsonc'; - - - $.ajax({ - type: "GET", - url: yt_url, - dataType:"jsonp", - success: function(response) - { - if(response.data.items) - { - $.each(response.data.items, function(i,data) - { - if(data.duration > 720){return;} - var video_title=encodeURIComponent(data.title).replace(/'/g, "\\\'"); - var views=data.viewCount; - var video_thumb = "http://i.ytimg.com/vi/"+data.id+"/default.jpg"; - var length = Math.floor(data.duration/60)+":"+(data.duration-Math.floor(data.duration / 60)*60); - var finalhtml="
"+ - ""+ - "
"+data.title+""+ - ""+data.uploader+" • "+views+" views • "+length+"
"; - - $("#results").append(finalhtml); - - }); - - - } - else - { - $("#video").html("
No Video
"); - } - } - - }); - } - } - }); - }, 300); - }); - - function submit(id,title){ - console.log($.ajax({ - type: "GET", - url: "change.php", - async: false, - data: "v="+id+"&n="+title, - success: function() { - console.log("added "+id); - document.getElementById("search").value = ""; - $("#search").addClass("success"); - $("#results").html(''); - }, - error: function(){ - console.log("error in adding"); - document.getElementById("search").value = ""; - $("#search").addClass("error"); - $("#results").html(''); - } - }).responseText); - - $("#search").focus(); - - setTimeout(function(){ - $("#search").removeClass("success"); - $("#search").removeClass("error"); - },1500); - } - - // if(reply=="added"){$("#search").removeClass('success'); $("#search").addClass('success');} diff --git a/style.css b/style.css deleted file mode 100755 index 204bcc95..00000000 --- a/style.css +++ /dev/null @@ -1,84 +0,0 @@ -body{background:#FFF; margin:0;} -.top{ - font-family: 'Open Sans', sans-serif; font-weight: 300; text-align: center; - animation: fadein .5s; -moz-animation: fadein .5s; -webkit-animation: fadein .5s; -o-animation: fadein .5s; -} -.top, .top a{color:#ed207f; text-decoration: none;} -.vcent{position: relative; top: 50%; -webkit-transform: translateY(-50%);} - - -.innbox, .innbox a{ - width:90%; height: 50px; border-radius:7px; border:none; font-family: 'Open Sans', sans-serif; font-size: 25px; margin-bottom: 20px; - color:#f15; text-align: center;-webkit-transition:background 1s;-moz-transition:background 1s;-o-transition:background 1s; transition:background 1s; -} -.success{animation: fadecol 1.5s; -moz-animation: fadecol 1.5s; -webkit-animation: fadecol 1.5s; -o-animation: fadecol 1.5s;} -.error{animation: fadewrong 1.5s; -moz-animation: fadewrong 1.5s; -webkit-animation: fadewrong 1.5s; -o-animation: fadewrong 1.5s;} -.small{font-size: 5vw; color:#E2E2E2; display:block !important; text-decoration: none; } -/*.small:hover{color: #CCC;}*/ -.big{font-size:180vh; position:absolute; top:-50%; color:#330A00 !important; z-index:-1; width: 100%; overflow: hidden; display: none;} -.footer a{color:#696969; text-decoration: none;}.footer a:hover {color:#ed207f;} -.footer{font-size: 15px; position:absolute; width:99%;color:#c0c0c0 !important; margin-top: 0; word-spacing: 2px;} -.bottom{bottom:10px;} -#channels{width:40%; min-width: 300px; padding-top: 4%; font-size: 25px;} -.channel{padding: 7px; display: inline-block; font-weight: bold; color: #646464 !important;font-size: 18px;} -.channel:hover{color:#ed207f !important;} - - -.anim{transition: all .20s ease-in-out; -moz-transition: all .20s ease-in-out; -webkit-transition: all .20s ease-in-out;} -.chan{color:#CCC; cursor:pointer; display: inline;} -.bigchan{color: #ed207f; font-size: 10vw; padding-top: 25%;} - -#buttons{cursor: default; text-align: right;} -.skip{cursor: pointer; height: 25px; padding:8px 21px 0 0;} - -#results{position:absolute; background-color: white; font-size: 14px; width:90%; margin-left: 5%; margin-top:-5px; z-index: 1; font-family: sans-serif;} -.result{border-bottom:none; padding: 3px 0 3px 10%; text-align: left; height: 55px; cursor: pointer;} -.result:hover{background-color: #DDD;} -#title{ padding-left: 20%; padding-top:10px; max-width: 76%; color:#ed207f; height: 36px;} -.result_info{color:#888; font-size: 12px; float:right;} -.thumb{height: 40px; width:80px; float: left;} - - -.main{width:90%; margin: 0 auto 0 auto;} -.playlist{background-color: #DADADA; width:20%; margin-left: 0px; display: inline-block; font-size: 14px; border-radius: 3px; vertical-align: top; /*overflow: hidden;*/ height: calc(87% - 183px); border-bottom:solid #c9c9c9 4px;} -.lresult{padding:0; height: 60px; border-top: none; cursor: default; background-color: #DADADA;} -.lthumb{height: 60px; margin-right: 10px; display: inline;} -.ltitle{ color:#ed207f; overflow: hidden; height: 60px; } -.oddlist{background-color: #EEE;} - -.votes{float: right; position: relative; margin-top: -1.4em; padding:0 3 0 4; background-color: rgba(50,50,50,0.45); color:#000; border-radius: 1px;} -#plus, #minus {text-decoration: none; color:white; margin-left: 2px; padding-left: 3px; padding-right: 3px; } -#plus:hover,#minus:hover{background-color: #111;} - -#player{height: 68%; height: calc(87% - 183px); width: 78%; border-radius: 3px; border-bottom:solid #c9c9c9 4px;} -#playlist{} -.nomargin{padding: 0;margin:0;} - -@media (max-width: 1000px) { - #player{width: 100%; height:45%; margin-bottom: 20px;} - .playlist{width: 100%;} - .lresult{font-size: 40px; height: 90px; font-size: 50px;} - .votes{font-size: 42px; padding-right: 8px; height: 89px; line-height: 89px; padding-left: 20px; border-radius: 1px;} - .lthumb{height: 90px;} - #plus,#minus{padding-left: 24px; margin-left: 0; padding-right: 24px;} - #plus{border-right:solid 3px rgb(172, 172, 172);} - #search{text-align: left; height: 100px; font-size: 40px; border: solid 2px #ccc;} - #buttons{text-align: center; height: 80px;} - .skip{height: 50px;} - .vcent{ - top: inherit; - -webkit-transform: translateY(0%); - } - #title{ - font-size: 30px; - font-weight: bold; - overflow: hidden; - padding-left: 2%; - padding-top: 0; - } - .footer{font-size: 40px; margin-top: 150px;} -} - -@-webkit-keyframes fadein{from {opacity:0;}to{opacity:1;}}@keyframes fadein{from{opacity:0;}to{opacity:1;}}@-moz-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}} -@-webkit-keyframes fadecol{from {background-color:#00FF00;}to{background-color: #FFF;}}@keyframes fadecol{background-color: #00FF00;}to{background-color: #FFF;}}@-moz-keyframes fadecol{from{background-color: #00FF00;}to{background-color: #FFF;}}@-o-keyframes fadecol{background-color: #00FF00;}to{background-color: #FFF;}} -@-webkit-keyframes fadewrong{from {background-color:#FF0000;}to{background-color: #FFF;}}@keyframes fadewrong{background-color: #FF0000;}to{background-color: #FFF;}}@-moz-keyframes fadewrong{from{background-color: #FF0000;}to{background-color: #FFF;}}@-o-keyframes fadewrong{background-color: #FF0000;}to{background-color: #FFF;}} \ No newline at end of file diff --git a/timedifference.php b/timedifference.php deleted file mode 100755 index 6c26dde2..00000000 --- a/timedifference.php +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/videos.php b/videos.php deleted file mode 100755 index 6220e7b8..00000000 --- a/videos.php +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/visualize.js b/visualize.js deleted file mode 100755 index a8172e1c..00000000 --- a/visualize.js +++ /dev/null @@ -1,5 +0,0 @@ -/*$(document).ready(function() -{ - context = new AudioContext(); - src = context.createMediaElementSource($('#player video')); -}*/ \ No newline at end of file diff --git a/youtube.js b/youtube.js deleted file mode 100755 index b13e92df..00000000 --- a/youtube.js +++ /dev/null @@ -1,292 +0,0 @@ -/* -This is the youtube player sync and control file. - -Fetcher sangen som spilles fra JSON filen - -*/ - -var timeDifference; -var wasPaused; -var beginning; -var diffVideo; -var serverTime; -var url; -var response; -var url -var tag -var firstScriptTag; -var ytplayer; -var syncInterval; -var title; -var interval; -var viewers; -var changed = false; - -$(document).ready(function() -{ - window.mobilecheck = function() { - var check = false; - (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); - return check; } - - updateList(); - timeDifference; - wasPaused = false; - beginning = true; - diffVideo = false; - interval = false; - response = $.ajax({ type: "GET", - url: "change.php", - async: false - }).responseText; - - url = $.parseJSON(response); - - $.ajax({ - type: 'get', - url: 'timedifference.php', - data: "abcde", - async: false, - success: function(data) { - timeDifference = $.parseJSON(data); - } - }); - console.log("timediff:"+timeDifference[0]); - - response = url[0][0]; - - tag = document.createElement('script'); - tag.src = "https://www.youtube.com/iframe_api"; - firstScriptTag = document.getElementsByTagName('script')[0]; - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); - if(window.mobilecheck()){ - syncInterval = setInterval(getTime, 50000); - listInterval = setInterval(updateList, 50000); - document.getElementById("search").blur(); - }else{ - syncInterval = setInterval(getTime, 5000); - listInterval = setInterval(updateList, 10000); - } -}); - -function onYouTubeIframeAPIReady() { - ytplayer = new YT.Player('player', { - height: window.height*0.75, - width: window.width*0.6, - videoId: response, - playerVars: { controls: "1" , iv_load_policy: "3", theme:"light", rel:"0", color:"white" }, - events: { - 'onReady': onPlayerReady, - 'onStateChange': onPlayerStateChange, - 'onError': errorHandler - } - }); -} - -/** - -Legger sangen inn i
en, via swfobject - - -var params = { allowScriptAccess: "always"}; -var atts = { id: "myytplayer" }; -swfobject.embedSWF("http://www.youtube.com/v/"+response+"?enablejsapi=1&playerapiid=ytplayer&version=3&controls=1&iv_load_policy=3", - "ytapiplayer", "825", "462", "8", null, null, params, atts); - - -eventlistener for når playeren endres -*/ -function onPlayerStateChange(newState) { - console.log("new state: "+newState.data); - console.log("beginning: "+beginning); - //ytplayer.seekTo(15); - if((newState.data == 0 && checkEnd()) || (newState.data == 1 && checkEnd())) - { - console.log("nummer 1"); - startNextSong(); - ytplayer.pauseVideo(); - wasPaused = false; - }else if(newState.data == 1 && (wasPaused && !beginning)) - { - console.log("unpaused"); - beginning = false; - wasPaused = false; - syncInterval = setInterval(getTime, 5000); - getTime(); - }else if(newState.data == 2) - { - clearInterval(syncInterval); - interval = true; - wasPaused = true; - beginning = false; - } -} - -function checkEnd() -{ - console.log("sjekker om brukeren spolte"); - $.ajax({ - type: 'get', - url: 'timedifference.php', - data: "abcde", - async: false, - success: function(data) { - timeDifference = $.parseJSON(data); - } - }); - if(parseInt(timeDifference[0]) > ytplayer.getDuration()) - { - return true; - } - return false; -} - -function startNextSong() -{ - - //console.log(getTime()); - if(checkEnd() && !changed) - { - setTimeout(function(){ - response = $.ajax({ - type: "POST", - url: "change.php", - async: false, - data: "thisUrl="+response+"&act=save", - - success: function() { - console.log("saved song-switch - "+response); - } - }).responseText; - - console.log("next video: "+response); - getTitle(response); - ytplayer.loadVideoById(response); - beginning = true; - - },2500); - updateList(); - changed = true - setTimeout(function() { - changed = false; - syncInterval = setInterval(getTime, 5000); - interval = true; - console.log("starter intervallen. Interval: " + interval); - }, 2500); - } - -} - -function getTime() -{ - console.log("utenfor if test" + wasPaused); - if(!wasPaused) - { - console.log("sjekker om brukeren spolte"); - - $.ajax({ - type: 'get', - url: 'timedifference.php', - data: "abcde", - async: false, - success: function(data) { - timeDifference = $.parseJSON(data); - } - }); - console.log("current song: "+response); - console.log("song in database: "+timeDifference[1]); - if(parseInt(timeDifference[2]) + 1> ytplayer.getCurrentTime() + parseInt(timeDifference[3]) && ytplayer.getPlayerState() == 0) - { - return true; - }else if(ytplayer.getCurrentTime() + parseInt(timeDifference[3]) > parseInt(timeDifference[2]) + 5 || (ytplayer.getCurrentTime() + parseInt(timeDifference[3]) < parseInt(timeDifference[2]) - 5 && ytplayer.getPlayerState() != 0 && ytplayer.getPlayerState() != 3)) - { - if(parseInt(timeDifference[0]) > ytplayer.getDuration()) - { - console.log("burde ikke søke, men hoppe til neste sang"); - } - ytplayer.seekTo(timeDifference[0]); - ytplayer.pauseVideo(); - ytplayer.playVideo(); - getTitle(); - return false; - } - //if(interval){syncInterval = setInterval(getTime, 5000);interval = false;} - - if(response != timeDifference[1]) - { - clearInterval(syncInterval); - console.log("forskjellige videoer!!"); - ytplayer.pauseVideo(); - ytplayer.loadVideoById(timeDifference[1]); - setTimeout(function(){ - //console.log(response); - diffVideo = true; - beginning = true; - $.ajax({ - type: "POST", - url: "change.php", - async: false, - data: "thisUrl=123abcprompeprompe&act=save", - success: function(data) - { - response = timeDifference[1]; - getTitle(); - } - }); - syncInterval = setInterval(getTime, 5000); - },2500); - } - } -} - -function getTitle() -{ - $.ajax({ type: "GET", - url: "timedifference.php", - async: false, - success: function(data) { - viewers = $.parseJSON(data); - var outPutWord = viewers[5] > 1 ? "viewers" : "viewer"; - var title= viewers[4].replace(/\\\'/, "'"); - document.title = viewers[4] + " • Zöff"; - document.getElementsByName('v')[0].placeholder = viewers[4] + " • " + viewers[5] + " " + outPutWord; - } - }); - -} - -function errorHandler(newState) -{ - setTimeout(function(){ - response = $.ajax({ - type: "POST", - url: "change.php", - async: false, - data: "thisUrl="+response+"&act=delete", - - success: function() { - console.log("error! deleted video"); - } - }).responseText; - ytplayer.loadVideoById(response); - },2500); -/* - setTimeout(function(){ - response = $.ajax({ type: "GET", - url: "change.php", - async: false - }).responseText; - var url = $.parseJSON(response); - response = url[0][0]; - - ytplayer.loadVideoById(response); - },2500);*/ -} -function onPlayerReady(event) { - //ytplayer = document.getElementById("myytplayer"); - // ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); - //ytplayer.addEventListener("onError", "errorHandler"); - getTime(); - ytplayer.playVideo(); - getTitle(); - } \ No newline at end of file From 086c999e510a3cb9442a5d894a7066a0dce6e9ab Mon Sep 17 00:00:00 2001 From: "Nicolas A. Tonne" Date: Fri, 10 Oct 2014 13:13:13 +0200 Subject: [PATCH 2/3] Reorganized files and added script to convert old lists --- js/iscroll.js | 2006 ++++++++++++++++++++++++++++++++++++++++ js/list.js | 114 +++ js/search.js | 95 ++ js/visualize.js | 5 + js/youtube.js | 292 ++++++ lists/tritoen.json | 2 +- php/admin.php | 42 + php/change.php | 124 +++ php/convert_lists.php | 30 + php/header.php | 6 + php/index.html | 0 php/nochan.php | 38 + php/timedifference.php | 13 + php/videos.php | 8 + static/favicon.ico | Bin 0 -> 34494 bytes static/style.css | 84 ++ 16 files changed, 2858 insertions(+), 1 deletion(-) create mode 100755 js/iscroll.js create mode 100755 js/list.js create mode 100755 js/search.js create mode 100755 js/visualize.js create mode 100755 js/youtube.js create mode 100644 php/admin.php create mode 100755 php/change.php create mode 100644 php/convert_lists.php create mode 100644 php/header.php create mode 100644 php/index.html create mode 100755 php/nochan.php create mode 100755 php/timedifference.php create mode 100755 php/videos.php create mode 100755 static/favicon.ico create mode 100755 static/style.css diff --git a/js/iscroll.js b/js/iscroll.js new file mode 100755 index 00000000..32b1ad5b --- /dev/null +++ b/js/iscroll.js @@ -0,0 +1,2006 @@ +/*! iScroll v5.1.2 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */ +(function (window, document, Math) { +var rAF = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function (callback) { window.setTimeout(callback, 1000 / 60); }; + +var utils = (function () { + var me = {}; + + var _elementStyle = document.createElement('div').style; + var _vendor = (function () { + var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'], + transform, + i = 0, + l = vendors.length; + + for ( ; i < l; i++ ) { + transform = vendors[i] + 'ransform'; + if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1); + } + + return false; + })(); + + function _prefixStyle (style) { + if ( _vendor === false ) return false; + if ( _vendor === '' ) return style; + return _vendor + style.charAt(0).toUpperCase() + style.substr(1); + } + + me.getTime = Date.now || function getTime () { return new Date().getTime(); }; + + me.extend = function (target, obj) { + for ( var i in obj ) { + target[i] = obj[i]; + } + }; + + me.addEvent = function (el, type, fn, capture) { + el.addEventListener(type, fn, !!capture); + }; + + me.removeEvent = function (el, type, fn, capture) { + el.removeEventListener(type, fn, !!capture); + }; + + me.prefixPointerEvent = function (pointerEvent) { + return window.MSPointerEvent ? + 'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10): + pointerEvent; + }; + + me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) { + var distance = current - start, + speed = Math.abs(distance) / time, + destination, + duration; + + deceleration = deceleration === undefined ? 0.0006 : deceleration; + + destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 ); + duration = speed / deceleration; + + if ( destination < lowerMargin ) { + destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin; + distance = Math.abs(destination - current); + duration = distance / speed; + } else if ( destination > 0 ) { + destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0; + distance = Math.abs(current) + destination; + duration = distance / speed; + } + + return { + destination: Math.round(destination), + duration: duration + }; + }; + + var _transform = _prefixStyle('transform'); + + me.extend(me, { + hasTransform: _transform !== false, + hasPerspective: _prefixStyle('perspective') in _elementStyle, + hasTouch: 'ontouchstart' in window, + hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed + hasTransition: _prefixStyle('transition') in _elementStyle + }); + + // This should find all Android browsers lower than build 535.19 (both stock browser and webview) + me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion)); + + me.extend(me.style = {}, { + transform: _transform, + transitionTimingFunction: _prefixStyle('transitionTimingFunction'), + transitionDuration: _prefixStyle('transitionDuration'), + transitionDelay: _prefixStyle('transitionDelay'), + transformOrigin: _prefixStyle('transformOrigin') + }); + + me.hasClass = function (e, c) { + var re = new RegExp("(^|\\s)" + c + "(\\s|$)"); + return re.test(e.className); + }; + + me.addClass = function (e, c) { + if ( me.hasClass(e, c) ) { + return; + } + + var newclass = e.className.split(' '); + newclass.push(c); + e.className = newclass.join(' '); + }; + + me.removeClass = function (e, c) { + if ( !me.hasClass(e, c) ) { + return; + } + + var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g'); + e.className = e.className.replace(re, ' '); + }; + + me.offset = function (el) { + var left = -el.offsetLeft, + top = -el.offsetTop; + + // jshint -W084 + while (el = el.offsetParent) { + left -= el.offsetLeft; + top -= el.offsetTop; + } + // jshint +W084 + + return { + left: left, + top: top + }; + }; + + me.preventDefaultException = function (el, exceptions) { + for ( var i in exceptions ) { + if ( exceptions[i].test(el[i]) ) { + return true; + } + } + + return false; + }; + + me.extend(me.eventType = {}, { + touchstart: 1, + touchmove: 1, + touchend: 1, + + mousedown: 2, + mousemove: 2, + mouseup: 2, + + pointerdown: 3, + pointermove: 3, + pointerup: 3, + + MSPointerDown: 3, + MSPointerMove: 3, + MSPointerUp: 3 + }); + + me.extend(me.ease = {}, { + quadratic: { + style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', + fn: function (k) { + return k * ( 2 - k ); + } + }, + circular: { + style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1) + fn: function (k) { + return Math.sqrt( 1 - ( --k * k ) ); + } + }, + back: { + style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', + fn: function (k) { + var b = 4; + return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1; + } + }, + bounce: { + style: '', + fn: function (k) { + if ( ( k /= 1 ) < ( 1 / 2.75 ) ) { + return 7.5625 * k * k; + } else if ( k < ( 2 / 2.75 ) ) { + return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75; + } else if ( k < ( 2.5 / 2.75 ) ) { + return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375; + } else { + return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375; + } + } + }, + elastic: { + style: '', + fn: function (k) { + var f = 0.22, + e = 0.4; + + if ( k === 0 ) { return 0; } + if ( k == 1 ) { return 1; } + + return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 ); + } + } + }); + + me.tap = function (e, eventName) { + var ev = document.createEvent('Event'); + ev.initEvent(eventName, true, true); + ev.pageX = e.pageX; + ev.pageY = e.pageY; + e.target.dispatchEvent(ev); + }; + + me.click = function (e) { + var target = e.target, + ev; + + if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) { + ev = document.createEvent('MouseEvents'); + ev.initMouseEvent('click', true, true, e.view, 1, + target.screenX, target.screenY, target.clientX, target.clientY, + e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, + 0, null); + + ev._constructed = true; + target.dispatchEvent(ev); + } + }; + + return me; +})(); + +function IScroll (el, options) { + this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; + this.scroller = this.wrapper.children[0]; + this.scrollerStyle = this.scroller.style; // cache style for better performance + + this.options = { + + resizeScrollbars: true, + + mouseWheelSpeed: 20, + + snapThreshold: 0.334, + +// INSERT POINT: OPTIONS + + startX: 0, + startY: 0, + scrollY: true, + directionLockThreshold: 5, + momentum: true, + + bounce: true, + bounceTime: 600, + bounceEasing: '', + + preventDefault: true, + preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ }, + + HWCompositing: true, + useTransition: true, + useTransform: true + }; + + for ( var i in options ) { + this.options[i] = options[i]; + } + + // Normalize options + this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : ''; + + this.options.useTransition = utils.hasTransition && this.options.useTransition; + this.options.useTransform = utils.hasTransform && this.options.useTransform; + + this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough; + this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault; + + // If you want eventPassthrough I have to lock one of the axes + this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY; + this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX; + + // With eventPassthrough we also need lockDirection mechanism + this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough; + this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold; + + this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing; + + this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling; + + if ( this.options.tap === true ) { + this.options.tap = 'tap'; + } + + if ( this.options.shrinkScrollbars == 'scale' ) { + this.options.useTransition = false; + } + + this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1; + +// INSERT POINT: NORMALIZATION + + // Some defaults + this.x = 0; + this.y = 0; + this.directionX = 0; + this.directionY = 0; + this._events = {}; + +// INSERT POINT: DEFAULTS + + this._init(); + this.refresh(); + + this.scrollTo(this.options.startX, this.options.startY); + this.enable(); +} + +IScroll.prototype = { + version: '5.1.2', + + _init: function () { + this._initEvents(); + + if ( this.options.scrollbars || this.options.indicators ) { + this._initIndicators(); + } + + if ( this.options.mouseWheel ) { + this._initWheel(); + } + + if ( this.options.snap ) { + this._initSnap(); + } + + if ( this.options.keyBindings ) { + this._initKeys(); + } + +// INSERT POINT: _init + + }, + + destroy: function () { + this._initEvents(true); + + this._execEvent('destroy'); + }, + + _transitionEnd: function (e) { + if ( e.target != this.scroller || !this.isInTransition ) { + return; + } + + this._transitionTime(); + if ( !this.resetPosition(this.options.bounceTime) ) { + this.isInTransition = false; + this._execEvent('scrollEnd'); + } + }, + + _start: function (e) { + // React to left mouse button only + if ( utils.eventType[e.type] != 1 ) { + if ( e.button !== 0 ) { + return; + } + } + + if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) { + return; + } + + if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + pos; + + this.initiated = utils.eventType[e.type]; + this.moved = false; + this.distX = 0; + this.distY = 0; + this.directionX = 0; + this.directionY = 0; + this.directionLocked = 0; + + this._transitionTime(); + + this.startTime = utils.getTime(); + + if ( this.options.useTransition && this.isInTransition ) { + this.isInTransition = false; + pos = this.getComputedPosition(); + this._translate(Math.round(pos.x), Math.round(pos.y)); + this._execEvent('scrollEnd'); + } else if ( !this.options.useTransition && this.isAnimating ) { + this.isAnimating = false; + this._execEvent('scrollEnd'); + } + + this.startX = this.x; + this.startY = this.y; + this.absStartX = this.x; + this.absStartY = this.y; + this.pointX = point.pageX; + this.pointY = point.pageY; + + this._execEvent('beforeScrollStart'); + }, + + _move: function (e) { + if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { + return; + } + + if ( this.options.preventDefault ) { // increases performance on Android? TODO: check! + e.preventDefault(); + } + + var point = e.touches ? e.touches[0] : e, + deltaX = point.pageX - this.pointX, + deltaY = point.pageY - this.pointY, + timestamp = utils.getTime(), + newX, newY, + absDistX, absDistY; + + this.pointX = point.pageX; + this.pointY = point.pageY; + + this.distX += deltaX; + this.distY += deltaY; + absDistX = Math.abs(this.distX); + absDistY = Math.abs(this.distY); + + // We need to move at least 10 pixels for the scrolling to initiate + if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) { + return; + } + + // If you are scrolling in one direction lock the other + if ( !this.directionLocked && !this.options.freeScroll ) { + if ( absDistX > absDistY + this.options.directionLockThreshold ) { + this.directionLocked = 'h'; // lock horizontally + } else if ( absDistY >= absDistX + this.options.directionLockThreshold ) { + this.directionLocked = 'v'; // lock vertically + } else { + this.directionLocked = 'n'; // no lock + } + } + + if ( this.directionLocked == 'h' ) { + if ( this.options.eventPassthrough == 'vertical' ) { + e.preventDefault(); + } else if ( this.options.eventPassthrough == 'horizontal' ) { + this.initiated = false; + return; + } + + deltaY = 0; + } else if ( this.directionLocked == 'v' ) { + if ( this.options.eventPassthrough == 'horizontal' ) { + e.preventDefault(); + } else if ( this.options.eventPassthrough == 'vertical' ) { + this.initiated = false; + return; + } + + deltaX = 0; + } + + deltaX = this.hasHorizontalScroll ? deltaX : 0; + deltaY = this.hasVerticalScroll ? deltaY : 0; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + // Slow down if outside of the boundaries + if ( newX > 0 || newX < this.maxScrollX ) { + newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX; + } + if ( newY > 0 || newY < this.maxScrollY ) { + newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY; + } + + this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0; + this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0; + + if ( !this.moved ) { + this._execEvent('scrollStart'); + } + + this.moved = true; + + this._translate(newX, newY); + +/* REPLACE START: _move */ + + if ( timestamp - this.startTime > 300 ) { + this.startTime = timestamp; + this.startX = this.x; + this.startY = this.y; + } + +/* REPLACE END: _move */ + + }, + + _end: function (e) { + if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { + return; + } + + if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) { + e.preventDefault(); + } + + var point = e.changedTouches ? e.changedTouches[0] : e, + momentumX, + momentumY, + duration = utils.getTime() - this.startTime, + newX = Math.round(this.x), + newY = Math.round(this.y), + distanceX = Math.abs(newX - this.startX), + distanceY = Math.abs(newY - this.startY), + time = 0, + easing = ''; + + this.isInTransition = 0; + this.initiated = 0; + this.endTime = utils.getTime(); + + // reset if we are outside of the boundaries + if ( this.resetPosition(this.options.bounceTime) ) { + return; + } + + this.scrollTo(newX, newY); // ensures that the last position is rounded + + // we scrolled less than 10 pixels + if ( !this.moved ) { + if ( this.options.tap ) { + utils.tap(e, this.options.tap); + } + + if ( this.options.click ) { + utils.click(e); + } + + this._execEvent('scrollCancel'); + return; + } + + if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) { + this._execEvent('flick'); + return; + } + + // start momentum animation if needed + if ( this.options.momentum && duration < 300 ) { + momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 }; + momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 }; + newX = momentumX.destination; + newY = momentumY.destination; + time = Math.max(momentumX.duration, momentumY.duration); + this.isInTransition = 1; + } + + + if ( this.options.snap ) { + var snap = this._nearestSnap(newX, newY); + this.currentPage = snap; + time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(newX - snap.x), 1000), + Math.min(Math.abs(newY - snap.y), 1000) + ), 300); + newX = snap.x; + newY = snap.y; + + this.directionX = 0; + this.directionY = 0; + easing = this.options.bounceEasing; + } + +// INSERT POINT: _end + + if ( newX != this.x || newY != this.y ) { + // change easing function when scroller goes out of the boundaries + if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) { + easing = utils.ease.quadratic; + } + + this.scrollTo(newX, newY, time, easing); + return; + } + + this._execEvent('scrollEnd'); + }, + + _resize: function () { + var that = this; + + clearTimeout(this.resizeTimeout); + + this.resizeTimeout = setTimeout(function () { + that.refresh(); + }, this.options.resizePolling); + }, + + resetPosition: function (time) { + var x = this.x, + y = this.y; + + time = time || 0; + + if ( !this.hasHorizontalScroll || this.x > 0 ) { + x = 0; + } else if ( this.x < this.maxScrollX ) { + x = this.maxScrollX; + } + + if ( !this.hasVerticalScroll || this.y > 0 ) { + y = 0; + } else if ( this.y < this.maxScrollY ) { + y = this.maxScrollY; + } + + if ( x == this.x && y == this.y ) { + return false; + } + + this.scrollTo(x, y, time, this.options.bounceEasing); + + return true; + }, + + disable: function () { + this.enabled = false; + }, + + enable: function () { + this.enabled = true; + }, + + refresh: function () { + var rf = this.wrapper.offsetHeight; // Force reflow + + this.wrapperWidth = this.wrapper.clientWidth; + this.wrapperHeight = this.wrapper.clientHeight; + +/* REPLACE START: refresh */ + + this.scrollerWidth = this.scroller.offsetWidth; + this.scrollerHeight = this.scroller.offsetHeight; + + this.maxScrollX = this.wrapperWidth - this.scrollerWidth; + this.maxScrollY = this.wrapperHeight - this.scrollerHeight; + +/* REPLACE END: refresh */ + + this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0; + this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0; + + if ( !this.hasHorizontalScroll ) { + this.maxScrollX = 0; + this.scrollerWidth = this.wrapperWidth; + } + + if ( !this.hasVerticalScroll ) { + this.maxScrollY = 0; + this.scrollerHeight = this.wrapperHeight; + } + + this.endTime = 0; + this.directionX = 0; + this.directionY = 0; + + this.wrapperOffset = utils.offset(this.wrapper); + + this._execEvent('refresh'); + + this.resetPosition(); + +// INSERT POINT: _refresh + + }, + + on: function (type, fn) { + if ( !this._events[type] ) { + this._events[type] = []; + } + + this._events[type].push(fn); + }, + + off: function (type, fn) { + if ( !this._events[type] ) { + return; + } + + var index = this._events[type].indexOf(fn); + + if ( index > -1 ) { + this._events[type].splice(index, 1); + } + }, + + _execEvent: function (type) { + if ( !this._events[type] ) { + return; + } + + var i = 0, + l = this._events[type].length; + + if ( !l ) { + return; + } + + for ( ; i < l; i++ ) { + this._events[type][i].apply(this, [].slice.call(arguments, 1)); + } + }, + + scrollBy: function (x, y, time, easing) { + x = this.x + x; + y = this.y + y; + time = time || 0; + + this.scrollTo(x, y, time, easing); + }, + + scrollTo: function (x, y, time, easing) { + easing = easing || utils.ease.circular; + + this.isInTransition = this.options.useTransition && time > 0; + + if ( !time || (this.options.useTransition && easing.style) ) { + this._transitionTimingFunction(easing.style); + this._transitionTime(time); + this._translate(x, y); + } else { + this._animate(x, y, time, easing.fn); + } + }, + + scrollToElement: function (el, time, offsetX, offsetY, easing) { + el = el.nodeType ? el : this.scroller.querySelector(el); + + if ( !el ) { + return; + } + + var pos = utils.offset(el); + + pos.left -= this.wrapperOffset.left; + pos.top -= this.wrapperOffset.top; + + // if offsetX/Y are true we center the element to the screen + if ( offsetX === true ) { + offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2); + } + if ( offsetY === true ) { + offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2); + } + + pos.left -= offsetX || 0; + pos.top -= offsetY || 0; + + pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left; + pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top; + + time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time; + + this.scrollTo(pos.left, pos.top, time, easing); + }, + + _transitionTime: function (time) { + time = time || 0; + + this.scrollerStyle[utils.style.transitionDuration] = time + 'ms'; + + if ( !time && utils.isBadAndroid ) { + this.scrollerStyle[utils.style.transitionDuration] = '0.001s'; + } + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].transitionTime(time); + } + } + + +// INSERT POINT: _transitionTime + + }, + + _transitionTimingFunction: function (easing) { + this.scrollerStyle[utils.style.transitionTimingFunction] = easing; + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].transitionTimingFunction(easing); + } + } + + +// INSERT POINT: _transitionTimingFunction + + }, + + _translate: function (x, y) { + if ( this.options.useTransform ) { + +/* REPLACE START: _translate */ + + this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ; + +/* REPLACE END: _translate */ + + } else { + x = Math.round(x); + y = Math.round(y); + this.scrollerStyle.left = x + 'px'; + this.scrollerStyle.top = y + 'px'; + } + + this.x = x; + this.y = y; + + + if ( this.indicators ) { + for ( var i = this.indicators.length; i--; ) { + this.indicators[i].updatePosition(); + } + } + + +// INSERT POINT: _translate + + }, + + _initEvents: function (remove) { + var eventType = remove ? utils.removeEvent : utils.addEvent, + target = this.options.bindToWrapper ? this.wrapper : window; + + eventType(window, 'orientationchange', this); + eventType(window, 'resize', this); + + if ( this.options.click ) { + eventType(this.wrapper, 'click', this, true); + } + + if ( !this.options.disableMouse ) { + eventType(this.wrapper, 'mousedown', this); + eventType(target, 'mousemove', this); + eventType(target, 'mousecancel', this); + eventType(target, 'mouseup', this); + } + + if ( utils.hasPointer && !this.options.disablePointer ) { + eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); + eventType(target, utils.prefixPointerEvent('pointermove'), this); + eventType(target, utils.prefixPointerEvent('pointercancel'), this); + eventType(target, utils.prefixPointerEvent('pointerup'), this); + } + + if ( utils.hasTouch && !this.options.disableTouch ) { + eventType(this.wrapper, 'touchstart', this); + eventType(target, 'touchmove', this); + eventType(target, 'touchcancel', this); + eventType(target, 'touchend', this); + } + + eventType(this.scroller, 'transitionend', this); + eventType(this.scroller, 'webkitTransitionEnd', this); + eventType(this.scroller, 'oTransitionEnd', this); + eventType(this.scroller, 'MSTransitionEnd', this); + }, + + getComputedPosition: function () { + var matrix = window.getComputedStyle(this.scroller, null), + x, y; + + if ( this.options.useTransform ) { + matrix = matrix[utils.style.transform].split(')')[0].split(', '); + x = +(matrix[12] || matrix[4]); + y = +(matrix[13] || matrix[5]); + } else { + x = +matrix.left.replace(/[^-\d.]/g, ''); + y = +matrix.top.replace(/[^-\d.]/g, ''); + } + + return { x: x, y: y }; + }, + + _initIndicators: function () { + var interactive = this.options.interactiveScrollbars, + customStyle = typeof this.options.scrollbars != 'string', + indicators = [], + indicator; + + var that = this; + + this.indicators = []; + + if ( this.options.scrollbars ) { + // Vertical scrollbar + if ( this.options.scrollY ) { + indicator = { + el: createDefaultScrollbar('v', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenX: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + + // Horizontal scrollbar + if ( this.options.scrollX ) { + indicator = { + el: createDefaultScrollbar('h', interactive, this.options.scrollbars), + interactive: interactive, + defaultScrollbars: true, + customStyle: customStyle, + resize: this.options.resizeScrollbars, + shrink: this.options.shrinkScrollbars, + fade: this.options.fadeScrollbars, + listenY: false + }; + + this.wrapper.appendChild(indicator.el); + indicators.push(indicator); + } + } + + if ( this.options.indicators ) { + // TODO: check concat compatibility + indicators = indicators.concat(this.options.indicators); + } + + for ( var i = indicators.length; i--; ) { + this.indicators.push( new Indicator(this, indicators[i]) ); + } + + // TODO: check if we can use array.map (wide compatibility and performance issues) + function _indicatorsMap (fn) { + for ( var i = that.indicators.length; i--; ) { + fn.call(that.indicators[i]); + } + } + + if ( this.options.fadeScrollbars ) { + this.on('scrollEnd', function () { + _indicatorsMap(function () { + this.fade(); + }); + }); + + this.on('scrollCancel', function () { + _indicatorsMap(function () { + this.fade(); + }); + }); + + this.on('scrollStart', function () { + _indicatorsMap(function () { + this.fade(1); + }); + }); + + this.on('beforeScrollStart', function () { + _indicatorsMap(function () { + this.fade(1, true); + }); + }); + } + + + this.on('refresh', function () { + _indicatorsMap(function () { + this.refresh(); + }); + }); + + this.on('destroy', function () { + _indicatorsMap(function () { + this.destroy(); + }); + + delete this.indicators; + }); + }, + + _initWheel: function () { + utils.addEvent(this.wrapper, 'wheel', this); + utils.addEvent(this.wrapper, 'mousewheel', this); + utils.addEvent(this.wrapper, 'DOMMouseScroll', this); + + this.on('destroy', function () { + utils.removeEvent(this.wrapper, 'wheel', this); + utils.removeEvent(this.wrapper, 'mousewheel', this); + utils.removeEvent(this.wrapper, 'DOMMouseScroll', this); + }); + }, + + _wheel: function (e) { + if ( !this.enabled ) { + return; + } + + e.preventDefault(); + e.stopPropagation(); + + var wheelDeltaX, wheelDeltaY, + newX, newY, + that = this; + + if ( this.wheelTimeout === undefined ) { + that._execEvent('scrollStart'); + } + + // Execute the scrollEnd event after 400ms the wheel stopped scrolling + clearTimeout(this.wheelTimeout); + this.wheelTimeout = setTimeout(function () { + that._execEvent('scrollEnd'); + that.wheelTimeout = undefined; + }, 400); + + if ( 'deltaX' in e ) { + wheelDeltaX = -e.deltaX; + wheelDeltaY = -e.deltaY; + } else if ( 'wheelDeltaX' in e ) { + wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed; + wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed; + } else if ( 'wheelDelta' in e ) { + wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed; + } else if ( 'detail' in e ) { + wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed; + } else { + return; + } + + wheelDeltaX *= this.options.invertWheelDirection; + wheelDeltaY *= this.options.invertWheelDirection; + + if ( !this.hasVerticalScroll ) { + wheelDeltaX = wheelDeltaY; + wheelDeltaY = 0; + } + + if ( this.options.snap ) { + newX = this.currentPage.pageX; + newY = this.currentPage.pageY; + + if ( wheelDeltaX > 0 ) { + newX--; + } else if ( wheelDeltaX < 0 ) { + newX++; + } + + if ( wheelDeltaY > 0 ) { + newY--; + } else if ( wheelDeltaY < 0 ) { + newY++; + } + + this.goToPage(newX, newY); + + return; + } + + newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0); + newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0); + + if ( newX > 0 ) { + newX = 0; + } else if ( newX < this.maxScrollX ) { + newX = this.maxScrollX; + } + + if ( newY > 0 ) { + newY = 0; + } else if ( newY < this.maxScrollY ) { + newY = this.maxScrollY; + } + + this.scrollTo(newX, newY, 0); + +// INSERT POINT: _wheel + }, + + _initSnap: function () { + this.currentPage = {}; + + if ( typeof this.options.snap == 'string' ) { + this.options.snap = this.scroller.querySelectorAll(this.options.snap); + } + + this.on('refresh', function () { + var i = 0, l, + m = 0, n, + cx, cy, + x = 0, y, + stepX = this.options.snapStepX || this.wrapperWidth, + stepY = this.options.snapStepY || this.wrapperHeight, + el; + + this.pages = []; + + if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) { + return; + } + + if ( this.options.snap === true ) { + cx = Math.round( stepX / 2 ); + cy = Math.round( stepY / 2 ); + + while ( x > -this.scrollerWidth ) { + this.pages[i] = []; + l = 0; + y = 0; + + while ( y > -this.scrollerHeight ) { + this.pages[i][l] = { + x: Math.max(x, this.maxScrollX), + y: Math.max(y, this.maxScrollY), + width: stepX, + height: stepY, + cx: x - cx, + cy: y - cy + }; + + y -= stepY; + l++; + } + + x -= stepX; + i++; + } + } else { + el = this.options.snap; + l = el.length; + n = -1; + + for ( ; i < l; i++ ) { + if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) { + m = 0; + n++; + } + + if ( !this.pages[m] ) { + this.pages[m] = []; + } + + x = Math.max(-el[i].offsetLeft, this.maxScrollX); + y = Math.max(-el[i].offsetTop, this.maxScrollY); + cx = x - Math.round(el[i].offsetWidth / 2); + cy = y - Math.round(el[i].offsetHeight / 2); + + this.pages[m][n] = { + x: x, + y: y, + width: el[i].offsetWidth, + height: el[i].offsetHeight, + cx: cx, + cy: cy + }; + + if ( x > this.maxScrollX ) { + m++; + } + } + } + + this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0); + + // Update snap threshold if needed + if ( this.options.snapThreshold % 1 === 0 ) { + this.snapThresholdX = this.options.snapThreshold; + this.snapThresholdY = this.options.snapThreshold; + } else { + this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold); + this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold); + } + }); + + this.on('flick', function () { + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.x - this.startX), 1000), + Math.min(Math.abs(this.y - this.startY), 1000) + ), 300); + + this.goToPage( + this.currentPage.pageX + this.directionX, + this.currentPage.pageY + this.directionY, + time + ); + }); + }, + + _nearestSnap: function (x, y) { + if ( !this.pages.length ) { + return { x: 0, y: 0, pageX: 0, pageY: 0 }; + } + + var i = 0, + l = this.pages.length, + m = 0; + + // Check if we exceeded the snap threshold + if ( Math.abs(x - this.absStartX) < this.snapThresholdX && + Math.abs(y - this.absStartY) < this.snapThresholdY ) { + return this.currentPage; + } + + if ( x > 0 ) { + x = 0; + } else if ( x < this.maxScrollX ) { + x = this.maxScrollX; + } + + if ( y > 0 ) { + y = 0; + } else if ( y < this.maxScrollY ) { + y = this.maxScrollY; + } + + for ( ; i < l; i++ ) { + if ( x >= this.pages[i][0].cx ) { + x = this.pages[i][0].x; + break; + } + } + + l = this.pages[i].length; + + for ( ; m < l; m++ ) { + if ( y >= this.pages[0][m].cy ) { + y = this.pages[0][m].y; + break; + } + } + + if ( i == this.currentPage.pageX ) { + i += this.directionX; + + if ( i < 0 ) { + i = 0; + } else if ( i >= this.pages.length ) { + i = this.pages.length - 1; + } + + x = this.pages[i][0].x; + } + + if ( m == this.currentPage.pageY ) { + m += this.directionY; + + if ( m < 0 ) { + m = 0; + } else if ( m >= this.pages[0].length ) { + m = this.pages[0].length - 1; + } + + y = this.pages[0][m].y; + } + + return { + x: x, + y: y, + pageX: i, + pageY: m + }; + }, + + goToPage: function (x, y, time, easing) { + easing = easing || this.options.bounceEasing; + + if ( x >= this.pages.length ) { + x = this.pages.length - 1; + } else if ( x < 0 ) { + x = 0; + } + + if ( y >= this.pages[x].length ) { + y = this.pages[x].length - 1; + } else if ( y < 0 ) { + y = 0; + } + + var posX = this.pages[x][y].x, + posY = this.pages[x][y].y; + + time = time === undefined ? this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(posX - this.x), 1000), + Math.min(Math.abs(posY - this.y), 1000) + ), 300) : time; + + this.currentPage = { + x: posX, + y: posY, + pageX: x, + pageY: y + }; + + this.scrollTo(posX, posY, time, easing); + }, + + next: function (time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x++; + + if ( x >= this.pages.length && this.hasVerticalScroll ) { + x = 0; + y++; + } + + this.goToPage(x, y, time, easing); + }, + + prev: function (time, easing) { + var x = this.currentPage.pageX, + y = this.currentPage.pageY; + + x--; + + if ( x < 0 && this.hasVerticalScroll ) { + x = 0; + y--; + } + + this.goToPage(x, y, time, easing); + }, + + _initKeys: function (e) { + // default key bindings + var keys = { + pageUp: 33, + pageDown: 34, + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40 + }; + var i; + + // if you give me characters I give you keycode + if ( typeof this.options.keyBindings == 'object' ) { + for ( i in this.options.keyBindings ) { + if ( typeof this.options.keyBindings[i] == 'string' ) { + this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0); + } + } + } else { + this.options.keyBindings = {}; + } + + for ( i in keys ) { + this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i]; + } + + utils.addEvent(window, 'keydown', this); + + this.on('destroy', function () { + utils.removeEvent(window, 'keydown', this); + }); + }, + + _key: function (e) { + if ( !this.enabled ) { + return; + } + + var snap = this.options.snap, // we are using this alot, better to cache it + newX = snap ? this.currentPage.pageX : this.x, + newY = snap ? this.currentPage.pageY : this.y, + now = utils.getTime(), + prevTime = this.keyTime || 0, + acceleration = 0.250, + pos; + + if ( this.options.useTransition && this.isInTransition ) { + pos = this.getComputedPosition(); + + this._translate(Math.round(pos.x), Math.round(pos.y)); + this.isInTransition = false; + } + + this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0; + + switch ( e.keyCode ) { + case this.options.keyBindings.pageUp: + if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { + newX += snap ? 1 : this.wrapperWidth; + } else { + newY += snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.pageDown: + if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) { + newX -= snap ? 1 : this.wrapperWidth; + } else { + newY -= snap ? 1 : this.wrapperHeight; + } + break; + case this.options.keyBindings.end: + newX = snap ? this.pages.length-1 : this.maxScrollX; + newY = snap ? this.pages[0].length-1 : this.maxScrollY; + break; + case this.options.keyBindings.home: + newX = 0; + newY = 0; + break; + case this.options.keyBindings.left: + newX += snap ? -1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.up: + newY += snap ? 1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.right: + newX -= snap ? -1 : 5 + this.keyAcceleration>>0; + break; + case this.options.keyBindings.down: + newY -= snap ? 1 : 5 + this.keyAcceleration>>0; + break; + default: + return; + } + + if ( snap ) { + this.goToPage(newX, newY); + return; + } + + if ( newX > 0 ) { + newX = 0; + this.keyAcceleration = 0; + } else if ( newX < this.maxScrollX ) { + newX = this.maxScrollX; + this.keyAcceleration = 0; + } + + if ( newY > 0 ) { + newY = 0; + this.keyAcceleration = 0; + } else if ( newY < this.maxScrollY ) { + newY = this.maxScrollY; + this.keyAcceleration = 0; + } + + this.scrollTo(newX, newY, 0); + + this.keyTime = now; + }, + + _animate: function (destX, destY, duration, easingFn) { + var that = this, + startX = this.x, + startY = this.y, + startTime = utils.getTime(), + destTime = startTime + duration; + + function step () { + var now = utils.getTime(), + newX, newY, + easing; + + if ( now >= destTime ) { + that.isAnimating = false; + that._translate(destX, destY); + + if ( !that.resetPosition(that.options.bounceTime) ) { + that._execEvent('scrollEnd'); + } + + return; + } + + now = ( now - startTime ) / duration; + easing = easingFn(now); + newX = ( destX - startX ) * easing + startX; + newY = ( destY - startY ) * easing + startY; + that._translate(newX, newY); + + if ( that.isAnimating ) { + rAF(step); + } + } + + this.isAnimating = true; + step(); + }, + handleEvent: function (e) { + switch ( e.type ) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + case 'orientationchange': + case 'resize': + this._resize(); + break; + case 'transitionend': + case 'webkitTransitionEnd': + case 'oTransitionEnd': + case 'MSTransitionEnd': + this._transitionEnd(e); + break; + case 'wheel': + case 'DOMMouseScroll': + case 'mousewheel': + this._wheel(e); + break; + case 'keydown': + this._key(e); + break; + case 'click': + if ( !e._constructed ) { + e.preventDefault(); + e.stopPropagation(); + } + break; + } + } +}; +function createDefaultScrollbar (direction, interactive, type) { + var scrollbar = document.createElement('div'), + indicator = document.createElement('div'); + + if ( type === true ) { + scrollbar.style.cssText = 'position:absolute;z-index:9999'; + indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px'; + } + + indicator.className = 'iScrollIndicator'; + + if ( direction == 'h' ) { + if ( type === true ) { + scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'; + indicator.style.height = '100%'; + } + scrollbar.className = 'iScrollHorizontalScrollbar'; + } else { + if ( type === true ) { + scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'; + indicator.style.width = '100%'; + } + scrollbar.className = 'iScrollVerticalScrollbar'; + } + + scrollbar.style.cssText += ';overflow:hidden'; + + if ( !interactive ) { + scrollbar.style.pointerEvents = 'none'; + } + + scrollbar.appendChild(indicator); + + return scrollbar; +} + +function Indicator (scroller, options) { + this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el; + this.wrapperStyle = this.wrapper.style; + this.indicator = this.wrapper.children[0]; + this.indicatorStyle = this.indicator.style; + this.scroller = scroller; + + this.options = { + listenX: true, + listenY: true, + interactive: false, + resize: true, + defaultScrollbars: false, + shrink: false, + fade: false, + speedRatioX: 0, + speedRatioY: 0 + }; + + for ( var i in options ) { + this.options[i] = options[i]; + } + + this.sizeRatioX = 1; + this.sizeRatioY = 1; + this.maxPosX = 0; + this.maxPosY = 0; + + if ( this.options.interactive ) { + if ( !this.options.disableTouch ) { + utils.addEvent(this.indicator, 'touchstart', this); + utils.addEvent(window, 'touchend', this); + } + if ( !this.options.disablePointer ) { + utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this); + } + if ( !this.options.disableMouse ) { + utils.addEvent(this.indicator, 'mousedown', this); + utils.addEvent(window, 'mouseup', this); + } + } + + if ( this.options.fade ) { + this.wrapperStyle[utils.style.transform] = this.scroller.translateZ; + this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms'; + this.wrapperStyle.opacity = '0'; + } +} + +Indicator.prototype = { + handleEvent: function (e) { + switch ( e.type ) { + case 'touchstart': + case 'pointerdown': + case 'MSPointerDown': + case 'mousedown': + this._start(e); + break; + case 'touchmove': + case 'pointermove': + case 'MSPointerMove': + case 'mousemove': + this._move(e); + break; + case 'touchend': + case 'pointerup': + case 'MSPointerUp': + case 'mouseup': + case 'touchcancel': + case 'pointercancel': + case 'MSPointerCancel': + case 'mousecancel': + this._end(e); + break; + } + }, + + destroy: function () { + if ( this.options.interactive ) { + utils.removeEvent(this.indicator, 'touchstart', this); + utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this); + utils.removeEvent(this.indicator, 'mousedown', this); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + utils.removeEvent(window, 'touchend', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this); + utils.removeEvent(window, 'mouseup', this); + } + + if ( this.options.defaultScrollbars ) { + this.wrapper.parentNode.removeChild(this.wrapper); + } + }, + + _start: function (e) { + var point = e.touches ? e.touches[0] : e; + + e.preventDefault(); + e.stopPropagation(); + + this.transitionTime(); + + this.initiated = true; + this.moved = false; + this.lastPointX = point.pageX; + this.lastPointY = point.pageY; + + this.startTime = utils.getTime(); + + if ( !this.options.disableTouch ) { + utils.addEvent(window, 'touchmove', this); + } + if ( !this.options.disablePointer ) { + utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this); + } + if ( !this.options.disableMouse ) { + utils.addEvent(window, 'mousemove', this); + } + + this.scroller._execEvent('beforeScrollStart'); + }, + + _move: function (e) { + var point = e.touches ? e.touches[0] : e, + deltaX, deltaY, + newX, newY, + timestamp = utils.getTime(); + + if ( !this.moved ) { + this.scroller._execEvent('scrollStart'); + } + + this.moved = true; + + deltaX = point.pageX - this.lastPointX; + this.lastPointX = point.pageX; + + deltaY = point.pageY - this.lastPointY; + this.lastPointY = point.pageY; + + newX = this.x + deltaX; + newY = this.y + deltaY; + + this._pos(newX, newY); + +// INSERT POINT: indicator._move + + e.preventDefault(); + e.stopPropagation(); + }, + + _end: function (e) { + if ( !this.initiated ) { + return; + } + + this.initiated = false; + + e.preventDefault(); + e.stopPropagation(); + + utils.removeEvent(window, 'touchmove', this); + utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this); + utils.removeEvent(window, 'mousemove', this); + + if ( this.scroller.options.snap ) { + var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y); + + var time = this.options.snapSpeed || Math.max( + Math.max( + Math.min(Math.abs(this.scroller.x - snap.x), 1000), + Math.min(Math.abs(this.scroller.y - snap.y), 1000) + ), 300); + + if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) { + this.scroller.directionX = 0; + this.scroller.directionY = 0; + this.scroller.currentPage = snap; + this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing); + } + } + + if ( this.moved ) { + this.scroller._execEvent('scrollEnd'); + } + }, + + transitionTime: function (time) { + time = time || 0; + this.indicatorStyle[utils.style.transitionDuration] = time + 'ms'; + + if ( !time && utils.isBadAndroid ) { + this.indicatorStyle[utils.style.transitionDuration] = '0.001s'; + } + }, + + transitionTimingFunction: function (easing) { + this.indicatorStyle[utils.style.transitionTimingFunction] = easing; + }, + + refresh: function () { + this.transitionTime(); + + if ( this.options.listenX && !this.options.listenY ) { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none'; + } else if ( this.options.listenY && !this.options.listenX ) { + this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none'; + } else { + this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'; + } + + if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) { + utils.addClass(this.wrapper, 'iScrollBothScrollbars'); + utils.removeClass(this.wrapper, 'iScrollLoneScrollbar'); + + if ( this.options.defaultScrollbars && this.options.customStyle ) { + if ( this.options.listenX ) { + this.wrapper.style.right = '8px'; + } else { + this.wrapper.style.bottom = '8px'; + } + } + } else { + utils.removeClass(this.wrapper, 'iScrollBothScrollbars'); + utils.addClass(this.wrapper, 'iScrollLoneScrollbar'); + + if ( this.options.defaultScrollbars && this.options.customStyle ) { + if ( this.options.listenX ) { + this.wrapper.style.right = '2px'; + } else { + this.wrapper.style.bottom = '2px'; + } + } + } + + var r = this.wrapper.offsetHeight; // force refresh + + if ( this.options.listenX ) { + this.wrapperWidth = this.wrapper.clientWidth; + if ( this.options.resize ) { + this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8); + this.indicatorStyle.width = this.indicatorWidth + 'px'; + } else { + this.indicatorWidth = this.indicator.clientWidth; + } + + this.maxPosX = this.wrapperWidth - this.indicatorWidth; + + if ( this.options.shrink == 'clip' ) { + this.minBoundaryX = -this.indicatorWidth + 8; + this.maxBoundaryX = this.wrapperWidth - 8; + } else { + this.minBoundaryX = 0; + this.maxBoundaryX = this.maxPosX; + } + + this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)); + } + + if ( this.options.listenY ) { + this.wrapperHeight = this.wrapper.clientHeight; + if ( this.options.resize ) { + this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8); + this.indicatorStyle.height = this.indicatorHeight + 'px'; + } else { + this.indicatorHeight = this.indicator.clientHeight; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + + if ( this.options.shrink == 'clip' ) { + this.minBoundaryY = -this.indicatorHeight + 8; + this.maxBoundaryY = this.wrapperHeight - 8; + } else { + this.minBoundaryY = 0; + this.maxBoundaryY = this.maxPosY; + } + + this.maxPosY = this.wrapperHeight - this.indicatorHeight; + this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)); + } + + this.updatePosition(); + }, + + updatePosition: function () { + var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0, + y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0; + + if ( !this.options.ignoreBoundaries ) { + if ( x < this.minBoundaryX ) { + if ( this.options.shrink == 'scale' ) { + this.width = Math.max(this.indicatorWidth + x, 8); + this.indicatorStyle.width = this.width + 'px'; + } + x = this.minBoundaryX; + } else if ( x > this.maxBoundaryX ) { + if ( this.options.shrink == 'scale' ) { + this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8); + this.indicatorStyle.width = this.width + 'px'; + x = this.maxPosX + this.indicatorWidth - this.width; + } else { + x = this.maxBoundaryX; + } + } else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) { + this.width = this.indicatorWidth; + this.indicatorStyle.width = this.width + 'px'; + } + + if ( y < this.minBoundaryY ) { + if ( this.options.shrink == 'scale' ) { + this.height = Math.max(this.indicatorHeight + y * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + } + y = this.minBoundaryY; + } else if ( y > this.maxBoundaryY ) { + if ( this.options.shrink == 'scale' ) { + this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8); + this.indicatorStyle.height = this.height + 'px'; + y = this.maxPosY + this.indicatorHeight - this.height; + } else { + y = this.maxBoundaryY; + } + } else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) { + this.height = this.indicatorHeight; + this.indicatorStyle.height = this.height + 'px'; + } + } + + this.x = x; + this.y = y; + + if ( this.scroller.options.useTransform ) { + this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ; + } else { + this.indicatorStyle.left = x + 'px'; + this.indicatorStyle.top = y + 'px'; + } + }, + + _pos: function (x, y) { + if ( x < 0 ) { + x = 0; + } else if ( x > this.maxPosX ) { + x = this.maxPosX; + } + + if ( y < 0 ) { + y = 0; + } else if ( y > this.maxPosY ) { + y = this.maxPosY; + } + + x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x; + y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y; + + this.scroller.scrollTo(x, y); + }, + + fade: function (val, hold) { + if ( hold && !this.visible ) { + return; + } + + clearTimeout(this.fadeTimeout); + this.fadeTimeout = null; + + var time = val ? 250 : 500, + delay = val ? 0 : 300; + + val = val ? '1' : '0'; + + this.wrapperStyle[utils.style.transitionDuration] = time + 'ms'; + + this.fadeTimeout = setTimeout((function (val) { + this.wrapperStyle.opacity = val; + this.visible = +val; + }).bind(this, val), delay); + } +}; + +IScroll.utils = utils; + +if ( typeof module != 'undefined' && module.exports ) { + module.exports = IScroll; +} else { + window.IScroll = IScroll; +} + +})(window, document, Math); \ No newline at end of file diff --git a/js/list.js b/js/list.js new file mode 100755 index 00000000..5d034c4b --- /dev/null +++ b/js/list.js @@ -0,0 +1,114 @@ +var list; +var toSend = ""; +var sendURL; +var myScroll; +var scroller = false; +var showToggle =true; +var chan = $("#chan").html(); + +function updateList() +{ + console.log("updating list"); + list = $.ajax({ type: "GET", + url: "php/change.php", + async: false + }).responseText; + list = $.parseJSON(list); + list[0].shift(); + list[3].shift(); + list[2].shift(); + + setTimeout(function() + { + + $("#wrapper").empty(); + + $.each(list[0], function(j, listeID){ + + var video_title=list[3][j].replace(/\\\'/, "'"); + var video_id = list[0][j]; + var video_thumb = "http://i.ytimg.com/vi/"+video_id+"/default.jpg"; + var odd = ""; if(j%2==0)odd=" oddlist"; + var finalhtml="
"+ + ""+ + "
"+video_title+"
"+ + "
"+list[2][j]+"+-
"+ + "
"; + $("#wrapper").append(finalhtml); + }); + if($("#playlist").height() > $("#player").height()) + { + if(!window.mobilecheck()) + { + $("#playlist").css({height: $("#player").height() - $("#buttons").height()-4}); + $("#playlist").css({overflow: "hidden"}); + if(scroller == false) + { + myScroll = new IScroll('#playlist', { + mouseWheel: true, + scrollbars: false, + scrollY: true, + interactiveScrollbars: false + }); + scroller = true; + }else + { + myScroll.refresh(); + } + } + } + if(window.mobilecheck()) + { + document.getElementById("player").style.display="none"; + ytplayer.pauseVideo(); + } + }, 2500); +} + +function vote(id, vote){ + console.log($.ajax({ + type: "GET", + url: "php/change.php", + async: false, + data: "vote="+vote+"&id="+id, + success: function() { + console.log("voted "+vote+" on "+id); + if(vote=="pos"){ $("#playlist").addClass("success");} + else{ $("#playlist").addClass("error");} + }, + }).responseText); + setTimeout(function(){ + $("#playlist").removeClass("success"); + $("#playlist").removeClass("error"); + },1500); +} + +function skip(){ + console.log($.ajax({ + type: "GET", + url: "php/change.php", + async: false, + data: "skip", + success: function() { + console.log("voted to skip song"); + $("#buttons").addClass("success"); + }, + }).responseText); + setTimeout(function(){ + $("#playlist").removeClass("success"); + },1500); +} + +function show(){ + if(showToggle){ + showToggle=false; + $("#toptitle").empty(); + $("#chan").addClass("bigChan"); + $("#chan").html("zoff.no/"+chan); + }else{ + showToggle=true; + $("#toptitle").html("Zöff"); + $("#chan").removeClass("bigChan"); + $("#chan").html(chan); + } +} \ No newline at end of file diff --git a/js/search.js b/js/search.js new file mode 100755 index 00000000..9c784971 --- /dev/null +++ b/js/search.js @@ -0,0 +1,95 @@ +$(document).ready(function() + { + + $("#search").focus(); + + $('#base').bind("keyup keypress", function(e) { + var code = e.keyCode || e.which; + if (code == 13) { + e.preventDefault(); + return false; + } + }); + var old_input=""; + $(".search_input").focus(); + setTimeout(function(){ + $(".search_input").keyup(function() + { + var search_input = $(this).val(); + if(search_input != old_input){ + old_input=search_input; + $("#results").html(''); + if(search_input != ""){ + var keyword= encodeURIComponent(search_input); + + var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=25&v=2&alt=jsonc'; + + + $.ajax({ + type: "GET", + url: yt_url, + dataType:"jsonp", + success: function(response) + { + if(response.data.items) + { + $.each(response.data.items, function(i,data) + { + if(data.duration > 720){return;} + var video_title=encodeURIComponent(data.title).replace(/'/g, "\\\'"); + var views=data.viewCount; + var video_thumb = "http://i.ytimg.com/vi/"+data.id+"/default.jpg"; + var length = Math.floor(data.duration/60)+":"+(data.duration-Math.floor(data.duration / 60)*60); + var finalhtml="
"+ + ""+ + "
"+data.title+""+ + ""+data.uploader+" • "+views+" views • "+length+"
"; + + $("#results").append(finalhtml); + + }); + + + } + else + { + $("#video").html("
No Video
"); + } + } + + }); + } + } + }); + }, 300); + }); + + function submit(id,title){ + console.log($.ajax({ + type: "GET", + url: "php/change.php", + async: false, + data: "v="+id+"&n="+title, + success: function() { + console.log("added "+id); + document.getElementById("search").value = ""; + $("#search").addClass("success"); + $("#results").html(''); + }, + error: function(){ + console.log("error in adding"); + document.getElementById("search").value = ""; + $("#search").addClass("error"); + $("#results").html(''); + } + }).responseText); + + $("#search").focus(); + + setTimeout(function(){ + $("#search").removeClass("success"); + $("#search").removeClass("error"); + },1500); + } + + // if(reply=="added"){$("#search").removeClass('success'); $("#search").addClass('success');} diff --git a/js/visualize.js b/js/visualize.js new file mode 100755 index 00000000..a8172e1c --- /dev/null +++ b/js/visualize.js @@ -0,0 +1,5 @@ +/*$(document).ready(function() +{ + context = new AudioContext(); + src = context.createMediaElementSource($('#player video')); +}*/ \ No newline at end of file diff --git a/js/youtube.js b/js/youtube.js new file mode 100755 index 00000000..e4731d60 --- /dev/null +++ b/js/youtube.js @@ -0,0 +1,292 @@ +/* +This is the youtube player sync and control file. + +Fetcher sangen som spilles fra JSON filen + +*/ + +var timeDifference; +var wasPaused; +var beginning; +var diffVideo; +var serverTime; +var url; +var response; +var url +var tag +var firstScriptTag; +var ytplayer; +var syncInterval; +var title; +var interval; +var viewers; +var changed = false; + +$(document).ready(function() +{ + window.mobilecheck = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); + return check; } + + updateList(); + timeDifference; + wasPaused = false; + beginning = true; + diffVideo = false; + interval = false; + response = $.ajax({ type: "GET", + url: "php/change.php", + async: false + }).responseText; + + url = $.parseJSON(response); + + $.ajax({ + type: 'get', + url: 'php/timedifference.php', + data: "abcde", + async: false, + success: function(data) { + timeDifference = $.parseJSON(data); + } + }); + console.log("timediff:"+timeDifference[0]); + + response = url[0][0]; + + tag = document.createElement('script'); + tag.src = "https://www.youtube.com/iframe_api"; + firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + if(window.mobilecheck()){ + syncInterval = setInterval(getTime, 50000); + listInterval = setInterval(updateList, 50000); + document.getElementById("search").blur(); + }else{ + syncInterval = setInterval(getTime, 5000); + listInterval = setInterval(updateList, 10000); + } +}); + +function onYouTubeIframeAPIReady() { + ytplayer = new YT.Player('player', { + height: window.height*0.75, + width: window.width*0.6, + videoId: response, + playerVars: { controls: "1" , iv_load_policy: "3", theme:"light", rel:"0", color:"white" }, + events: { + 'onReady': onPlayerReady, + 'onStateChange': onPlayerStateChange, + 'onError': errorHandler + } + }); +} + +/** + +Legger sangen inn i
en, via swfobject + + +var params = { allowScriptAccess: "always"}; +var atts = { id: "myytplayer" }; +swfobject.embedSWF("http://www.youtube.com/v/"+response+"?enablejsapi=1&playerapiid=ytplayer&version=3&controls=1&iv_load_policy=3", + "ytapiplayer", "825", "462", "8", null, null, params, atts); + + +eventlistener for når playeren endres +*/ +function onPlayerStateChange(newState) { + console.log("new state: "+newState.data); + console.log("beginning: "+beginning); + //ytplayer.seekTo(15); + if((newState.data == 0 && checkEnd()) || (newState.data == 1 && checkEnd())) + { + console.log("nummer 1"); + startNextSong(); + ytplayer.pauseVideo(); + wasPaused = false; + }else if(newState.data == 1 && (wasPaused && !beginning)) + { + console.log("unpaused"); + beginning = false; + wasPaused = false; + syncInterval = setInterval(getTime, 5000); + getTime(); + }else if(newState.data == 2) + { + clearInterval(syncInterval); + interval = true; + wasPaused = true; + beginning = false; + } +} + +function checkEnd() +{ + console.log("sjekker om brukeren spolte"); + $.ajax({ + type: 'get', + url: 'php/timedifference.php', + data: "abcde", + async: false, + success: function(data) { + timeDifference = $.parseJSON(data); + } + }); + if(parseInt(timeDifference[0]) > ytplayer.getDuration()) + { + return true; + } + return false; +} + +function startNextSong() +{ + + //console.log(getTime()); + if(checkEnd() && !changed) + { + setTimeout(function(){ + response = $.ajax({ + type: "POST", + url: "php/change.php", + async: false, + data: "thisUrl="+response+"&act=save", + + success: function() { + console.log("saved song-switch - "+response); + } + }).responseText; + + console.log("next video: "+response); + getTitle(response); + ytplayer.loadVideoById(response); + beginning = true; + + },2500); + updateList(); + changed = true + setTimeout(function() { + changed = false; + syncInterval = setInterval(getTime, 5000); + interval = true; + console.log("starter intervallen. Interval: " + interval); + }, 2500); + } + +} + +function getTime() +{ + console.log("utenfor if test" + wasPaused); + if(!wasPaused) + { + console.log("sjekker om brukeren spolte"); + + $.ajax({ + type: 'get', + url: 'php/timedifference.php', + data: "abcde", + async: false, + success: function(data) { + timeDifference = $.parseJSON(data); + } + }); + console.log("current song: "+response); + console.log("song in database: "+timeDifference[1]); + if(parseInt(timeDifference[2]) + 1> ytplayer.getCurrentTime() + parseInt(timeDifference[3]) && ytplayer.getPlayerState() == 0) + { + return true; + }else if(ytplayer.getCurrentTime() + parseInt(timeDifference[3]) > parseInt(timeDifference[2]) + 5 || (ytplayer.getCurrentTime() + parseInt(timeDifference[3]) < parseInt(timeDifference[2]) - 5 && ytplayer.getPlayerState() != 0 && ytplayer.getPlayerState() != 3)) + { + if(parseInt(timeDifference[0]) > ytplayer.getDuration()) + { + console.log("burde ikke søke, men hoppe til neste sang"); + } + ytplayer.seekTo(timeDifference[0]); + ytplayer.pauseVideo(); + ytplayer.playVideo(); + getTitle(); + return false; + } + //if(interval){syncInterval = setInterval(getTime, 5000);interval = false;} + + if(response != timeDifference[1]) + { + clearInterval(syncInterval); + console.log("forskjellige videoer!!"); + ytplayer.pauseVideo(); + ytplayer.loadVideoById(timeDifference[1]); + setTimeout(function(){ + //console.log(response); + diffVideo = true; + beginning = true; + $.ajax({ + type: "POST", + url: "php/change.php", + async: false, + data: "thisUrl=123abcprompeprompe&act=save", + success: function(data) + { + response = timeDifference[1]; + getTitle(); + } + }); + syncInterval = setInterval(getTime, 5000); + },2500); + } + } +} + +function getTitle() +{ + $.ajax({ type: "GET", + url: "php/timedifference.php", + async: false, + success: function(data) { + viewers = $.parseJSON(data); + var outPutWord = viewers[5] > 1 ? "viewers" : "viewer"; + var title= viewers[4].replace(/\\\'/, "'"); + document.title = viewers[4] + " • Zöff"; + document.getElementsByName('v')[0].placeholder = viewers[4] + " • " + viewers[5] + " " + outPutWord; + } + }); + +} + +function errorHandler(newState) +{ + setTimeout(function(){ + response = $.ajax({ + type: "POST", + url: "php/change.php", + async: false, + data: "thisUrl="+response+"&act=delete", + + success: function() { + console.log("error! deleted video"); + } + }).responseText; + ytplayer.loadVideoById(response); + },2500); +/* + setTimeout(function(){ + response = $.ajax({ type: "GET", + url: "change.php", + async: false + }).responseText; + var url = $.parseJSON(response); + response = url[0][0]; + + ytplayer.loadVideoById(response); + },2500);*/ +} +function onPlayerReady(event) { + //ytplayer = document.getElementById("myytplayer"); + // ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); + //ytplayer.addEventListener("onError", "errorHandler"); + getTime(); + ytplayer.playVideo(); + getTitle(); + } \ No newline at end of file diff --git a/lists/tritoen.json b/lists/tritoen.json index 330625e5..ea35f150 100755 --- a/lists/tritoen.json +++ b/lists/tritoen.json @@ -1 +1 @@ -[["GMoud3dub6U","tenz01ic1D8","byp94CCWKSI","87JabMupbB8","iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE","-1jPUB7gRyg","llyiQ4I-mcQ"],[1412934952],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)","Bodybangers Inc. - Kompani Linge 2012","LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)","Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!"],[1],[]] \ No newline at end of file +[["87JabMupbB8","iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE","-1jPUB7gRyg","llyiQ4I-mcQ","GMoud3dub6U","tenz01ic1D8","byp94CCWKSI"],[1412936400],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["Bodybangers Inc. - Kompani Linge 2012","LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)","Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!","\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)"],[2],[]] \ No newline at end of file diff --git a/php/admin.php b/php/admin.php new file mode 100644 index 00000000..1ddfbd7c --- /dev/null +++ b/php/admin.php @@ -0,0 +1,42 @@ + + + + + +
+
+ +
+ +

Admin Settingspanel

+ +
+
+
+
+
+
+ + + + + + +
+
+
+ + + \ No newline at end of file diff --git a/php/change.php b/php/change.php new file mode 100755 index 00000000..90dea4bf --- /dev/null +++ b/php/change.php @@ -0,0 +1,124 @@ += 0){ + + //print_r($i); + // echo "IIII: ",$i; + unset($data[3][$i]); + unset($data[0][$i]); + unset($data[2][$i]); + $underVote = array_search($votes-1, $data[2]); #nenennenenen feiiiiiiiiiiiiiiiiil + + if($underVote == 0)$underVote=1; + else if($underVote == false)$underVote=count($data[2]); + array_splice($data[3], $underVote, 0, array($name)); + array_splice($data[2], $underVote, 0, array($votes)); + array_splice($data[0], $underVote, 0, array($id)); + file_put_contents($list, json_encode($data)); + echo "Vote registrated. I hope"; + } +} +else if(isset($_GET['skip'])){ //skip song request + $viewers=$data[4][0]; + $skips=count($data[5]); + if(!in_array($guid, $data[5])){ + array_push($data[5], $guid); + $skips+=1; + $data[5][0]=$skips; + if($skips>=$viewers/2){ + nextSong(); + echo("skipped!"); + } + file_put_contents($list, json_encode($data)); + } + echo($skips."/".$viewers); + +} +else{ print($file); } + +function nextSong(){ + global $data; + array_push($data[0], $data[0][0]); + array_shift($data[0]); + + array_push($data[2], 0); //reset votes + array_shift($data[2]); + + array_push($data[3], $data[3][0]); + array_shift($data[3]); + + array_shift($data[4]); + array_push($data[4], 1); + + $data[5]=array(); + $data[1][0] = time(); +} +?> \ No newline at end of file diff --git a/php/convert_lists.php b/php/convert_lists.php new file mode 100644 index 00000000..c2ab167b --- /dev/null +++ b/php/convert_lists.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/php/header.php b/php/header.php new file mode 100644 index 00000000..cdf1087f --- /dev/null +++ b/php/header.php @@ -0,0 +1,6 @@ +Zöff + + + + + \ No newline at end of file diff --git a/php/index.html b/php/index.html new file mode 100644 index 00000000..e69de29b diff --git a/php/nochan.php b/php/nochan.php new file mode 100755 index 00000000..d25ea44e --- /dev/null +++ b/php/nochan.php @@ -0,0 +1,38 @@ + + +
Zöff
+
+ + + ";} ?> + +
+ +
+
+
Active Channels
+ ".urldecode($channel)."";} ?> +
+
+
+ + + + \ No newline at end of file diff --git a/php/timedifference.php b/php/timedifference.php new file mode 100755 index 00000000..4dd203d4 --- /dev/null +++ b/php/timedifference.php @@ -0,0 +1,13 @@ + diff --git a/php/videos.php b/php/videos.php new file mode 100755 index 00000000..63044cfa --- /dev/null +++ b/php/videos.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100755 index 0000000000000000000000000000000000000000..9d09876d5fa2612be161a338e32a14eb41935c0f GIT binary patch literal 34494 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 S{cm9r`8L;;?-`eAnD+l&v`N?i literal 0 HcmV?d00001 diff --git a/static/style.css b/static/style.css new file mode 100755 index 00000000..204bcc95 --- /dev/null +++ b/static/style.css @@ -0,0 +1,84 @@ +body{background:#FFF; margin:0;} +.top{ + font-family: 'Open Sans', sans-serif; font-weight: 300; text-align: center; + animation: fadein .5s; -moz-animation: fadein .5s; -webkit-animation: fadein .5s; -o-animation: fadein .5s; +} +.top, .top a{color:#ed207f; text-decoration: none;} +.vcent{position: relative; top: 50%; -webkit-transform: translateY(-50%);} + + +.innbox, .innbox a{ + width:90%; height: 50px; border-radius:7px; border:none; font-family: 'Open Sans', sans-serif; font-size: 25px; margin-bottom: 20px; + color:#f15; text-align: center;-webkit-transition:background 1s;-moz-transition:background 1s;-o-transition:background 1s; transition:background 1s; +} +.success{animation: fadecol 1.5s; -moz-animation: fadecol 1.5s; -webkit-animation: fadecol 1.5s; -o-animation: fadecol 1.5s;} +.error{animation: fadewrong 1.5s; -moz-animation: fadewrong 1.5s; -webkit-animation: fadewrong 1.5s; -o-animation: fadewrong 1.5s;} +.small{font-size: 5vw; color:#E2E2E2; display:block !important; text-decoration: none; } +/*.small:hover{color: #CCC;}*/ +.big{font-size:180vh; position:absolute; top:-50%; color:#330A00 !important; z-index:-1; width: 100%; overflow: hidden; display: none;} +.footer a{color:#696969; text-decoration: none;}.footer a:hover {color:#ed207f;} +.footer{font-size: 15px; position:absolute; width:99%;color:#c0c0c0 !important; margin-top: 0; word-spacing: 2px;} +.bottom{bottom:10px;} +#channels{width:40%; min-width: 300px; padding-top: 4%; font-size: 25px;} +.channel{padding: 7px; display: inline-block; font-weight: bold; color: #646464 !important;font-size: 18px;} +.channel:hover{color:#ed207f !important;} + + +.anim{transition: all .20s ease-in-out; -moz-transition: all .20s ease-in-out; -webkit-transition: all .20s ease-in-out;} +.chan{color:#CCC; cursor:pointer; display: inline;} +.bigchan{color: #ed207f; font-size: 10vw; padding-top: 25%;} + +#buttons{cursor: default; text-align: right;} +.skip{cursor: pointer; height: 25px; padding:8px 21px 0 0;} + +#results{position:absolute; background-color: white; font-size: 14px; width:90%; margin-left: 5%; margin-top:-5px; z-index: 1; font-family: sans-serif;} +.result{border-bottom:none; padding: 3px 0 3px 10%; text-align: left; height: 55px; cursor: pointer;} +.result:hover{background-color: #DDD;} +#title{ padding-left: 20%; padding-top:10px; max-width: 76%; color:#ed207f; height: 36px;} +.result_info{color:#888; font-size: 12px; float:right;} +.thumb{height: 40px; width:80px; float: left;} + + +.main{width:90%; margin: 0 auto 0 auto;} +.playlist{background-color: #DADADA; width:20%; margin-left: 0px; display: inline-block; font-size: 14px; border-radius: 3px; vertical-align: top; /*overflow: hidden;*/ height: calc(87% - 183px); border-bottom:solid #c9c9c9 4px;} +.lresult{padding:0; height: 60px; border-top: none; cursor: default; background-color: #DADADA;} +.lthumb{height: 60px; margin-right: 10px; display: inline;} +.ltitle{ color:#ed207f; overflow: hidden; height: 60px; } +.oddlist{background-color: #EEE;} + +.votes{float: right; position: relative; margin-top: -1.4em; padding:0 3 0 4; background-color: rgba(50,50,50,0.45); color:#000; border-radius: 1px;} +#plus, #minus {text-decoration: none; color:white; margin-left: 2px; padding-left: 3px; padding-right: 3px; } +#plus:hover,#minus:hover{background-color: #111;} + +#player{height: 68%; height: calc(87% - 183px); width: 78%; border-radius: 3px; border-bottom:solid #c9c9c9 4px;} +#playlist{} +.nomargin{padding: 0;margin:0;} + +@media (max-width: 1000px) { + #player{width: 100%; height:45%; margin-bottom: 20px;} + .playlist{width: 100%;} + .lresult{font-size: 40px; height: 90px; font-size: 50px;} + .votes{font-size: 42px; padding-right: 8px; height: 89px; line-height: 89px; padding-left: 20px; border-radius: 1px;} + .lthumb{height: 90px;} + #plus,#minus{padding-left: 24px; margin-left: 0; padding-right: 24px;} + #plus{border-right:solid 3px rgb(172, 172, 172);} + #search{text-align: left; height: 100px; font-size: 40px; border: solid 2px #ccc;} + #buttons{text-align: center; height: 80px;} + .skip{height: 50px;} + .vcent{ + top: inherit; + -webkit-transform: translateY(0%); + } + #title{ + font-size: 30px; + font-weight: bold; + overflow: hidden; + padding-left: 2%; + padding-top: 0; + } + .footer{font-size: 40px; margin-top: 150px;} +} + +@-webkit-keyframes fadein{from {opacity:0;}to{opacity:1;}}@keyframes fadein{from{opacity:0;}to{opacity:1;}}@-moz-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}} +@-webkit-keyframes fadecol{from {background-color:#00FF00;}to{background-color: #FFF;}}@keyframes fadecol{background-color: #00FF00;}to{background-color: #FFF;}}@-moz-keyframes fadecol{from{background-color: #00FF00;}to{background-color: #FFF;}}@-o-keyframes fadecol{background-color: #00FF00;}to{background-color: #FFF;}} +@-webkit-keyframes fadewrong{from {background-color:#FF0000;}to{background-color: #FFF;}}@keyframes fadewrong{background-color: #FF0000;}to{background-color: #FFF;}}@-moz-keyframes fadewrong{from{background-color: #FF0000;}to{background-color: #FFF;}}@-o-keyframes fadewrong{background-color: #FF0000;}to{background-color: #FFF;}} \ No newline at end of file From 55e27d0c50a6688e9c5bdd76a4090a3759dc855b Mon Sep 17 00:00:00 2001 From: "Nicolas A. Tonne" Date: Fri, 10 Oct 2014 14:09:26 +0200 Subject: [PATCH 3/3] Some perms --- lists/tritoen.json | 2 +- php/admin.php | 0 php/convert_lists.php | 0 php/header.php | 0 php/index.html | 0 setperms.sh | 1 + static/settings2.png | Bin 7 files changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 php/admin.php mode change 100644 => 100755 php/convert_lists.php mode change 100644 => 100755 php/header.php mode change 100644 => 100755 php/index.html create mode 100755 setperms.sh mode change 100644 => 100755 static/settings2.png diff --git a/lists/tritoen.json b/lists/tritoen.json index ea35f150..7b98c8d3 100755 --- a/lists/tritoen.json +++ b/lists/tritoen.json @@ -1 +1 @@ -[["87JabMupbB8","iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE","-1jPUB7gRyg","llyiQ4I-mcQ","GMoud3dub6U","tenz01ic1D8","byp94CCWKSI"],[1412936400],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["Bodybangers Inc. - Kompani Linge 2012","LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)","Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!","\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)"],[2],[]] \ No newline at end of file +[["iMP4BwvJSwo","_ovdm2yX4MA","2CGF_Z3yZAo","fIMz0nTp2sA","kHue-HaXXzg","cN-ZjkDBaX8","J_DV9b0x7v4","nI_MVldpxDQ","-N6O0xI3A2o","MXXRHpVed3M","Eo-KmOd3i7s","w15oWDh02K4","aZg2pEokcFw","bLLMPnPK0fU","afOH2SGDiK0","bESGLojNYSo","kTHNpusq654","LOZuxwVk7TU","CduA0TULnow","4fndeDfaWCg","ZyhrYis509A","ZKuOB1HGWMY","O1OTWCd40bc","cNvjKkXFBvU","Z7YrFLIyYIw","smwj7ISnwXM","cjEwjDvh_2c","7x3CCKaOlfU","qQ31INpjXX0","EpbjEttizy8","JjgU4EypX0w","Id7e-9WaxMc","5LILChvqUo4","TssyfiAWOrA","a_426RiwST8","si81bIoZRJQ","yzC4hFK5P3g","QzEwx4BoYI0","jRx5PrAlUdY","N6xoFhkthls","51Bpx63wkbA","rVeMiVU77wo","2A85xBaLYWc","mllXxyHTzfg","aHjpOzsQ9YI","4kjpZ_sPxzc","Qc9c12q3mrc","YlUKcNNmywk","6Cp6mKbRTQY","6_TtYYiKi_0","Pmv8aQKO6k0","ETfiUYij5UE","mpaPBCBjSVc","3O1_3zBUKM8","6l7J1i1OkKs","_t2TzJOyops","S8jhXmfdRFY","ChzbYiYHOUU","NRWUoDpo2fo","41WtJps5XqQ","lrsNeqANI3k","s8Qa2t71aFE","pt3PcA4UvPA","rQu6_Iv_-H0","HVVUXv1WaGE","-1jPUB7gRyg","llyiQ4I-mcQ","GMoud3dub6U","tenz01ic1D8","byp94CCWKSI","87JabMupbB8"],[1412942871],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["LMFAO - Sexy And I Know It (Mord Fustang Remix)","Avicii - Levels","Jason Derulo - Don\\'t Wanna Go Home (Official Video)","E-Type ft. Na Na - Life","Demi Lovato - Let It Go (from \\"Frozen\\") [Official]","\u00c5ge Aleksandersen - Fire Pils og en Pizza - Rockefeller, 03.2009. HQ.","CaramellDansen (Full Version + Lyrics)","Daddy DJ","Guy Sebastian - Like a Drum","Vengaboys - We\\'re Going to Ibiza!","\\'N Sync - Bye Bye Bye","Gigi D\\'Agostino - L\\'Amour Toujours ( Official Video )","H\u00f8vlerivisa","D.D.E. - Bondekn\u00f8l","dde vi ska f\u00e6st","Lady Gaga - Poker Face","Katy Perry - Hot N Cold","Britney Spears - Toxic","Britney Spears - Oops!...I Did It Again","Backstreet Boys - I Want It That Way","Aqua - Barbie Girl","Robert er du neger?","The Weeknd - Wicked Games (Explicit)","WEKEED - Wild Child","Tuuli - Do It Like A Dru [[WoW Parody]]","tribalistas ja sei namorar","Pelle Politibil Intro Sang","Peaches - Rosa Helikopter","Albatraoz - Albatraoz","David Guetta - Lovers On The Sun (Official Audio) ft Sam Martin","Ludacris - Move Bitch [Dirty]","Ellie Goulding - High For This (The Weeknd Cover)","Porter Robinson - Language (Official Video)","Maroon 5 - It Was Always You (Audio) SPEEDED UP VERSION","The Black Keys - Lonely Boy [Official Music Video]","Porter Robinson - Divinity ft. Amy Millan","\u304d\u3083\u308a\u30fc\u3071\u307f\u3085\u3071\u307f\u3085 - PONPONPON , Kyary Pamyu Pamyu - PONPONPON","Kyla La Grange - Cut Your Teeth (Kygo Remix)","O-Zone - Dragostea Din Tei (Ultra Music)","Datarock - Fa Fa Fa [Official Music Video]","R\u00f6yksopp - Happy Up Here [Official Music Video]","alt-J (\u2206) Breezeblocks","The Weeknd - Wicked Games (LYRICS)","The Hobbit: The Desolation of Smaug - Ed Sheeran \\"I See Fire\\" [HD]","Crystallize - Lindsey Stirling (Dubstep Violin Original Song)","Lemaitre - Cut to Black (Official)","Avicii - Addicted To You","Red Hot Chili Peppers - Californication [Official Music Video]","Avicii - Hey Brother","Lemaitre - Fiction (Official Video)","twenty one pilots: Guns For Hands [OFFICIAL VIDEO]","Biggie Smalls feat. Thomas the Tank Engine","The Black Keys - Tighten Up [Official Music Video]","Naughty Boy - La La La ft. Sam Smith","YG - My Nigga (Remix) (Explicit) ft. Lil Wayne, Rich Homie Quan, Meek Mill, Nicki Minaj","Skrillex - Ruffneck - FULL Flex [Music Video]","Otto Knows - Million Voices","Tim Berg - Bromance (Aviciis Arena Mix) (Official Video HD)","alt-J - Left Hand Free (Official Video) 1","Ms Mr - Hurricane (CHVRCHES Remix)","Hermione Mix | Pogo & Jeesh","Zedd - Shave It (Original Mix)","GTA 5 Official Trailer Song\/Music - \\"Sleepwalking\\" by The Chain Gang of 1974 (Full GTA V Song)","Zedd - Dovregubben (Original Mix)","Hedegaard - Happy Home (Matoma Official Remix)","Aqua - Doctor Jones","Vengaboys - Boom, Boom, Boom, Boom!!","\u00c5ge Aleksandersen - Levva Livet","Avicii - Levels","Jason Derulo - \\"The Other Side\\" (Official HD Music Video)","Bodybangers Inc. - Kompani Linge 2012"],[1],[]] \ No newline at end of file diff --git a/php/admin.php b/php/admin.php old mode 100644 new mode 100755 diff --git a/php/convert_lists.php b/php/convert_lists.php old mode 100644 new mode 100755 diff --git a/php/header.php b/php/header.php old mode 100644 new mode 100755 diff --git a/php/index.html b/php/index.html old mode 100644 new mode 100755 diff --git a/setperms.sh b/setperms.sh new file mode 100755 index 00000000..d61d86da --- /dev/null +++ b/setperms.sh @@ -0,0 +1 @@ +sudo chmod -R ugo+rwx . \ No newline at end of file diff --git a/static/settings2.png b/static/settings2.png old mode 100644 new mode 100755