better scrolling on ios, actually everywhere

This commit is contained in:
Wouter van Wijk 2013-02-25 11:38:55 +01:00
parent 79bf895c49
commit d24d1b9728
14 changed files with 3875 additions and 3375 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
/*******************************************
Default Pull-up and Pull-down styling
Replace/modify/override to your preferences
*******************************************/
.iscroll-pullup {
/* The wrapper is position:relative or position:absolute, so the pullUp is positioned here
relative to the scroller, not the page. If we don't do this, the pullUp will initially
appear briefly at the bottom of content if content is shorter than the wrapper.
*/
position: absolute; /* relative to the scroller */
bottom: 0; /* at the bottom of the scroller */
width: 100%;
}
.iscroll-pulldown,
.iscroll-pullup {
background: #fff;
height: 40px;
line-height: 40px; /* Center text vertically */
font-weight: bold;
font-size: 14px;
color: #888;
}
/* MSIE not supported by iScroll, so not MSIE transitions or animation */
.iscroll-pulldown .iscroll-pull-icon,
.iscroll-pullup .iscroll-pull-icon {
margin-left: 0.5em;
display: block;
float: left;
width: 40px;
height: 40px;
background: url(iscroll-pull-icon@2x.png) 0 0 no-repeat;
-webkit-background-size: 40px 80px;
-moz-background-size: 40px 80px;
-o-background-size: 40px 80px;
background-size: 40px 80px;
-webkit-transition: -webkit-transform 250ms linear;
-moz-transition: -moz-transform 250ms linear;
-o-transition: -o-transform 250ms linear;
transition: transform 250ms linear;
}
/* Note that translateZ(0) triggers hardware acceleration on WebKit browsers
Acceleration is automatic on Mozilla */
.iscroll-pulldown .iscroll-pull-icon {
-webkit-transform: rotate(0deg) translateZ(0);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg) translateZ(0);
}
.iscroll-pullup .iscroll-pull-icon {
-webkit-transform: rotate(-180deg) translateZ(0);
-moz-transform: rotate(-180deg);
-o-transform: rotate(-180deg);
transform: rotate(-180deg) translateZ(0);
}
.iscroll-pulldown.iscroll-pull-pulled .iscroll-pull-icon {
-webkit-transform: rotate(-180deg) translateZ(0);
-moz-transform: rotate(-180deg);
-o-transform: rotate(-180deg);
transform: rotate(-180deg) translateZ(0);
}
.iscroll-pullup.iscroll-pull-pulled .iscroll-pull-icon {
-webkit-transform: rotate(0deg) translateZ(0);
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg) translateZ(0);
}
.iscroll-pulldown.iscroll-pull-loading .iscroll-pull-icon,
.iscroll-pullup.iscroll-pull-loading .iscroll-pull-icon {
background-position: 0 100%;
-webkit-transform: rotate(0deg) translateZ(0);
-webkit-transition-duration: 0ms;
-webkit-animation: iscroll-pull-loading 2s infinite linear;
-moz-transform: rotate(0deg);
-moz-transition-duration: 0ms;
-moz-animation: iscroll-pull-loading 2s infinite linear;
-o-transform: rotate(0deg);
-o-transition-duration: 0ms;
-o-animation: iscroll-pull-loading 2s infinite linear; /* Opera 12+ only */
transform: rotate(0deg) translateZ(0);
transition: transform 0ms linear;
animation: iscroll-pull-loading 2s infinite linear;
}
@-webkit-keyframes iscroll-pull-loading {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
@-moz-keyframes iscroll-pull-loading {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
@-o-keyframes iscroll-pull-loading {
from { -o-transform: rotate(0deg); }
to { -o-transform: rotate(360deg); }
}
@-keyframes iscroll-pull-loading {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

View File

@ -0,0 +1,72 @@
/* The widget adds some styling that needs to be computed at run-time (min-height of scroller
* content so that pull-up will be hidden, and scroller margin transferred from wrapper padding.)
* All styles that are added staticly are added through this stylesheet, for maximum flexibility
*
* The widget adds these styles to page elements when it is constructed, and removes them when
* it is destroyed. The styling itself is added by this style sheet. So, any styles added here
* will be removed when the widget is destroyed. (For example, if you call "destroy" on the widget.)
*/
/* The iscroll-page style is added to the page when the first iscrollview widget is created
* on the page, and removed when the last iscrollview widget on the page is destroyed.
*/
.iscroll-page {
/* Add any styles that you want on pages that use iScroll */
}
/* The wrapper is the element that contains the scroller. In the most typical usage, this
* is .ui-content, but could be any element. */
.iscroll-wrapper {
min-height: 0; /* Override any min-height, for example, in case a background image is
used on ui-content div used as wrapper. */
/* The wrapper needs to be positioned relative or absolute for proper positioning of the
scrollbar with iscroll4 default styling of the scrollbar. Either relative or absolute on the
wrapper will cause the absolute positioning of the scrollbar in iScroll to be relative to
the wrapper. */
position: relative;
/* iScroll examples all show the z-index of the wrapper raised to 1 (default is 0). There may
be an issue related to touch/click that this solves on specific platforms or depending on
the ordering of elements in the HTML source if elements are fixed positioned.
This would make sure that the wrapper sees click before underlying content. '
Howver, raising the wrapper Z-index creates a serious problem on page transitions on
iPhone, so I don't use it here. */
}
/* The scroller is the element that contains the elements that are scrolled. The height of this
* element is typically longer than the wrapper. (It's the stuff that we scroll.) The widget
* creates this element for you. It wraps all of the children of the wrapper.
*/
.iscroll-scroller {
/* Add any styles that you want to add to scrollers */
}
/* The "fixed" elements are the elements that are outside of the wrapper. The widget will
* set headers and footers to this style, as well as any element that has a data-iscroll-fixed
* attribute. The widget adds-up the height of these elements when it sizes the wrapper.
*/
.iscroll-fixed {
/* One often sees headers/footers/etc. raised to a z-index of 1000 in iScroll examples. This
is probably because the scroll bar has been mis-placed, and raising the z-index of the
header/footer masks the problem. I don't do it here. */
/* Add any styles that you want to add to fixed elements */
}
/* iscroll-content is the content that is scrolled - NOT including any pull-down and pull-up
* element, and also not including a special placeholder element used when there is a pull-up.
*/
.iscroll-content {
/* Add any styles that you want to add to iscroll content */
}
/* Note on scrollbar styles: iscroll4 adds inline CSS to the scrollbar when it creates it.
It sets the z-index to 100 and positions it relative to the wrapper, at the right edge of
the wrapper. If you want to override this behaviour, set the scrollBarClass option, and then
style that class as you please */
/* See jquery.mobile.iscroll-pulldown.css for styling of pull-down and pull-up elements */

View File

@ -55,7 +55,6 @@
overflow-y: scroll;
overflow-x: hidden;
}
}
/* tablet etc */
@ -110,9 +109,11 @@
#btcontrols {
display: block;
}
.scroll {
#playlistspane, .scroll {
overflow-y: auto;
overflow-x: auto;
width: 100%;
heigth: 100%;
}
}
@ -121,6 +122,12 @@
.header-breakpoint.ui-grid-b .ui-block-c {
display: none;
}
#playlistspane, .scroll {
overflow-y: auto;
overflow-x: auto;
width: 100%;
heigth: 100%;
}
}
/***********
@ -256,7 +263,7 @@
}
#playlistspane {
padding: 2px;
padding: 4px;
}
#artistviewimage, #albumviewcover {
@ -268,6 +275,12 @@
* listviews
********************/
#playlistslist, #playlisttracks {
margin: 0 !important;
padding: 0 !important;
/* border: 1px solid blue; */
}
.ui-li-divider {
padding: 2px;
padding-top: 10px;

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="css/jquery.mobile-1.3.0-rc.1.css" />
<script src="js/jquery-1.8.3.js"></script>
<script type='application/javascript' src='js/fastclick.js'></script>
@ -30,7 +30,7 @@
<meta name="author" content="Wouter van Wijk">
<meta name="copyright" content="(c) 2012-2013 Wouter van Wijk" />
<link href="css/ws.css" rel="stylesheet">
<script type="text/javascript" src="/mopidy/mopidy.js"></script>
<link href="css/jquery.mobile.iscrollview.css" rel="stylesheet">
<!-- <link rel="stylesheet" href="css/add2home.css"> -->
</head>
@ -119,7 +119,7 @@
</div><!-- /header -->
<div data-role="content" id="playlistspane" class="pane ui-grid-a pl-breakpoint">
<div class="ui-block-a scroll">
<div class="ui-block-a scroll" id="playlistslistdiv">
<ul id="playlistslist" data-icon="false" data-inset="true" data-role="listview"></ul>
</div>
<div class="ui-block-b scroll" id="playlisttracksdiv">
@ -198,6 +198,9 @@
</div>
<!-- content -->
</div><!-- /page one -->
<script type="text/javascript" src="/mopidy/mopidy.js"></script>
<script type="text/javascript" src="js/iscroll-lite.js"></script>
<!-- <script type="text/javascript" src="js/jquery.mobile.iscrollview-closure-min.js"></script> -->
<script src="js/jquery.truncate.min.js"></script>
<!-- <script type="text/javascript" src="js/add2home.js" charset="utf-8"></script> -->

View File

@ -35,12 +35,18 @@ var songname = '';
var songdata = '';
var newposition = 0;
var playlisttracksScroll;
var playlistslistScroll;
//array of cached playlists (not only user-playlists, also search, artist, album-playlists)
var playlists = {};
var currentplaylist;
var customPlaylists = [];
var customTracklists = [];
var ua = navigator.userAgent,
isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua);
//constants
PROGRAM_NAME = 'MusicBox';
//PROGRAM_NAME = 'Mopidy';

View File

@ -23,7 +23,7 @@ function resetSong() {
function expandSonginfo() {
}
function resizeSonginfo() {
function resizeMb() {
$("#infoname").html(songdata.name);
$("#infoartist").html(artiststext);
//bug in truncate?
@ -41,6 +41,43 @@ function resizeSonginfo() {
multiline : false
});
$("#infoartist").html('<a href="#controlsmodal" data-rel="popup">' + $("#infoartist").html() + '</a>');
//initialize iScroll if MobileWebkit and large window
if (isMobileWebkit) {
if ($(window).width() > 480) {
if (!playlistslistScroll) {
playlistslistScroll = new iScroll('playlistslistdiv');
playlisttracksScroll = new iScroll('playlisttracksdiv');
}
} else {
if (playlistslistScroll) {
playlistslistScroll.destroy();
playlistslistScroll = null;
playlisttracksScroll.destroy();
playlisttracksScroll = null;
}
}
}
//set height of playlist scrollers
if ($(window).width() > 480) {
$('.scroll').height($(window).height() - 104);
//jqm added something which it shouldnt (at least in this case) I guess
// $('#playlistspane').removeClass('height').height($(window).height() - 110);
$('.scroll').removeClass('height').removeClass('width');
$('#playlistspane').removeClass('height').removeClass('width');
} else {
$('.scroll').addClass('height', '100%').addClass('width', '100%');
$('#playlistspane').addClass('height', '100%').addClass('width', '100%');
}
if (isMobileWebkit && ($(window).width() > 480) ) {
playlistslistScroll.refresh();
playlisttracksScroll.refresh();
}
}
function setSongInfo(data) {
@ -82,8 +119,8 @@ function setSongInfo(data) {
$("#trackslider").attr("max", data.length);
$("#songlength").html(timeFromSeconds(data.length / 1000));
resizeSonginfo();
//update styles of listviews
resizeMb();
//update styles of listviews
$('#currenttable li').each(function() {
$(this).removeClass("currenttrack");
if (this.id == 'currenttable-' + data.uri) {
@ -276,12 +313,10 @@ function initSocketevents() {
* initialize software
**********************/
$(document).ready(function() {
//$(document).bind("pageinit", function() {
//check for websockets
if (!window.WebSocket) {
switchContent("playlists");
$('#playlistspane').html('<h2>Old Browser</h2><p>Sorry. Your browser isn\'t modern enough for this webapp. Modern versions of Chrome, Firefox, Safari all will do. Maybe Opera and Internet Explorer 10 also work, but it\'s not tested.</p>');
exit;
$('#playlistspane').html('<h2>Old Browser</h2><p>Sorry. Your browser isn\'t modern enough for this webapp. Modern versions of Chrome, Firefox, Safari all will do. Maybe Opera and Internet Explorer 10 also work, but it\'s not tested.</p>'); exit;
}
$(window).hashchange();
@ -297,7 +332,6 @@ $(document).ready(function() {
switchContent("playlists");
}
// $("#songinfo").resize(resizeSonginfo());
initgui = false;
window.onhashchange = locationHashChanged;
// Log all events
@ -314,12 +348,14 @@ $(document).ready(function() {
$("#btback").hide();
}
$('.scroll').height($(window).height() - 100);
$(window).resize(function() {
resizeSonginfo();
$('.scroll').height($(window).height() - 100);
resizeMb();
});
});
$(document).bind("pageinit", function() {
resizeMb();
});
/************************

594
webclient/js/iscroll-lite.js Executable file
View File

@ -0,0 +1,594 @@
/*!
* iScroll Lite base on iScroll v4.1.6 ~ Copyright (c) 2011 Matteo Spinelli, http://cubiq.org
* Released under MIT license, http://cubiq.org/license
*/
(function(){
var m = Math,
mround = function (r) { return r >> 0; },
vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
(/firefox/i).test(navigator.userAgent) ? 'Moz' :
'opera' in window ? 'O' : '',
// Browser capabilities
isAndroid = (/android/gi).test(navigator.appVersion),
isIDevice = (/iphone|ipad/gi).test(navigator.appVersion),
isPlaybook = (/playbook/gi).test(navigator.appVersion),
isTouchPad = (/hp-tablet/gi).test(navigator.appVersion),
has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(),
hasTouch = 'ontouchstart' in window && !isTouchPad,
hasTransform = vendor + 'Transform' in document.documentElement.style,
hasTransitionEnd = isIDevice || isPlaybook,
nextFrame = (function() {
return window.requestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.oRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function(callback) { return setTimeout(callback, 17); }
})(),
cancelFrame = (function () {
return window.cancelRequestAnimationFrame
|| window.webkitCancelAnimationFrame
|| window.webkitCancelRequestAnimationFrame
|| window.mozCancelRequestAnimationFrame
|| window.oCancelRequestAnimationFrame
|| window.msCancelRequestAnimationFrame
|| clearTimeout
})(),
// Events
RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize',
START_EV = hasTouch ? 'touchstart' : 'mousedown',
MOVE_EV = hasTouch ? 'touchmove' : 'mousemove',
END_EV = hasTouch ? 'touchend' : 'mouseup',
CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup',
// Helpers
trnOpen = 'translate' + (has3d ? '3d(' : '('),
trnClose = has3d ? ',0)' : ')',
// Constructor
iScroll = function (el, options) {
var that = this,
doc = document,
i;
that.wrapper = typeof el == 'object' ? el : doc.getElementById(el);
that.wrapper.style.overflow = 'hidden';
that.scroller = that.wrapper.children[0];
// Default options
that.options = {
hScroll: true,
vScroll: true,
x: 0,
y: 0,
bounce: true,
bounceLock: false,
momentum: true,
lockDirection: true,
useTransform: true,
useTransition: false,
// Events
onRefresh: null,
onBeforeScrollStart: function (e) { e.preventDefault(); },
onScrollStart: null,
onBeforeScrollMove: null,
onScrollMove: null,
onBeforeScrollEnd: null,
onScrollEnd: null,
onTouchEnd: null,
onDestroy: null
};
// User defined options
for (i in options) that.options[i] = options[i];
// Set starting position
that.x = that.options.x;
that.y = that.options.y;
// Normalize options
that.options.useTransform = hasTransform ? that.options.useTransform : false;
that.options.hScrollbar = that.options.hScroll && that.options.hScrollbar;
that.options.vScrollbar = that.options.vScroll && that.options.vScrollbar;
that.options.useTransition = hasTransitionEnd && that.options.useTransition;
// Set some default styles
that.scroller.style[vendor + 'TransitionProperty'] = that.options.useTransform ? '-' + vendor.toLowerCase() + '-transform' : 'top left';
that.scroller.style[vendor + 'TransitionDuration'] = '0';
that.scroller.style[vendor + 'TransformOrigin'] = '0 0';
if (that.options.useTransition) that.scroller.style[vendor + 'TransitionTimingFunction'] = 'cubic-bezier(0.33,0.66,0.66,1)';
if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose;
else that.scroller.style.cssText += ';position:absolute;top:' + that.y + 'px;left:' + that.x + 'px';
that.refresh();
that._bind(RESIZE_EV, window);
that._bind(START_EV);
if (!hasTouch) that._bind('mouseout', that.wrapper);
};
// Prototype
iScroll.prototype = {
enabled: true,
x: 0,
y: 0,
steps: [],
scale: 1,
handleEvent: function (e) {
var that = this;
switch(e.type) {
case START_EV:
if (!hasTouch && e.button !== 0) return;
that._start(e);
break;
case MOVE_EV: that._move(e); break;
case END_EV:
case CANCEL_EV: that._end(e); break;
case RESIZE_EV: that._resize(); break;
case 'mouseout': that._mouseout(e); break;
case 'webkitTransitionEnd': that._transitionEnd(e); break;
}
},
_resize: function () {
this.refresh();
},
_pos: function (x, y) {
x = this.hScroll ? x : 0;
y = this.vScroll ? y : 0;
if (this.options.useTransform) {
this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
} else {
x = mround(x);
y = mround(y);
this.scroller.style.left = x + 'px';
this.scroller.style.top = y + 'px';
}
this.x = x;
this.y = y;
},
_start: function (e) {
var that = this,
point = hasTouch ? e.touches[0] : e,
matrix, x, y;
if (!that.enabled) return;
if (that.options.onBeforeScrollStart) that.options.onBeforeScrollStart.call(that, e);
if (that.options.useTransition) that._transitionTime(0);
that.moved = false;
that.animating = false;
that.zoomed = false;
that.distX = 0;
that.distY = 0;
that.absDistX = 0;
that.absDistY = 0;
that.dirX = 0;
that.dirY = 0;
if (that.options.momentum) {
if (that.options.useTransform) {
// Very lame general purpose alternative to CSSMatrix
matrix = getComputedStyle(that.scroller, null)[vendor + 'Transform'].replace(/[^0-9-.,]/g, '').split(',');
x = matrix[4] * 1;
y = matrix[5] * 1;
} else {
x = getComputedStyle(that.scroller, null).left.replace(/[^0-9-]/g, '') * 1;
y = getComputedStyle(that.scroller, null).top.replace(/[^0-9-]/g, '') * 1;
}
if (x != that.x || y != that.y) {
if (that.options.useTransition) that._unbind('webkitTransitionEnd');
else cancelFrame(that.aniTime);
that.steps = [];
that._pos(x, y);
}
}
that.startX = that.x;
that.startY = that.y;
that.pointX = point.pageX;
that.pointY = point.pageY;
that.startTime = e.timeStamp || Date.now();
if (that.options.onScrollStart) that.options.onScrollStart.call(that, e);
that._bind(MOVE_EV);
that._bind(END_EV);
that._bind(CANCEL_EV);
},
_move: function (e) {
var that = this,
point = hasTouch ? e.touches[0] : e,
deltaX = point.pageX - that.pointX,
deltaY = point.pageY - that.pointY,
newX = that.x + deltaX,
newY = that.y + deltaY,
timestamp = e.timeStamp || Date.now();
if (that.options.onBeforeScrollMove) that.options.onBeforeScrollMove.call(that, e);
that.pointX = point.pageX;
that.pointY = point.pageY;
// Slow down if outside of the boundaries
if (newX > 0 || newX < that.maxScrollX) {
newX = that.options.bounce ? that.x + (deltaX / 2) : newX >= 0 || that.maxScrollX >= 0 ? 0 : that.maxScrollX;
}
if (newY > 0 || newY < that.maxScrollY) {
newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= 0 || that.maxScrollY >= 0 ? 0 : that.maxScrollY;
}
that.distX += deltaX;
that.distY += deltaY;
that.absDistX = m.abs(that.distX);
that.absDistY = m.abs(that.distY);
if (that.absDistX < 6 && that.absDistY < 6) {
return;
}
// Lock direction
if (that.options.lockDirection) {
if (that.absDistX > that.absDistY + 5) {
newY = that.y;
deltaY = 0;
} else if (that.absDistY > that.absDistX + 5) {
newX = that.x;
deltaX = 0;
}
}
that.moved = true;
that._pos(newX, newY);
that.dirX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
that.dirY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
if (timestamp - that.startTime > 300) {
that.startTime = timestamp;
that.startX = that.x;
that.startY = that.y;
}
if (that.options.onScrollMove) that.options.onScrollMove.call(that, e);
},
_end: function (e) {
if (hasTouch && e.touches.length != 0) return;
var that = this,
point = hasTouch ? e.changedTouches[0] : e,
target, ev,
momentumX = { dist:0, time:0 },
momentumY = { dist:0, time:0 },
duration = (e.timeStamp || Date.now()) - that.startTime,
newPosX = that.x,
newPosY = that.y,
newDuration;
that._unbind(MOVE_EV);
that._unbind(END_EV);
that._unbind(CANCEL_EV);
if (that.options.onBeforeScrollEnd) that.options.onBeforeScrollEnd.call(that, e);
if (!that.moved) {
if (hasTouch) {
// Find the last touched element
target = point.target;
while (target.nodeType != 1) target = target.parentNode;
if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
ev = document.createEvent('MouseEvents');
ev.initMouseEvent('click', true, true, e.view, 1,
point.screenX, point.screenY, point.clientX, point.clientY,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
0, null);
ev._fake = true;
target.dispatchEvent(ev);
}
}
that._resetPos(200);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
}
if (duration < 300 && that.options.momentum) {
momentumX = newPosX ? that._momentum(newPosX - that.startX, duration, -that.x, that.scrollerW - that.wrapperW + that.x, that.options.bounce ? that.wrapperW : 0) : momentumX;
momentumY = newPosY ? that._momentum(newPosY - that.startY, duration, -that.y, (that.maxScrollY < 0 ? that.scrollerH - that.wrapperH + that.y : 0), that.options.bounce ? that.wrapperH : 0) : momentumY;
newPosX = that.x + momentumX.dist;
newPosY = that.y + momentumY.dist;
if ((that.x > 0 && newPosX > 0) || (that.x < that.maxScrollX && newPosX < that.maxScrollX)) momentumX = { dist:0, time:0 };
if ((that.y > 0 && newPosY > 0) || (that.y < that.maxScrollY && newPosY < that.maxScrollY)) momentumY = { dist:0, time:0 };
}
if (momentumX.dist || momentumY.dist) {
newDuration = m.max(m.max(momentumX.time, momentumY.time), 10);
that.scrollTo(mround(newPosX), mround(newPosY), newDuration);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
return;
}
that._resetPos(200);
if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
},
_resetPos: function (time) {
var that = this,
resetX = that.x >= 0 ? 0 : that.x < that.maxScrollX ? that.maxScrollX : that.x,
resetY = that.y >= 0 || that.maxScrollY > 0 ? 0 : that.y < that.maxScrollY ? that.maxScrollY : that.y;
if (resetX == that.x && resetY == that.y) {
if (that.moved) {
if (that.options.onScrollEnd) that.options.onScrollEnd.call(that); // Execute custom code on scroll end
that.moved = false;
}
return;
}
that.scrollTo(resetX, resetY, time || 0);
},
_mouseout: function (e) {
var t = e.relatedTarget;
if (!t) {
this._end(e);
return;
}
while (t = t.parentNode) if (t == this.wrapper) return;
this._end(e);
},
_transitionEnd: function (e) {
var that = this;
if (e.target != that.scroller) return;
that._unbind('webkitTransitionEnd');
that._startAni();
},
/**
*
* Utilities
*
*/
_startAni: function () {
var that = this,
startX = that.x, startY = that.y,
startTime = Date.now(),
step, easeOut,
animate;
if (that.animating) return;
if (!that.steps.length) {
that._resetPos(400);
return;
}
step = that.steps.shift();
if (step.x == startX && step.y == startY) step.time = 0;
that.animating = true;
that.moved = true;
if (that.options.useTransition) {
that._transitionTime(step.time);
that._pos(step.x, step.y);
that.animating = false;
if (step.time) that._bind('webkitTransitionEnd');
else that._resetPos(0);
return;
}
animate = function () {
var now = Date.now(),
newX, newY;
if (now >= startTime + step.time) {
that._pos(step.x, step.y);
that.animating = false;
if (that.options.onAnimationEnd) that.options.onAnimationEnd.call(that); // Execute custom code on animation end
that._startAni();
return;
}
now = (now - startTime) / step.time - 1;
easeOut = m.sqrt(1 - now * now);
newX = (step.x - startX) * easeOut + startX;
newY = (step.y - startY) * easeOut + startY;
that._pos(newX, newY);
if (that.animating) that.aniTime = nextFrame(animate);
};
animate();
},
_transitionTime: function (time) {
this.scroller.style[vendor + 'TransitionDuration'] = time + 'ms';
},
_momentum: function (dist, time, maxDistUpper, maxDistLower, size) {
var deceleration = 0.0006,
speed = m.abs(dist) / time,
newDist = (speed * speed) / (2 * deceleration),
newTime = 0, outsideDist = 0;
// Proportinally reduce speed if we are outside of the boundaries
if (dist > 0 && newDist > maxDistUpper) {
outsideDist = size / (6 / (newDist / speed * deceleration));
maxDistUpper = maxDistUpper + outsideDist;
speed = speed * maxDistUpper / newDist;
newDist = maxDistUpper;
} else if (dist < 0 && newDist > maxDistLower) {
outsideDist = size / (6 / (newDist / speed * deceleration));
maxDistLower = maxDistLower + outsideDist;
speed = speed * maxDistLower / newDist;
newDist = maxDistLower;
}
newDist = newDist * (dist < 0 ? -1 : 1);
newTime = speed / deceleration;
return { dist: newDist, time: mround(newTime) };
},
_offset: function (el) {
var left = -el.offsetLeft,
top = -el.offsetTop;
while (el = el.offsetParent) {
left -= el.offsetLeft;
top -= el.offsetTop;
}
return { left: left, top: top };
},
_bind: function (type, el, bubble) {
(el || this.scroller).addEventListener(type, this, !!bubble);
},
_unbind: function (type, el, bubble) {
(el || this.scroller).removeEventListener(type, this, !!bubble);
},
/**
*
* Public methods
*
*/
destroy: function () {
var that = this;
that.scroller.style[vendor + 'Transform'] = '';
// Remove the event listeners
that._unbind(RESIZE_EV, window);
that._unbind(START_EV);
that._unbind(MOVE_EV);
that._unbind(END_EV);
that._unbind(CANCEL_EV);
that._unbind('mouseout', that.wrapper);
if (that.options.useTransition) that._unbind('webkitTransitionEnd');
if (that.options.onDestroy) that.options.onDestroy.call(that);
},
refresh: function () {
var that = this,
offset;
that.wrapperW = that.wrapper.clientWidth;
that.wrapperH = that.wrapper.clientHeight;
that.scrollerW = that.scroller.offsetWidth;
that.scrollerH = that.scroller.offsetHeight;
that.maxScrollX = that.wrapperW - that.scrollerW;
that.maxScrollY = that.wrapperH - that.scrollerH;
that.dirX = 0;
that.dirY = 0;
that.hScroll = that.options.hScroll && that.maxScrollX < 0;
that.vScroll = that.options.vScroll && (!that.options.bounceLock && !that.hScroll || that.scrollerH > that.wrapperH);
offset = that._offset(that.wrapper);
that.wrapperOffsetLeft = -offset.left;
that.wrapperOffsetTop = -offset.top;
that.scroller.style[vendor + 'TransitionDuration'] = '0';
that._resetPos(200);
},
scrollTo: function (x, y, time, relative) {
var that = this,
step = x,
i, l;
that.stop();
if (!step.length) step = [{ x: x, y: y, time: time, relative: relative }];
for (i=0, l=step.length; i<l; i++) {
if (step[i].relative) { step[i].x = that.x - step[i].x; step[i].y = that.y - step[i].y; }
that.steps.push({ x: step[i].x, y: step[i].y, time: step[i].time || 0 });
}
that._startAni();
},
scrollToElement: function (el, time) {
var that = this, pos;
el = el.nodeType ? el : that.scroller.querySelector(el);
if (!el) return;
pos = that._offset(el);
pos.left += that.wrapperOffsetLeft;
pos.top += that.wrapperOffsetTop;
pos.left = pos.left > 0 ? 0 : pos.left < that.maxScrollX ? that.maxScrollX : pos.left;
pos.top = pos.top > 0 ? 0 : pos.top < that.maxScrollY ? that.maxScrollY : pos.top;
time = time === undefined ? m.max(m.abs(pos.left)*2, m.abs(pos.top)*2) : time;
that.scrollTo(pos.left, pos.top, time);
},
disable: function () {
this.stop();
this._resetPos(0);
this.enabled = false;
// If disabled after touchstart we make sure that there are no left over events
this._unbind(MOVE_EV);
this._unbind(END_EV);
this._unbind(CANCEL_EV);
},
enable: function () {
this.enabled = true;
},
stop: function () {
cancelFrame(this.aniTime);
this.steps = [];
this.moved = false;
this.animating = false;
}
};
if (typeof exports !== 'undefined') exports.iScroll = iScroll;
else window.iScroll = iScroll;
})();

1104
webclient/js/iscroll.js Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
(function(d,n,m,e){function o(a){a.preventDefault()}function j(a,b,c){this.iscrollview=a;this._emulateBottomOffset=function(){this.iscrollview.options.emulateBottomOffset&&(this.maxScrollY=this.wrapperH-this.scrollerH+this.minScrollY+this.iscrollview.options.bottomOffset)};this._fixInput=function(a){if(this.iscrollview.options.fixInput){var b;for(b=a.target;1!==b.nodeType;)b=b.parentNode;b=b.tagName.toLowerCase();if("select"===b||"input"===b||"textarea"===b)return}this.iscrollview.options.preventTouchHover?
a.stopImmediatePropagation():a.preventDefault()};this._doCallback=function(a,b,c){var d=this.iscrollview,e=d._logCallback(a,b);c&&c.call(this,b);d._trigger(a.toLowerCase(),b,{iscrollview:d});d._logCallback(a,b,e)};this._bind=function(a,b,c){var e=this.iscrollview.options.bindIscrollUsingJqueryEvents,i=e&&"mouseout"===a?"mouseleave":a;"orientationchange"===a||"resize"===a?this.iscrollview._logIscrollEvent("iScroll bind (ignored)",a):(this.iscrollview._logIscrollEvent("iScroll bind",a),e?(b?d(b):this.iscrollview.$scroller).bind(i,
d.proxy(this.handleEvent,this)):(b||this.scroller).addEventListener(i,this,!!c))};this._unbind=function(a,b,c){var e=this.iscrollview.options.bindIscrollUsingJqueryEvents,i=e&&"mouseout"===a?"mouseleave":a;"orientationchange"===a||"resize"===a?this.iscrollview._logIscrollEvent("iScroll unbind (ignored)"):(this.iscrollview._logIscrollEvent("iScroll unbind",a),e?d(b||this.iscrollview.$scroller).unbind(i,this.handleEvent):(b||this.scroller).removeEventListener(i,this,!!c))};this._origHandleEvent=iScroll.prototype.handleEvent;
this.handleEvent=function(a){var b=this.iscrollview.options.bindIscrollUsingJqueryEvents,c;c=this.iscrollview._logIscrollEvent("iScroll.handleEvent",a);b&&"mouseleave"===a.type?(a.type="mouseout",this._origHandleEvent(a),a.type="mouseleave"):this._origHandleEvent(a);this.iscrollview._logIscrollEvent("iScroll.handleEvent",a,c)};this._resize=function(){};iScroll.call(this,b,c)}var k=m.ontouchend!==e,p=/webkit/i.test(navigator.appVersion),q=/android/gi.test(navigator.appVersion),r=/firefox/i.test(navigator.userAgent);
/hp-tablet/gi.test(navigator.appVersion);/(iPhone|iPad|iPod).*AppleWebKit/.test(navigator.appVersion);var s=/iPad.*AppleWebKit/.test(navigator.appVersion),t=/(iPhone|iPad|iPod).*AppleWebKit.*Safari/.test(navigator.appVersion);/(iPhone|iPad|iPod).*AppleWebKit.(?!.*Safari)/.test(navigator.appVersion);var u=d.mobile.ignoreContentEnabled===e,l=1,h=function(){};h.prototype=iScroll.prototype;h=new h;h.constructor=j;j.prototype=h;d.widget("mobile.iscrollview",d.mobile.widget,{widgetEventPrefix:"iscroll_",
iscroll:null,$window:d(n),$wrapper:[],$scroller:[],$scrollerContent:[],$pullDown:[],$pullUp:[],$pullUpSpacer:[],$page:[],_wrapperHeightAdjustForBoxModel:0,_firstScrollerExpand:!0,createdAt:null,pageID:null,instanceID:null,_dirty:!1,_dirtyCallbackBefore:null,_dirtyCallbackAfter:null,_sizeDirty:!1,options:{hScroll:!1,hScrollbar:!1,debug:!1,traceResizeWrapper:!1,traceRefresh:!1,traceCreateDestroy:!1,traceIscrollEvents:!1,tracedIscrollEvents:[],traceWidgetEvents:!1,tracedWidgetEvents:[],traceIscrollCallbacks:!1,
tracedIscrollCallbacks:[],traceWidgetCallbacks:!1,tracedWidgetCallbacks:[],bottomOffset:0,emulateBottomOffset:!0,pageClass:"iscroll-page",wrapperClass:"iscroll-wrapper",scrollerClass:"iscroll-scroller",pullDownClass:"iscroll-pulldown",pullUpClass:"iscroll-pullup",pullLabelClass:"iscroll-pull-label",pullUpSpacerClass:"iscroll-pullup-spacer",scrollerContentClass:"iscroll-content",fixedHeightClass:"iscroll-fixed",fixedHeightSelector:":jqmData(role='header'), :jqmData(role='footer'), :jqmData(iscroll-fixed)",
resizeWrapper:!0,resizeEvents:"resize"+(d.support.orientation?" orientationchange":""),refreshOnPageBeforeShow:!1,fixInput:!0,wrapperAdd:0,refreshDelay:q?200:0,scrollShortContent:!0,removeWrapperPadding:!0,addScrollerPadding:!0,scrollTopOnResize:!0,scrollTopOnOrientatationChange:!0,createScroller:!0,deferNonActiveRefresh:!0,deferNonActiveResize:!0,preventTouchHover:u&&k,bindIscrollUsingJqueryEvents:!1,fastDestroy:!1,preventPageScroll:!0,pullDownResetText:"Pull down to refresh...",pullDownPulledText:"Release to refresh...",
pullDownLoadingText:"Loading...",pullUpResetText:"Pull up to refresh...",pullUpPulledText:"Release to refresh...",pullUpLoadingText:"Loading...",pullPulledClass:"iscroll-pull-pulled",pullLoadingClass:"iscroll-pull-loading",onrefresh:null,onbeforescrollstart:null,onscrollstart:null,onbeforescrollmove:null,onscrollmove:null,onbeforescrollend:null,onscrollend:null,ontouchend:null,ondestroy:null,onzoomstart:null,onzoom:null,onzoomend:null,onpulldownreset:null,onpulldownpulled:null,onpulldown:null,onpullupreset:null,
onpulluppulled:null,onpullup:null,onbeforerefresh:null,onafterrefresh:null},_widgetOnlyOptions:"debug traceIscrollEvents tracedIscrollEvents traceIscrollCallbacks tracedIscrollCallbacks traceWidgetEvents tracedWidgetEvents traceWidgetCallbacks tracedWidgetCallbacks traceResizeWrapper traceRefresh traceCreateDestroy bottomOffset emulateBottomOffset pageClass wrapperClass scrollerClass pullDownClass pullUpClass scrollerContentClass pullLabelClass pullUpSpacerClass fixedHeightSelector resizeWrapper resizeEvents refreshOnPageBeforeShow fixInput wrapperAdd refreshDelay scrollShortContent removeWrapperPadding addScrollerPadding createScroller deferNonActiveRefresh preventTouchHover deferNonActiveResize bindIscrollUsingJqueryEvents scrollTopOnResize scrollTopOnOrientationChange pullDownResetText pullDownPulledText pullDownLoadingText pullUpResetText pullUpPulledText pullUpLoadingText pullPulledClass pullLoadingClass onpulldownreset onpulldownpulled onpulldown onpullupreset onpulluppulled onpullup onbeforerefresh onafterrefresh fastDestroy".split(" "),
_event_map:{onrefresh:"onRefresh",onbeforescrollstart:"onBeforeScrollStart",onscrollstart:"onScrollStart",onbeforescrollmove:"onBeforeScrollMove",onscrollmove:"onScrollMove",onbeforescrollend:"onBeforeScrollEnd",onscrollend:"onScrollEnd",ontouchend:"onTouchEnd",ondestroy:"onDetroy",onzoomstart:"onZoomStart",onzoom:"onZoom",onzoomend:"onZoomEnd"},_proxy_event_funcs:{onRefresh:function(a){this._doCallback("onRefresh",a,function(a){this._emulateBottomOffset();this.iscrollview._pullOnRefresh.call(this.iscrollview,
a)})},onBeforeScrollStart:function(a){this._doCallback("onBeforeScrollStart",a,function(a){this._fixInput(a)})},onScrollStart:function(a){this._doCallback("onScrollStart",a)},onBeforeScrollMove:function(a){this._doCallback("onBeforeScrollMove",a);a.preventDefault()},onScrollMove:function(a){this._doCallback("onScrollMove",a,function(a){this.iscrollview._pullOnScrollMove.call(this.iscrollview,a)})},onBeforeScrollEnd:function(a){this._doCallback("onBeforeScrollEnd",a)},onScrollEnd:function(a){this._doCallback("onScrollEnd",
a,function(a){this.iscrollview._pullOnScrollEnd.call(this.iscrollview,a)})},onTouchEnd:function(a){this._doCallback("onTouchEnd",a)},onDestroy:function(a){this._doCallback("onDestroy",a)},onZoomStart:function(a){this._doCallback("onZoomStart",a)},onZoom:function(a){this._doCallback("onZoom",a)},onZoomEnd:function(a){this._doCallback("onZoomEnd",a)}},_merge_from_iscroll_options:function(){var a=d.extend(!0,{},this.iscroll.options);d.each(this._proxy_event_funcs,function(b){delete a[b]});this.options.emulateBottomOffset&&
delete a.bottomOffset;d.extend(this.options,a)},_create_iscroll_options:function(){var a=d.extend(!0,{},this.options);d.each(this._widgetOnlyOptions,function(b,c){delete a[c]});d.each(this._event_map,function(b){delete a[b]});this.options.emulateBottomOffset&&delete a.bottomOffset;return d.extend(a,this._proxy_event_funcs)},_pad:function(a,b,c){a=a.toString();for(c=c||"0";a.length<b;)a=c+a;return a},_toTime:function(a){return this._pad(a.getHours(),2)+":"+this._pad(a.getMinutes(),2)+":"+this._pad(a.getSeconds(),
2)+"."+this._pad(a.getMilliseconds(),3)},_log:function(a,b){var c,g;if(!this.options.debug)return null;c=b||new Date;g=this.$wrapper.attr("id");console.log(this._toTime(c)+" "+d.mobile.path.parseUrl(this.$page.jqmData("url")).filename+(g?"#"+g:"")+" "+a);return c},_logInterval:function(a,b){var c;if(!this.options.debug)return null;c=new Date;return this._log(a+" "+(c-b)+"mS from "+this._toTime(b),c)},_logEvent:function(a,b,c){var d=b&&b instanceof Object,e=(d?b.type:b)+" "+a;if(!this.options.debug)return null;
a=new Date;c?e+=" end "+ +(a-c)+"mS from "+this._toTime(c):d&&(e+=" begin");d&&(c=new Date(b.timeStamp),e+=" ("+(a-c)+"mS from "+b.type+" @ "+this._toTime(c)+")");return this._log(e,a)},_logCallback:function(a,b,c){return!this.options.debug||!this.options.traceIscrollCallbacks||0!==this.options.tracedIscrollCallbacks.length&&-1===d.inArray(a,this.options.tracedIscrollCallbacks)?null:b?this._logEvent(a,b,c):c?this._logInterval(a+" end",c):this._log(a+" begin")},_logIscrollEvent:function(a,b,c){var g=
b instanceof Event?b.type:b;return!this.options.debug||!this.options.traceIscrollEvents||0!==this.options.tracedIscrollEvents.length&&-1===d.inArray(g,this.options.tracedIscrollEvents)?null:this._logEvent(a,b,c)},_logWidgetEvent:function(a,b,c){var g=b instanceof Object?b.type:b;return!this.options.debug||!this.options.traceWidgetEvents||0!==this.options.tracedWidgetEvents.length&&-1===d.inArray(g,this.options.tracedWidgetEvents)?null:this._logEvent(a,b,c)},_logWidgetCallback:function(a,b,c){return!this.options.debug||
!this.options.traceWidgetCallbacks||0!==this.options.tracedWidgetCallbacks.length&&-1===d.inArray(a,this.options.tracedWidgetCallbacks)?null:b?this._logEvent(a,b,c):c?this._logInterval(a+" end",c):this._log(a+" begin")},_logInterval2:function(a,b,c){var d;this.options.debug&&(d=new Date,this._log(a+" "+(d-c)+"mS from "+this._toTime(c)+" ("+(d-b)+"mS from "+this._toTime(b)+")"))},_startTiming:function(){return!this.options.debug?null:new Date},_pageEventNamespace:function(){return".iscroll_"+this.pageID},
_instanceEventNamespace:function(){return this._pageEventNamespace()+"_"+this.instanceID},_addEventsNamespace:function(a,b){var c=a.split(" ");d.each(c,function(a){c[a]+=b});return c.join(" ")},_isvBind:function(a,b,c,e){b=this._addEventsNamespace(b,this._instanceEventNamespace());this._logWidgetEvent("bind "+e,b);a.bind(b,d.proxy(c,this))},_bindPage:function(a,b){var c=this._addEventsNamespace(a,this._pageEventNamespace());this._logWidgetEvent("bind $page",c);this.$page.bind(c,d.proxy(b,this))},
_isvUnbind:function(a,b,c){b=this._addEventsNamespace(b,this._instanceEventNamespace());this._logWidgetEvent("unbind "+c,b);a.unbind(b)},_unbindPage:function(a){a=this._addEventsNamespace(a,this._instanceEventNamespace());this._logWidgetEvent("unbind $page",a);this.$page.unbind(a)},_delegate:function(a,b,c,e,f){this._logWidgetEvent("delegate "+f+" "+b,c);a.delegate(b,c,d.proxy(e,this))},_triggerWidget:function(a,b){var c=this._logWidgetCallback(a);this._trigger(a,b,{iscrollview:this});this._logWidgetCallback(a,
b,c)},isDirty:function(){return this._dirty},_restoreStyle:function(a,b){b!==e&&(null===b?a.removeAttr("style"):a.attr("style",b))},_pageBeforeShowFunc:function(a){var b=this._logWidgetEvent("_pageBeforeShowFunc",a);this._dirty?(this.resizeWrapper(),this.refresh(null,this._dirtyCallbackBefore,this._dirtyCallbackAfter,!0),this._dirty=!1,this._dirtyCallbackAfter=this._dirtyCallbackBefore=null):(this.options.refreshOnPageBeforeShow||this._sizeDirty)&&this.refresh(null,d.proxy(this._resizeWrapper,this),
null,!0);this._sizeDirty=!1;this._logWidgetEvent("_pageBeforeShowFunc",a,b)},_windowResizeFunc:function(a){var b=this._logWidgetEvent("_windowResizeFunc",a);this.options.deferNonActiveResize&&!this.$page.is(d.mobile.activePage)?(this._sizeDirty=!0,this.options.traceResizeWrapper&&this._log("resizeWrapper() (deferred)")):(this.resizeWrapper(),this.refresh(null,null,null,!0));this._logWidgetEvent("_windowResizeFunc",a,b)},_orientationChangeFunc:function(a){var b=this._logWidgetEvent("_orientationChangeFunc",
a);this.options.scrollTopOnOrientationChange&&d.mobile.silentScroll(0);this._logWidgetEvent("_orientationChangeFunc",a,b)},_updateLayoutFunc:function(){this.refresh()},_instanceCount:function(a){var b=0,c=this.$page.jqmData("iscroll-private")||{};a!==e?(b=a,c.instanceCount=b,this.$page.jqmData("iscroll-private",c)):c.instanceCount!==e&&(b=c.instanceCount);return b},_nextInstanceID:function(a){var b=1,c=this.$page.jqmData("iscroll-private")||{};a!==e?(b=a,c.nextInstanceID=b,this.$page.jqmData("iscroll-private",
c)):c.nextInstanceID!==e&&(b=c.nextInstanceID);return b},_pageID:function(a){var b=1,c=this.$page.jqmData("iscroll-private")||{};a!==e?(b=a,c.pageID=b,this.$page.jqmData("iscroll-private",c)):c.pageID!==e&&(b=c.pageID);return b},_adaptPage:function(){var a=this;1===this._instanceCount()&&(this.$page.addClass(this.options.pageClass),this.$page.find(this.options.fixedHeightSelector).each(function(){d(this).addClass(a.options.fixedHeightClass)}),k&&this.options.preventPageScroll&&this._bindPage("touchmove",
o))},_undoAdaptPage:function(){var a=this;1===this._instanceCount()&&(this.$page.find(this.options.fixedHeightSelector).each(function(){d(this).removeClass(a.options.fixedHeightClass)}),this.$page.removeClass(this.options.pageClass))},_calculateBarsHeight:function(){var a=0,b="."+this.options.fixedHeightClass,c=this.$page.find(b),b=d("body").children(b);c.each(function(){a+=d(this).outerHeight(!0)});b.each(function(){var b=d(this).jqmData("id");if(""===b||!c.is(":jqmData(id='"+b+"')"))a+=d(this).outerHeight(!0)});
return a},_getBoxSizing:function(a){var b,c="";r?c="-moz-":p&&(c="-webkit-");b=a.css(c+"box-sizing");!b&&c&&(b=a.css("box-sizing"));b||(b=d.boxModel?"content-box":"border-box");return b},_getHeightAdjustForBoxModel:function(a){switch(this._getBoxSizing(a)){case "border-box":a=a.outerHeight(!0)-a.outerHeight();break;case "padding-box":a=a.outerHeight()-a.height();break;default:a=a.outerHeight(!0)-a.height()}return a},_setTopOffsetForPullDown:function(){this.$pullDown.length&&!this.options.topOffset&&
(this.options.topOffset=this.$pullDown.outerHeight(!0))},_setBottomOffsetForPullUp:function(){this.$pullUp.length&&!this.options.bottomOffset&&(this.options.bottomOffset=this.$pullUp.outerHeight(!0))},_removeWrapperPadding:function(){var a=this.$wrapper;this.options.removeWrapperPadding&&(this._origWrapperPaddingLeft=a.css("padding-left"),this._origWrapperPaddingRight=a.css("padding-right"),this._origWrapperPaddingTop=a.css("padding-top"),this._origWrapperPaddingBottom=a.css("padding-bottom"),this.$wrapper.css("padding",
0))},_modifyWrapperCSS:function(){this._origWrapperStyle=this.$wrapper.attr("style")||null;this._removeWrapperPadding()},_undoModifyWrapperCSS:function(){this._restoreStyle(this.$wrapper,this._origWrapperStyle)},_addScrollerPadding:function(){if(this.options.removeWrapperPadding&&this.options.addScrollerPadding){var a=this.$scroller.children().not(this.$pullDown).not(this.$pullUp).not(this.$pullUpSpacer);a.wrapAll("<div/>");a.parent().addClass(this.options.scrollerContentClass).css({"padding-left":this._origWrapperPaddingLeft,
"padding-right":this._origWrapperPaddingRight,"padding-top":this._origWrapperPaddingTop,"padding-bottom":this._origWrapperPaddingBottom})}},_undoAddScrollerPadding:function(){this.options.removeWrapperPadding&&this.options.addScrollerPadding&&d("."+this.options.scrollerContentClass,this.$scroller).children().unwrap()},_addWrapperClasses:function(){this.$wrapper.addClass(this.options.wrapperClass);this.$scroller.addClass(this.options.scrollerClass)},_undoAddWrapperClasses:function(){this.$scroller.removeClass(this.options.scrollerClass);
this.$wrapper.removeClass(this.options.wrapperClass)},_expandScrollerToFillWrapper:function(){if(this.options.scrollShortContent||this.$pullDown.length||this.pullUp.length)this._firstScrollerExpand&&(this._origScrollerStyle=this.$scroller.attr("style")||null,this._firstScrollerExpand=!1),this.$scroller.css("min-height",this.$wrapper.height()+(this.$pullDown.length?this.$pullDown.outerHeight(!0):0)+(this.$pullUp.length?this.$pullUp.outerHeight(!0):0))},_undoExpandScrollerToFillWrapper:function(){this._restoreStyle(this.$scroller,
this._origScrollerStyle)},_resizeWrapper:function(){var a=null,b,c;this.options.resizeWrapper&&(this.options.traceResizeWrapper&&(a=this._log("resizeWrapper() start")),this.$wrapper.trigger("updatelayout"),b=m.documentElement.clientHeight,c=this._calculateBarsHeight(),b=b-c-this._wrapperHeightAdjustForBoxModel+(t&&!s?60:0)+this.options.wrapperAdd,this.$wrapper.css("height",b),this._expandScrollerToFillWrapper(),this.options.traceResizeWrapper&&this._logInterval("resizeWrapper() end"+(this._sizeDirty?
" (dirty)":""),a))},resizeWrapper:function(){var a=this._setPageVisible();this._resizeWrapper();this._restorePageVisibility(a)},_undoResizeWrapper:function(){},_modifyWrapper:function(){this._addWrapperClasses();this._modifyWrapperCSS();this._wrapperHeightAdjustForBoxModel=this._getHeightAdjustForBoxModel(this.$wrapper)},_undoModifyWrapper:function(){this._undoResizeWrapper();this._undoModifyWrapperCSS();this._undoAddWrapperClasses()},_modifyPullDown:function(){var a,b;if(0!==this.$pullDown.length&&
(a=d("."+this.options.pullLabelClass,this.$pullDown),a.length)){(this._origPullDownLabelText=a.text())?this.options.pullDownResetText=this._origPullDownLabelText:a.text(this.options.pullDownResetText);if(b=a.jqmData("iscroll-pulled-text"))this.options.pullDownPulledText=b;if(a=a.jqmData("iscroll-loading-text"))this.options.pullDownLoadingText=a}},_undoModifyPullDown:function(){if(0!==this.$pullDown.length){var a=d("."+this.options.pullLabelClass,this.$pullDown);0!==a.length&&a.text(this._origPullDownLabelText)}},
_modifyPullUp:function(){var a,b;if(0!==this.$pullUp.length&&(d("<div></div>").insertBefore(this.$pullUp).css("height",this.$pullUp.outerHeight(!0)),this.$pullUpSpacer=this.$pullUp.prev(),this.$pullUpSpacer.addClass(this.options.pullUpSpacerClass),a=d("."+this.options.pullLabelClass,this.$pullUp),a.length)){(this._origPullUpLabelText=a.text())?this.options.pullUpResetText=this._origPullUpLabelText:a.text(this.options.pullUpResetText);if(b=a.jqmData("iscroll-pulled-text"))this.options.pullUpPulledText=
b;if(a=a.jqmData("iscroll-loading-text"))this.options.pullUpLoadingText=a}},_undoModifyPullUp:function(){0!==this.$pullUp.length&&(this.$pullUp.prev().remove(),this._origPullUpLabelText&&d("."+this.options.pullLabelClass,this.$pullUp).text(this._origPullUpLabelText))},_correctPushedDownPage:function(){this.options.resizeWrapper&&this.options.scrollTopOnResize&&d.mobile.silentScroll(0)},refresh:function(a,b,c,g){var f,h;if(!g&&this.options.deferNonActiveRefresh&&!this.$page.is(d.mobile.activePage))this._dirty=
!0,this._dirtyCallbackBefore=b,this._dirtyCallbackAfter=c,this.options.traceRefresh&&this._log("refresh() (deferred)");else{f=this;h=this._startTiming();if(a===e||null===a)a=this.options.refreshDelay;setTimeout(function(){var a=null,d;f.options.traceRefresh&&(a=f._logInterval("refresh() start",h));d=f._setPageVisible();b&&b();f._triggerWidget("onbeforerefresh");f.iscroll.refresh();f._triggerWidget("onafterrefresh");c&&c();f._restorePageVisibility(d);d||f._correctPushedDownPage();f.options.traceRefresh&&
f._logInterval2("refresh() end"+(g?" (dirty)":""),h,a)},a);this.options.traceRefresh&&this._log("refresh() will occur after >= "+a+"mS")}},_create_iscroll_object:function(){this.iscroll=new j(this,this.$wrapper.get(0),this._create_iscroll_options())},_createScroller:function(){this.options.createScroller&&(this.$wrapper.children().length?this.$wrapper.children().wrapAll("<div/>"):this.$wrapper.append("<div><div></div></div>"))},_undoCreateScroller:function(){this.options.createScroller&&this.$scroller.children().unwrap()},
_setPageVisible:function(){var a=this.$page.is(":hidden");a&&this.$page.css("display","block");return a},_restorePageVisibility:function(a){a&&this.$page.css("display","")},_create:function(){var a=new Date,b;this.$wrapper=this.element;this.$page=this.$wrapper.parents(":jqmData(role='page')");this.options.debug&&this.options.traceCreateDestroy&&this._log("_create() start",a);this.createdAt=a;this._instanceCount(this._instanceCount()+1);this.instanceID=this._nextInstanceID();this._nextInstanceID(this._instanceID+
1);1===this.instanceID&&(this._pageID(l),l+=1);this.pageID=this._pageID();b=this._setPageVisible();this._adaptPage();this._createScroller();this.$scroller=this.$wrapper.children(":first");0!==this.$scroller.length&&(this.$pullDown=d("."+this.options.pullDownClass,this.$scroller),this._modifyPullDown(),this.$pullUp=d("."+this.options.pullUpClass,this.$scroller),this._modifyPullUp(),d.extend(!0,this.options,this.$wrapper.jqmData("iscroll")),this._modifyWrapper(),this._bindPage("pagebeforeshow",this._pageBeforeShowFunc),
this._setTopOffsetForPullDown(),this._setBottomOffsetForPullUp(),this._resizeWrapper(),this._addScrollerPadding(),this._create_iscroll_object(),this._merge_from_iscroll_options(),this._restorePageVisibility(b),this.options.resizeWrapper&&(this._isvBind(this.$window,this.options.resizeEvents,this._windowResizeFunc,"$window"),this.options.scrollTopOnOrientationChange&&this._isvBind(this.$window,"orientationchange",this._orientationChangeFunc,"$window")),this.$scrollerContent=this.$scroller.find("."+
this.options.scrollerContentClass),this._isvBind(this.$scrollerContent,"updatelayout",this._updateLayoutFunc,"$scrollerContent"),this.options.debug&&this.options.traceCreateDestroy&&this._logInterval("_create() end",a))},destroy:function(){var a=null;this.options.debug&&this.options.traceCreateDestroy&&(a=this._log("destroy() start"));this._isvUnbind(this.$scrollerContent,"updatelayout","$scrollerContent");this._isvUnbind(this.$window,this.options.resizeEvents,"$window");this._isvUnbind(this.$window,
"orientationchange","$window");1===this._instanceCount()&&(this._unbindPage("pagebeforeshow"),k&&this._unbindPage("touchmove"));this.options.fastDestroy||(this.iscroll.destroy(),this.iscroll=null,this._undoExpandScrollerToFillWrapper(),this._undoModifyPullDown(),this._undoModifyPullUp(),this._undoAddScrollerPadding(),this._undoModifyWrapper(),this.$wrapper.removeClass(this.options.wrapperClass),this.$scroller.removeClass(this.options.scrollerClass),this._undoCreateScroller());this._instanceCount(this._instanceCount()-
1);0===this._instanceCount()&&this._undoAdaptPage();d.Widget.prototype.destroy.call(this);this.options.debug&&this.options.traceCreateDestroy&&this._logInterval("destroy() end",a)},enable:function(){this.iscroll.enable();d.Widget.prototype.enable.call(this)},disable:function(){this.iscroll.disable();d.Widget.prototype.disable.call(this)},_setOption:function(a,b){var c;this.options[a]=b;this.iscroll.destroy();c=this._setPageVisible();this._create_iscroll_object();this._restorePageVisibility(c);d.Widget.prototype._setOption.apply(this,
arguments)},scrollTo:function(a,b,c,d){this.iscroll.scrollTo(a,b,c,d)},scrollToElement:function(a,b){this.iscroll.scrollToElement(a,b)},scrollToPage:function(a,b,c){this.iscroll.scrollToPage(a,b,c)},stop:function(){this.iscroll.stop()},zoom:function(a,b,c,d){this.iscroll.zoom(a,b,c,d)},isReady:function(){return this.iscroll.isReady()},x:function(){return this.iscroll.x},y:function(){return this.iscroll.y},wrapperW:function(){return this.iscroll.wrapperW},wrapperH:function(){return this.iscroll.wrapperH},
scrollerW:function(){return this.iscroll.scrollerW},scrollerH:function(){return this.iscroll.scrollerH},minScrollX:function(a){a!==e&&(this.iscroll.minScrollX=a);return this.iscroll.minScrollX},minScrollY:function(a){a!==e&&(this.iscroll.minScrollY=a);return this.iscroll.minScrollY},maxScrollX:function(a){a!==e&&(this.iscroll.maxScrollX=a);return this.iscroll.maxScrollX},maxScrollY:function(a){a!==e&&(this.iscroll.maxScrollY=a);return this.iscroll.maxScrollY},_pullDownIsPulled:function(){return this.$pullDown.length&&
this.$pullDown.hasClass(this.options.pullPulledClass)},_pullUpIsPulled:function(){return this.$pullUp.length&&this.$pullUp.hasClass(this.options.pullPulledClass)},_replacePullText:function(a,b){var c;b&&(c=d("."+this.options.pullLabelClass,a))&&c.text(b)},_pullSetStateReset:function(a,b){a.is("."+this.options.pullLoadingClass+", ."+this.options.pullPulledClass)&&(a.removeClass(this.options.pullPulledClass+" "+this.options.pullLoadingClass),this._replacePullText(a,b))},_pullDownSetStateReset:function(a){this._pullSetStateReset(this.$pullDown,
this.options.pullDownResetText);this._triggerWidget("onpulldownreset",a)},_pullUpSetStateReset:function(a){this._pullSetStateReset(this.$pullUp,this.options.pullUpResetText);this._triggerWidget("onpullupreset",a)},_pullSetStatePulled:function(a,b){a.removeClass(this.options.pullLoadingClass).addClass(this.options.pullPulledClass);this._replacePullText(a,b)},_pullDownSetStatePulled:function(a){this._pullSetStatePulled(this.$pullDown,this.options.pullDownPulledText);this._triggerWidget("onpulldownpulled",
a)},_pullUpSetStatePulled:function(a){this._pullSetStatePulled(this.$pullUp,this.options.pullUpPulledText);this._triggerWidget("onpulluppulled",a)},_pullSetStateLoading:function(a,b){a.removeClass(this.options.pullPulledClass).addClass(this.options.pullLoadingClass);this._replacePullText(a,b)},_pullDownSetStateLoading:function(a){this._pullSetStateLoading(this.$pullDown,this.options.pullDownLoadingText);this._triggerWidget("onpulldownloading",a)},_pullUpSetStateLoading:function(a){this._pullSetStateLoading(this.$pullUp,
this.options.pullUpLoadingText);this._triggerWidget("onpulluploading",a)},_pullOnRefresh:function(a){this.$pullDown.length&&this._pullDownSetStateReset(a);this.$pullUp.length&&this._pullUpSetStateReset(a)},_pullOnScrollMove:function(a){var b,c,d=this.y();this.$pullDown.length&&(b=this._pullDownIsPulled(),c=this.options.topOffset,!b&&d>c/2?(this._pullDownSetStatePulled(a),this.minScrollY(0)):b&&0>=d&&(this._pullDownSetStateReset(a),this.minScrollY(-c)));this.$pullUp.length&&(b=this._pullUpIsPulled(),
c=this.options.bottomOffset,!b&&d<this.maxScrollY()-c-c/2?(this._pullUpSetStatePulled(a),this.maxScrollY(this.wrapperH()-this.scrollerH()+this.minScrollY())):b&&d>=this.maxScrollY()&&(this._pullUpSetStateReset(a),this.maxScrollY(this.wrapperH()-this.scrollerH()+this.minScrollY()+c)))},_pullOnScrollEnd:function(a){this._pullDownIsPulled(a)?(this._pullDownSetStateLoading(a),this._triggerWidget("onpulldown",a)):this._pullUpIsPulled(a)&&(this._pullUpSetStateLoading(a),this._triggerWidget("onpullup",a))}})})(jQuery,
window,document);jQuery(document).bind("pagecreate",function(d){jQuery(d.target).find(":jqmData(iscroll)").iscrollview()});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,9 @@ function processGetPlaylists(resultArr) {
$('#playlistslist').empty();
$('#playlistslist').html(tmp);
$('#playlistslist').listview('refresh');
// $('#playlistsloader').hide();
if (isMobileWebkit) {
playlistslistScroll.refresh();
}
showLoading(false);
}
@ -89,6 +91,9 @@ function processGetTracklist(resultArr) {
setSongInfo();
showLoading(false);
scrollToTracklist();
if (isMobileWebkit) {
playlisttracksScroll.refresh();
}
}
/********************************************************