jenkins-bot has submitted this change and it was merged. Change subject: Update overthrow.js to 1.2.0 ......................................................................
Update overthrow.js to 1.2.0 Change-Id: I706471661ea7453a618eb5567c678caa5b22c08d --- M js/overthrow.js 1 file changed, 19 insertions(+), 115 deletions(-) Approvals: Paladox: Looks good to me, approved jenkins-bot: Verified diff --git a/js/overthrow.js b/js/overthrow.js index d54e6a7..13606fd 100644 --- a/js/overthrow.js +++ b/js/overthrow.js @@ -1,5 +1,5 @@ -/*! overthrow - An overflow:auto polyfill for responsive design. - v0.7.0 - 2014-04-11 -* Copyright (c) 2014 Scott Jehl, Filament Group, Inc.; Licensed MIT */ +/*! overthrow - An overflow:auto polyfill for responsive design. - v1.2.0 - 2016-08-21 +* Copyright (c) 2016 Scott Jehl, Filament Group, Inc.; Licensed MIT */ /*! Overthrow. An overflow:auto polyfill for responsive design. (c) 2012: Scott Jehl, Filament Group, Inc. http://filamentgroup.github.com/Overthrow/license.txt */ (function( w, undefined ){ @@ -95,126 +95,30 @@ })( this ); /*! Overthrow. An overflow:auto polyfill for responsive design. (c) 2012: Scott Jehl, Filament Group, Inc. http://filamentgroup.github.com/Overthrow/license.txt */ -(function( w, o, undefined ){ +/* overthrow.toss simply retains the overthrow.toss api by pulling in the external toss dependency and borring its methods */ +(function( w, t, undefined ){ - // o is overthrow reference from overthrow-polyfill.js - if( o === undefined ){ + // t is a reference to the external toss dependency + if( t === undefined ){ return; } - // Easing can use any of Robert Penner's equations (http://www.robertpenner.com/easing_terms_of_use.html). By default, overthrow includes ease-out-cubic - // arguments: t = current iteration, b = initial value, c = end value, d = total iterations - // use w.overthrow.easing to provide a custom function externally, or pass an easing function as a callback to the toss method - o.easing = function (t, b, c, d) { - return c*((t=t/d-1)*t*t + 1) + b; - }; + // w.overthrow is overthrow reference from overthrow-polyfill.js + if( w.overthrow === undefined ){ + w.overthrow = {}; + } - // tossing property is true during a programatic scroll - o.tossing = false; - - // Keeper of intervals - var timeKeeper; - - /* toss scrolls and element with easing - - // elem is the element to scroll - // options hash: - * left is the desired horizontal scroll. Default is "+0". For relative distances, pass a string with "+" or "-" in front. - * top is the desired vertical scroll. Default is "+0". For relative distances, pass a string with "+" or "-" in front. - * duration is the number of milliseconds the throw will take. Default is 100. - * easing is an optional custom easing function. Default is w.overthrow.easing. Must follow the easing function signature - - */ - o.toss = function( elem, options ){ - o.intercept(); - var i = 0, - sLeft = elem.scrollLeft, - sTop = elem.scrollTop, - // Toss defaults - op = { - top: "+0", - left: "+0", - duration: 50, - easing: o.easing, - finished: function() {} - }, - endLeft, endTop, finished = false; - - // Mixin based on predefined defaults - if( options ){ - for( var j in op ){ - if( options[ j ] !== undefined ){ - op[ j ] = options[ j ]; - } + w.overthrow.toss = t; + w.overthrow.easing = t.easing; + w.overthrow.tossing = t.tossing; + w.overthrow.intercept = function( elem ){ + if( !elem ){ + return; } - } + w.overthrow.tossing( elem, false ); + }; - // Convert relative values to ints - // First the left val - if( typeof op.left === "string" ){ - op.left = parseFloat( op.left ); - endLeft = op.left + sLeft; - } - else { - endLeft = op.left; - op.left = op.left - sLeft; - } - // Then the top val - if( typeof op.top === "string" ){ - - op.top = parseFloat( op.top ); - endTop = op.top + sTop; - } - else { - endTop = op.top; - op.top = op.top - sTop; - } - - o.tossing = true; - timeKeeper = setInterval(function(){ - if( i++ < op.duration ){ - elem.scrollLeft = op.easing( i, sLeft, op.left, op.duration ); - elem.scrollTop = op.easing( i, sTop, op.top, op.duration ); - } - else{ - if( endLeft !== elem.scrollLeft ){ - elem.scrollLeft = endLeft; - } else { - // if the end of the vertical scrolling has taken place - // we know that we're done here call the callback - // otherwise signal that horizontal scrolling is complete - if( finished ) { - op.finished(); - } - finished = true; - } - - if( endTop !== elem.scrollTop ){ - elem.scrollTop = endTop; - } else { - // if the end of the horizontal scrolling has taken place - // we know that we're done here call the callback - if( finished ) { - op.finished(); - } - finished = true; - } - - o.intercept(); - } - }, 1 ); - - // Return the values, post-mixin, with end values specified - return { top: endTop, left: endLeft, duration: o.duration, easing: o.easing }; - }; - - // Intercept any throw in progress - o.intercept = function(){ - clearInterval( timeKeeper ); - o.tossing = false; - }; - -})( this, this.overthrow ); +})( this, this.toss ); /*! Overthrow. An overflow:auto polyfill for responsive design. (c) 2012: Scott Jehl, Filament Group, Inc. http://filamentgroup.github.com/Overthrow/license.txt */ (function( w, o, undefined ){ -- To view, visit https://gerrit.wikimedia.org/r/305876 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I706471661ea7453a618eb5567c678caa5b22c08d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Metrolook Gerrit-Branch: master Gerrit-Owner: Paladox <[email protected]> Gerrit-Reviewer: Paladox <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
