Consistent code style
This commit is contained in:
parent
0f449f8d33
commit
fffc98babc
36
shower.js
36
shower.js
|
@ -72,7 +72,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* number which been shown.
|
* number which been shown.
|
||||||
* @returns {number|false}
|
* @returns {number|false}
|
||||||
*/
|
*/
|
||||||
shower.next = function () {
|
shower.next = function() {
|
||||||
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* number which been shown.
|
* number which been shown.
|
||||||
* @returns {number|false}
|
* @returns {number|false}
|
||||||
*/
|
*/
|
||||||
shower.previous = function () {
|
shower.previous = function() {
|
||||||
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
shower._isNumber = function(arg) {
|
shower._isNumber = function(arg) {
|
||||||
if(! ( ! isNaN(parseFloat(arg)) && isFinite(arg))) {
|
if ( ! ( ! isNaN(parseFloat(arg)) && isFinite(arg))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,11 +206,11 @@ window.shower = (function(window, document, undefined) {
|
||||||
var currentSlide,
|
var currentSlide,
|
||||||
ret;
|
ret;
|
||||||
|
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! shower.isListMode()) {
|
if ( ! shower.isListMode()) {
|
||||||
throw new Error('You can\'t to scroll cause you in slide mode. Please, switch to list mode.');
|
throw new Error('You can\'t to scroll cause you in slide mode. Please, switch to list mode.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
shower._normalizeSlideNumber = function(slideNumber) {
|
shower._normalizeSlideNumber = function(slideNumber) {
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
|
|
||||||
slideNumber = shower._normalizeSlideNumber(slideNumber);
|
slideNumber = shower._normalizeSlideNumber(slideNumber);
|
||||||
|
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
shower.getSlideHash = function(slideNumber) {
|
shower.getSlideHash = function(slideNumber) {
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
shower.go = function(slideNumber) {
|
shower.go = function(slideNumber) {
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
shower.runSlideshowIfPresented = function(slideNumber) {
|
shower.runSlideshowIfPresented = function(slideNumber) {
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
node,
|
node,
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
if( ! shower._isNumber(slideNumber)) {
|
if ( ! shower._isNumber(slideNumber)) {
|
||||||
throw new Error('Gimme slide number as number, baby!');
|
throw new Error('Gimme slide number as number, baby!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function () {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
if ( ! shower.isListMode()) {
|
if ( ! shower.isListMode()) {
|
||||||
// "?full" is present without slide hash, so we should display first slide
|
// "?full" is present without slide hash, so we should display first slide
|
||||||
if (-1 === shower.getCurrentSlideNumber()) {
|
if (-1 === shower.getCurrentSlideNumber()) {
|
||||||
|
@ -507,7 +507,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
window.addEventListener('popstate', function (e) {
|
window.addEventListener('popstate', function(e) {
|
||||||
if (shower.isListMode()) {
|
if (shower.isListMode()) {
|
||||||
shower.enterListMode();
|
shower.enterListMode();
|
||||||
shower.scrollToSlide(shower.getCurrentSlideNumber());
|
shower.scrollToSlide(shower.getCurrentSlideNumber());
|
||||||
|
@ -516,13 +516,13 @@ window.shower = (function(window, document, undefined) {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
window.addEventListener('resize', function (e) {
|
window.addEventListener('resize', function(e) {
|
||||||
if ( ! shower.isListMode()) {
|
if ( ! shower.isListMode()) {
|
||||||
shower._applyTransform(shower._getTransform());
|
shower._applyTransform(shower._getTransform());
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
document.addEventListener('keydown', function (e) {
|
document.addEventListener('keydown', function(e) {
|
||||||
// Shortcut for alt, ctrl and meta keys
|
// Shortcut for alt, ctrl and meta keys
|
||||||
if (e.altKey || e.ctrlKey || e.metaKey) { return; }
|
if (e.altKey || e.ctrlKey || e.metaKey) { return; }
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
document.addEventListener('click', shower._dispatchSingleSlideMode, false);
|
document.addEventListener('click', shower._dispatchSingleSlideMode, false);
|
||||||
document.addEventListener('touchend', shower._dispatchSingleSlideMode, false);
|
document.addEventListener('touchend', shower._dispatchSingleSlideMode, false);
|
||||||
|
|
||||||
document.addEventListener('touchstart', function (e) {
|
document.addEventListener('touchstart', function(e) {
|
||||||
if ( ! shower.isListMode()) {
|
if ( ! shower.isListMode()) {
|
||||||
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
var currentSlideNumber = shower.getCurrentSlideNumber(),
|
||||||
x = e.touches[0].pageX;
|
x = e.touches[0].pageX;
|
||||||
|
@ -662,7 +662,7 @@ window.shower = (function(window, document, undefined) {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
document.addEventListener('touchmove', function (e) {
|
document.addEventListener('touchmove', function(e) {
|
||||||
if ( ! shower.isListMode()) {
|
if ( ! shower.isListMode()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue