MDL-33357 update mymobile inline for 2.3, attempt 3
@ -34,7 +34,7 @@ $THEME->parents = array(
|
||||
|
||||
// Set the stylesheets that we want to include for this theme
|
||||
$THEME->sheets = array(
|
||||
'jmobile1',
|
||||
'jmobile11',
|
||||
'core',
|
||||
'media'
|
||||
);
|
||||
@ -155,17 +155,11 @@ if ($thisdevice == "default" || $thisdevice == "tablet" || optional_param('mymob
|
||||
|
||||
// Add the required JavaScript to the page
|
||||
$THEME->javascripts = array(
|
||||
'jquery-1.6.4.min',
|
||||
'jquery-noconflict',
|
||||
'jquery-1.7.1.min',
|
||||
'custom',
|
||||
'jquery.mobile-1.0',
|
||||
'scrollview',
|
||||
'easing'
|
||||
'jquery.mobile-1.1.0'
|
||||
);
|
||||
|
||||
// Sets a custom render factory to use with the theme, used when working with custom renderers.
|
||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||
|
||||
// This theme doesn't support CSS optimisation. The JQuery CSS has already been optimised in a way that
|
||||
// is not compatible with the CSS optimiser in Moodle.
|
||||
$THEME->supportscssoptimisation = false;
|
||||
$THEME->csspostprocess = 'mymobile_user_settings';
|
@ -1,8 +1,7 @@
|
||||
$(document).bind("mobileinit", function(){
|
||||
//mobile init stuff 11/12/10
|
||||
//turn off ajax forms...
|
||||
//$.mobile.defaultPageTransition = "fade";
|
||||
//$.mobile.touchOverflowEnabled = true;
|
||||
$.mobile.defaultPageTransition = "slide";
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -49,7 +48,7 @@ $(document).ready(function() {
|
||||
|
||||
//scroll to top
|
||||
$('a#uptotop').live('tap', function() {
|
||||
var position = $(".ui-page-active .ui-header").position();
|
||||
var position = $(".ui-page-active").position();
|
||||
$.mobile.silentScroll(position.top);
|
||||
$(this).removeClass("ui-btn-active");
|
||||
return false;
|
||||
@ -62,7 +61,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
//calendar and other links that need to be external
|
||||
$('.maincalendar .filters a, li.activity.scorm a, div.files a, #page-user-filesPAGE li div a, .maincalendar .bottom a, .section li.url.modtype_url a, .resourcecontent .resourcemediaplugin a, #underfooter .noajax a, .block_mnet_hosts .content a, .block_private_files .content a, a.portfolio-add-link').attr("data-ajax", "false");
|
||||
$('.maincalendar .filters a, li.activity.scorm a, div.files a, #page-user-filesPAGE li div a, .maincalendar .bottom a, .section li.url.modtype_url a, .resourcecontent .resourcemediaplugin a, #underfooter .noajax a, .block_mnet_hosts .content a, .block_private_files .content a, a.portfolio-add-link, #attempts td a').attr("data-ajax", "false");
|
||||
|
||||
//add blank to open in window for some
|
||||
$('#page-mod-url-viewPAGE div.urlworkaround a, #page-mod-resource-viewPAGE div.resourceworkaround a, .mediaplugin a.mediafallbacklink, #page-mod-resource-viewPAGE .resourcemp3 a, .foldertree li a').attr("target", "_blank").attr("data-role", "button").attr("data-icon", "plus");
|
||||
@ -226,7 +225,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
//quiz page only js
|
||||
$('div#page-mod-quiz-viewPAGE, div#page-mod-quiz-attemptPAGE, div#page-mod-quiz-summaryPAGE, div#page-mod-quiz-reviewPAGE').live('pagebeforecreate',function(event, ui){
|
||||
$('div#page-mod-quiz-viewPAGE, div#page-mod-quiz-attemptPAGE, div#page-mod-quiz-summaryPAGE, div#page-mod-quiz-reviewPAGE, #page-mod-quiz-attempt #content2').live('pagebeforecreate',function(event, ui){
|
||||
//add quiz timer into quiz page
|
||||
$('#quiz-timer').remove();
|
||||
$('.mymobilecontent').prepend('<div id="quiz-timer" > <span id="quiz-time-left"></span></div>');
|
||||
@ -251,20 +250,13 @@ $(document).ready(function() {
|
||||
$('div#page-course-view-topcollPAGE').live('pagebeforecreate',function(event, ui){
|
||||
$('#page-course-view-topcollPAGE ul.section').attr("data-role", "none");
|
||||
$('.section li img').removeClass("ui-li-icon");
|
||||
$.getScript('../course/format/topcoll/lib.js');
|
||||
$.getScript('../course/format/topcoll/module.js');
|
||||
$('#page-course-view-topcollPAGE tr.cps a').attr("data-role", "button").attr("data-icon", "arrow-r");
|
||||
$('#page-course-view-topcollPAGE #thetopics').attr("data-role", "controlgroup");
|
||||
$('#page-course-view-topcollPAGE td.cps_centre').each(function(index) {
|
||||
var cpsc = $(this).text().replace('<br>','').replace(')','');
|
||||
$(this).prev('td').find('a').append('<span class="ui-li-count ui-btn-up-a ui-btn-corner-all">' + cpsc + '</span>');
|
||||
});
|
||||
$('tr.cps').click(function() {
|
||||
if ($(this).hasClass('opencps')) {
|
||||
$(this).removeClass("opencps");
|
||||
} else {
|
||||
$(this).addClass("opencps");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
///// functions below does stuff after creating page for some cleaning...
|
||||
@ -272,8 +264,6 @@ $(document).ready(function() {
|
||||
$('.path-calendar div.ui-radio label:first-child, .path-mod-lesson div.ui-radio label:first-child, #page-mod-wiki-createPAGE div.ui-radio label:first-child').addClass("afirst");
|
||||
$('.forumpost div.author a').removeAttr('data-role');
|
||||
//$('.questionflagimage2').removeClass("ui-btn-hidden");a#notificationyes
|
||||
//scrollview 2/7/11 testing remove if remove scrollview
|
||||
$('.gradeparent, .pagelayout-report .no-overflow, .path-mod-choice .response, .resourcecontent.resourceimg, .usersubmissions .no-overflow, .path-course-report-log .generaltable, table.results.anonymous, table.surveytable, div.resultgraph, div.reportsummary a, #completion-progress').scrollview();
|
||||
//image replacement
|
||||
$(this).find(".ithumb .course-content .summary img, .ithumb .course-content .activity.label img, .ithumb .sitetopic .no-overflow img").click(function() {
|
||||
var turl = $(this).attr("src");
|
||||
|
@ -1,205 +0,0 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
// t: current time, b: begInnIng value, c: change In value, d: duration
|
||||
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
||||
|
||||
jQuery.extend( jQuery.easing,
|
||||
{
|
||||
def: 'easeOutQuad',
|
||||
swing: function (x, t, b, c, d) {
|
||||
//alert(jQuery.easing.default);
|
||||
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
||||
},
|
||||
easeInQuad: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t + b;
|
||||
},
|
||||
easeOutQuad: function (x, t, b, c, d) {
|
||||
return -c *(t/=d)*(t-2) + b;
|
||||
},
|
||||
easeInOutQuad: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t + b;
|
||||
return -c/2 * ((--t)*(t-2) - 1) + b;
|
||||
},
|
||||
easeInCubic: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t + b;
|
||||
},
|
||||
easeOutCubic: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t + 1) + b;
|
||||
},
|
||||
easeInOutCubic: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t + 2) + b;
|
||||
},
|
||||
easeInQuart: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t + b;
|
||||
},
|
||||
easeOutQuart: function (x, t, b, c, d) {
|
||||
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
||||
},
|
||||
easeInOutQuart: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
||||
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
||||
},
|
||||
easeInQuint: function (x, t, b, c, d) {
|
||||
return c*(t/=d)*t*t*t*t + b;
|
||||
},
|
||||
easeOutQuint: function (x, t, b, c, d) {
|
||||
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
||||
},
|
||||
easeInOutQuint: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
||||
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
||||
},
|
||||
easeInSine: function (x, t, b, c, d) {
|
||||
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
||||
},
|
||||
easeOutSine: function (x, t, b, c, d) {
|
||||
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
||||
},
|
||||
easeInOutSine: function (x, t, b, c, d) {
|
||||
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
||||
},
|
||||
easeInExpo: function (x, t, b, c, d) {
|
||||
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
||||
},
|
||||
easeOutExpo: function (x, t, b, c, d) {
|
||||
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
||||
},
|
||||
easeInOutExpo: function (x, t, b, c, d) {
|
||||
if (t==0) return b;
|
||||
if (t==d) return b+c;
|
||||
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
||||
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
||||
},
|
||||
easeInCirc: function (x, t, b, c, d) {
|
||||
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
||||
},
|
||||
easeOutCirc: function (x, t, b, c, d) {
|
||||
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
||||
},
|
||||
easeInOutCirc: function (x, t, b, c, d) {
|
||||
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
||||
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
||||
},
|
||||
easeInElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
},
|
||||
easeOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
||||
},
|
||||
easeInOutElastic: function (x, t, b, c, d) {
|
||||
var s=1.70158;var p=0;var a=c;
|
||||
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
||||
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
||||
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
||||
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
||||
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
||||
},
|
||||
easeInBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*(t/=d)*t*((s+1)*t - s) + b;
|
||||
},
|
||||
easeOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
||||
},
|
||||
easeInOutBack: function (x, t, b, c, d, s) {
|
||||
if (s == undefined) s = 1.70158;
|
||||
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
||||
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
||||
},
|
||||
easeInBounce: function (x, t, b, c, d) {
|
||||
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
||||
},
|
||||
easeOutBounce: function (x, t, b, c, d) {
|
||||
if ((t/=d) < (1/2.75)) {
|
||||
return c*(7.5625*t*t) + b;
|
||||
} else if (t < (2/2.75)) {
|
||||
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
||||
} else if (t < (2.5/2.75)) {
|
||||
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
||||
} else {
|
||||
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
||||
}
|
||||
},
|
||||
easeInOutBounce: function (x, t, b, c, d) {
|
||||
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
||||
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
4
theme/mymobile/javascript/jquery-1.7.1.min.js
vendored
Normal file
@ -1 +0,0 @@
|
||||
jQuery.noConflict();
|
@ -1,802 +0,0 @@
|
||||
/*
|
||||
* jQuery Mobile Framework : scrollview plugin
|
||||
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
||||
* Note: Code is in draft form and is subject to change
|
||||
*/
|
||||
(function($,window,document,undefined){
|
||||
|
||||
jQuery.widget( "mobile.scrollview", jQuery.mobile.widget, {
|
||||
options: {
|
||||
fps: 60, // Frames per second in msecs.
|
||||
direction: null, // "x", "y", or null for both.
|
||||
|
||||
scrollDuration: 2000, // Duration of the scrolling animation in msecs.
|
||||
overshootDuration: 250, // Duration of the overshoot animation in msecs.
|
||||
snapbackDuration: 500, // Duration of the snapback animation in msecs.
|
||||
|
||||
moveThreshold: 10, // User must move this many pixels in any direction to trigger a scroll.
|
||||
moveIntervalThreshold: 150, // Time between mousemoves must not exceed this threshold.
|
||||
|
||||
scrollMethod: "translate", // "translate", "position", "scroll"
|
||||
|
||||
startEventName: "scrollstart",
|
||||
updateEventName: "scrollupdate",
|
||||
stopEventName: "scrollstop",
|
||||
|
||||
eventType: $.support.touch ? "touch" : "mouse",
|
||||
|
||||
showScrollBars: true,
|
||||
|
||||
pagingEnabled: false,
|
||||
delayedClickSelector: "a,input,textarea,select,button,.ui-btn",
|
||||
delayedClickEnabled: true
|
||||
},
|
||||
|
||||
_makePositioned: function($ele)
|
||||
{
|
||||
if ($ele.css("position") == "static")
|
||||
$ele.css("position", "relative");
|
||||
},
|
||||
|
||||
_create: function()
|
||||
{
|
||||
this._$clip = $(this.element).addClass("ui-scrollview-clip");
|
||||
var $child = this._$clip.children();
|
||||
if ($child.length > 1) {
|
||||
$child = this._$clip.wrapInner("<div></div>").children();
|
||||
}
|
||||
this._$view = $child.addClass("ui-scrollview-view");
|
||||
|
||||
this._$clip.css("overflow", this.options.scrollMethod === "scroll" ? "scroll" : "hidden");
|
||||
this._makePositioned(this._$clip);
|
||||
|
||||
this._$view.css("overflow", "hidden");
|
||||
|
||||
// Turn off our faux scrollbars if we are using native scrolling
|
||||
// to position the view.
|
||||
|
||||
this.options.showScrollBars = this.options.scrollMethod === "scroll" ? false : this.options.showScrollBars;
|
||||
|
||||
// We really don't need this if we are using a translate transformation
|
||||
// for scrolling. We set it just in case the user wants to switch methods
|
||||
// on the fly.
|
||||
|
||||
this._makePositioned(this._$view);
|
||||
this._$view.css({ left: 0, top: 0 });
|
||||
|
||||
this._sx = 0;
|
||||
this._sy = 0;
|
||||
|
||||
var direction = this.options.direction;
|
||||
this._hTracker = (direction !== "y") ? new MomentumTracker(this.options) : null;
|
||||
this._vTracker = (direction !== "x") ? new MomentumTracker(this.options) : null;
|
||||
|
||||
this._timerInterval = 1000/this.options.fps;
|
||||
this._timerID = 0;
|
||||
|
||||
var self = this;
|
||||
this._timerCB = function(){ self._handleMomentumScroll(); };
|
||||
|
||||
this._addBehaviors();
|
||||
},
|
||||
|
||||
_startMScroll: function(speedX, speedY)
|
||||
{
|
||||
this._stopMScroll();
|
||||
this._showScrollBars();
|
||||
|
||||
var keepGoing = false;
|
||||
var duration = this.options.scrollDuration;
|
||||
|
||||
this._$clip.trigger(this.options.startEventName);
|
||||
|
||||
var ht = this._hTracker;
|
||||
if (ht)
|
||||
{
|
||||
var c = this._$clip.width();
|
||||
var v = this._$view.width();
|
||||
ht.start(this._sx, speedX, duration, (v > c) ? -(v - c) : 0, 0);
|
||||
keepGoing = !ht.done();
|
||||
}
|
||||
|
||||
var vt = this._vTracker;
|
||||
if (vt)
|
||||
{
|
||||
var c = this._$clip.height();
|
||||
var v = this._$view.height();
|
||||
vt.start(this._sy, speedY, duration, (v > c) ? -(v - c) : 0, 0);
|
||||
keepGoing = keepGoing || !vt.done();
|
||||
}
|
||||
|
||||
if (keepGoing)
|
||||
this._timerID = setTimeout(this._timerCB, this._timerInterval);
|
||||
else
|
||||
this._stopMScroll();
|
||||
},
|
||||
|
||||
_stopMScroll: function()
|
||||
{
|
||||
if (this._timerID)
|
||||
{
|
||||
this._$clip.trigger(this.options.stopEventName);
|
||||
clearTimeout(this._timerID);
|
||||
}
|
||||
this._timerID = 0;
|
||||
|
||||
if (this._vTracker)
|
||||
this._vTracker.reset();
|
||||
|
||||
if (this._hTracker)
|
||||
this._hTracker.reset();
|
||||
|
||||
this._hideScrollBars();
|
||||
},
|
||||
|
||||
_handleMomentumScroll: function()
|
||||
{
|
||||
var keepGoing = false;
|
||||
var v = this._$view;
|
||||
|
||||
var x = 0, y = 0;
|
||||
|
||||
var vt = this._vTracker;
|
||||
if (vt)
|
||||
{
|
||||
vt.update();
|
||||
y = vt.getPosition();
|
||||
keepGoing = !vt.done();
|
||||
}
|
||||
|
||||
var ht = this._hTracker;
|
||||
if (ht)
|
||||
{
|
||||
ht.update();
|
||||
x = ht.getPosition();
|
||||
keepGoing = keepGoing || !ht.done();
|
||||
}
|
||||
|
||||
this._setScrollPosition(x, y);
|
||||
this._$clip.trigger(this.options.updateEventName, { x: x, y: y });
|
||||
|
||||
if (keepGoing)
|
||||
this._timerID = setTimeout(this._timerCB, this._timerInterval);
|
||||
else
|
||||
this._stopMScroll();
|
||||
},
|
||||
|
||||
_setScrollPosition: function(x, y)
|
||||
{
|
||||
this._sx = x;
|
||||
this._sy = y;
|
||||
|
||||
var $v = this._$view;
|
||||
|
||||
var sm = this.options.scrollMethod;
|
||||
|
||||
switch (sm)
|
||||
{
|
||||
case "translate":
|
||||
setElementTransform($v, x + "px", y + "px");
|
||||
break;
|
||||
case "position":
|
||||
$v.css({left: x + "px", top: y + "px"});
|
||||
break;
|
||||
case "scroll":
|
||||
var c = this._$clip[0];
|
||||
c.scrollLeft = -x;
|
||||
c.scrollTop = -y;
|
||||
break;
|
||||
}
|
||||
|
||||
var $vsb = this._$vScrollBar;
|
||||
var $hsb = this._$hScrollBar;
|
||||
|
||||
if ($vsb)
|
||||
{
|
||||
var $sbt = $vsb.find(".ui-scrollbar-thumb");
|
||||
if (sm === "translate")
|
||||
setElementTransform($sbt, "0px", -y/$v.height() * $sbt.parent().height() + "px");
|
||||
else
|
||||
$sbt.css("top", -y/$v.height()*100 + "%");
|
||||
}
|
||||
|
||||
if ($hsb)
|
||||
{
|
||||
var $sbt = $hsb.find(".ui-scrollbar-thumb");
|
||||
if (sm === "translate")
|
||||
setElementTransform($sbt, -x/$v.width() * $sbt.parent().width() + "px", "0px");
|
||||
else
|
||||
$sbt.css("left", -x/$v.width()*100 + "%");
|
||||
}
|
||||
},
|
||||
|
||||
scrollTo: function(x, y, duration)
|
||||
{
|
||||
this._stopMScroll();
|
||||
if (!duration)
|
||||
return this._setScrollPosition(x, y);
|
||||
|
||||
x = -x;
|
||||
y = -y;
|
||||
|
||||
var self = this;
|
||||
var start = getCurrentTime();
|
||||
var efunc = $.easing["easeOutQuad"];
|
||||
var sx = this._sx;
|
||||
var sy = this._sy;
|
||||
var dx = x - sx;
|
||||
var dy = y - sy;
|
||||
var tfunc = function(){
|
||||
var elapsed = getCurrentTime() - start;
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
self._timerID = 0;
|
||||
self._setScrollPosition(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
var ec = efunc(elapsed/duration, elapsed, 0, 1, duration);
|
||||
self._setScrollPosition(sx + (dx * ec), sy + (dy * ec));
|
||||
self._timerID = setTimeout(tfunc, self._timerInterval);
|
||||
}
|
||||
};
|
||||
|
||||
this._timerID = setTimeout(tfunc, this._timerInterval);
|
||||
},
|
||||
|
||||
getScrollPosition: function()
|
||||
{
|
||||
return { x: -this._sx, y: -this._sy };
|
||||
},
|
||||
|
||||
_getScrollHierarchy: function()
|
||||
{
|
||||
var svh = [];
|
||||
this._$clip.parents(".ui-scrollview-clip").each(function(){
|
||||
var d = $(this).data("scrollview");
|
||||
if (d) svh.unshift(d);
|
||||
});
|
||||
return svh;
|
||||
},
|
||||
|
||||
_getAncestorByDirection: function(dir)
|
||||
{
|
||||
var svh = this._getScrollHierarchy();
|
||||
var n = svh.length;
|
||||
while (0 < n--)
|
||||
{
|
||||
var sv = svh[n];
|
||||
var svdir = sv.options.direction;
|
||||
|
||||
if (!svdir || svdir == dir)
|
||||
return sv;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_handleDragStart: function(e, ex, ey)
|
||||
{
|
||||
// Stop any scrolling of elements in our parent hierarcy.
|
||||
$.each(this._getScrollHierarchy(),function(i,sv){ sv._stopMScroll(); });
|
||||
this._stopMScroll();
|
||||
|
||||
var c = this._$clip;
|
||||
var v = this._$view;
|
||||
|
||||
if (this.options.delayedClickEnabled) {
|
||||
this._$clickEle = $(e.target).closest(this.options.delayedClickSelector);
|
||||
}
|
||||
this._lastX = ex;
|
||||
this._lastY = ey;
|
||||
this._doSnapBackX = false;
|
||||
this._doSnapBackY = false;
|
||||
this._speedX = 0;
|
||||
this._speedY = 0;
|
||||
this._directionLock = "";
|
||||
this._didDrag = false;
|
||||
|
||||
if (this._hTracker)
|
||||
{
|
||||
var cw = parseInt(c.css("width"), 10);
|
||||
var vw = parseInt(v.css("width"), 10);
|
||||
this._maxX = cw - vw;
|
||||
if (this._maxX > 0) this._maxX = 0;
|
||||
if (this._$hScrollBar)
|
||||
this._$hScrollBar.find(".ui-scrollbar-thumb").css("width", (cw >= vw ? "100%" : Math.floor(cw/vw*100)+ "%"));
|
||||
}
|
||||
|
||||
if (this._vTracker)
|
||||
{
|
||||
var ch = parseInt(c.css("height"), 10);
|
||||
var vh = parseInt(v.css("height"), 10);
|
||||
this._maxY = ch - vh;
|
||||
if (this._maxY > 0) this._maxY = 0;
|
||||
if (this._$vScrollBar)
|
||||
this._$vScrollBar.find(".ui-scrollbar-thumb").css("height", (ch >= vh ? "100%" : Math.floor(ch/vh*100)+ "%"));
|
||||
}
|
||||
|
||||
var svdir = this.options.direction;
|
||||
|
||||
this._pageDelta = 0;
|
||||
this._pageSize = 0;
|
||||
this._pagePos = 0;
|
||||
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y"))
|
||||
{
|
||||
this._pageSize = svdir === "x" ? cw : ch;
|
||||
this._pagePos = svdir === "x" ? this._sx : this._sy;
|
||||
this._pagePos -= this._pagePos % this._pageSize;
|
||||
}
|
||||
this._lastMove = 0;
|
||||
this._enableTracking();
|
||||
|
||||
// If we're using mouse events, we need to prevent the default
|
||||
// behavior to suppress accidental selection of text, etc. We
|
||||
// can't do this on touch devices because it will disable the
|
||||
// generation of "click" events.
|
||||
//
|
||||
// XXX: We should test if this has an effect on links! - kin
|
||||
|
||||
if (this.options.eventType == "mouse" || this.options.delayedClickEnabled)
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
},
|
||||
|
||||
_propagateDragMove: function(sv, e, ex, ey, dir)
|
||||
{
|
||||
this._hideScrollBars();
|
||||
this._disableTracking();
|
||||
sv._handleDragStart(e,ex,ey);
|
||||
sv._directionLock = dir;
|
||||
sv._didDrag = this._didDrag;
|
||||
},
|
||||
|
||||
_handleDragMove: function(e, ex, ey)
|
||||
{
|
||||
this._lastMove = getCurrentTime();
|
||||
|
||||
var v = this._$view;
|
||||
|
||||
var dx = ex - this._lastX;
|
||||
var dy = ey - this._lastY;
|
||||
var svdir = this.options.direction;
|
||||
|
||||
if (!this._directionLock)
|
||||
{
|
||||
var x = Math.abs(dx);
|
||||
var y = Math.abs(dy);
|
||||
var mt = this.options.moveThreshold;
|
||||
|
||||
if (x < mt && y < mt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var dir = null;
|
||||
var r = 0;
|
||||
if (x < y && (x/y) < 0.5) {
|
||||
dir = "y";
|
||||
}
|
||||
else if (x > y && (y/x) < 0.5) {
|
||||
dir = "x";
|
||||
}
|
||||
|
||||
if (svdir && dir && svdir != dir)
|
||||
{
|
||||
// This scrollview can't handle the direction the user
|
||||
// is attempting to scroll. Find an ancestor scrollview
|
||||
// that can handle the request.
|
||||
|
||||
var sv = this._getAncestorByDirection(dir);
|
||||
if (sv)
|
||||
{
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this._directionLock = svdir ? svdir : (dir ? dir : "none");
|
||||
}
|
||||
|
||||
var newX = this._sx;
|
||||
var newY = this._sy;
|
||||
|
||||
if (this._directionLock !== "y" && this._hTracker)
|
||||
{
|
||||
var x = this._sx;
|
||||
this._speedX = dx;
|
||||
newX = x + dx;
|
||||
|
||||
// Simulate resistance.
|
||||
|
||||
this._doSnapBackX = false;
|
||||
if (newX > 0 || newX < this._maxX)
|
||||
{
|
||||
if (this._directionLock === "x")
|
||||
{
|
||||
var sv = this._getAncestorByDirection("x");
|
||||
if (sv)
|
||||
{
|
||||
this._setScrollPosition(newX > 0 ? 0 : this._maxX, newY);
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
newX = x + (dx/2);
|
||||
this._doSnapBackX = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._directionLock !== "x" && this._vTracker)
|
||||
{
|
||||
var y = this._sy;
|
||||
this._speedY = dy;
|
||||
newY = y + dy;
|
||||
|
||||
// Simulate resistance.
|
||||
|
||||
this._doSnapBackY = false;
|
||||
if (newY > 0 || newY < this._maxY)
|
||||
{
|
||||
if (this._directionLock === "y")
|
||||
{
|
||||
var sv = this._getAncestorByDirection("y");
|
||||
if (sv)
|
||||
{
|
||||
this._setScrollPosition(newX, newY > 0 ? 0 : this._maxY);
|
||||
this._propagateDragMove(sv, e, ex, ey, dir);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
newY = y + (dy/2);
|
||||
this._doSnapBackY = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y"))
|
||||
{
|
||||
if (this._doSnapBackX || this._doSnapBackY)
|
||||
this._pageDelta = 0;
|
||||
else
|
||||
{
|
||||
var opos = this._pagePos;
|
||||
var cpos = svdir === "x" ? newX : newY;
|
||||
var delta = svdir === "x" ? dx : dy;
|
||||
|
||||
this._pageDelta = (opos > cpos && delta < 0) ? this._pageSize : ((opos < cpos && delta > 0) ? -this._pageSize : 0);
|
||||
}
|
||||
}
|
||||
|
||||
this._didDrag = true;
|
||||
this._lastX = ex;
|
||||
this._lastY = ey;
|
||||
|
||||
this._setScrollPosition(newX, newY);
|
||||
|
||||
this._showScrollBars();
|
||||
|
||||
// Call preventDefault() to prevent touch devices from
|
||||
// scrolling the main window.
|
||||
|
||||
// e.preventDefault();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_handleDragStop: function(e)
|
||||
{
|
||||
var l = this._lastMove;
|
||||
var t = getCurrentTime();
|
||||
var doScroll = l && (t - l) <= this.options.moveIntervalThreshold;
|
||||
|
||||
var sx = (this._hTracker && this._speedX && doScroll) ? this._speedX : (this._doSnapBackX ? 1 : 0);
|
||||
var sy = (this._vTracker && this._speedY && doScroll) ? this._speedY : (this._doSnapBackY ? 1 : 0);
|
||||
|
||||
var svdir = this.options.direction;
|
||||
if (this.options.pagingEnabled && (svdir === "x" || svdir === "y") && !this._doSnapBackX && !this._doSnapBackY)
|
||||
{
|
||||
var x = this._sx;
|
||||
var y = this._sy;
|
||||
if (svdir === "x")
|
||||
x = -this._pagePos + this._pageDelta;
|
||||
else
|
||||
y = -this._pagePos + this._pageDelta;
|
||||
|
||||
this.scrollTo(x, y, this.options.snapbackDuration);
|
||||
}
|
||||
else if (sx || sy)
|
||||
this._startMScroll(sx, sy);
|
||||
else
|
||||
this._hideScrollBars();
|
||||
|
||||
this._disableTracking();
|
||||
|
||||
if (!this._didDrag && this.options.delayedClickEnabled && this._$clickEle.length) {
|
||||
this._$clickEle
|
||||
.trigger("mousedown")
|
||||
//.trigger("focus")
|
||||
.trigger("mouseup")
|
||||
.trigger("click");
|
||||
}
|
||||
|
||||
// If a view scrolled, then we need to absorb
|
||||
// the event so that links etc, underneath our
|
||||
// cursor/finger don't fire.
|
||||
|
||||
return this._didDrag ? false : undefined;
|
||||
},
|
||||
|
||||
_enableTracking: function()
|
||||
{
|
||||
$(document).bind(this._dragMoveEvt, this._dragMoveCB);
|
||||
$(document).bind(this._dragStopEvt, this._dragStopCB);
|
||||
},
|
||||
|
||||
_disableTracking: function()
|
||||
{
|
||||
$(document).unbind(this._dragMoveEvt, this._dragMoveCB);
|
||||
$(document).unbind(this._dragStopEvt, this._dragStopCB);
|
||||
},
|
||||
|
||||
_showScrollBars: function()
|
||||
{
|
||||
var vclass = "ui-scrollbar-visible";
|
||||
if (this._$vScrollBar) this._$vScrollBar.addClass(vclass);
|
||||
if (this._$hScrollBar) this._$hScrollBar.addClass(vclass);
|
||||
},
|
||||
|
||||
_hideScrollBars: function()
|
||||
{
|
||||
var vclass = "ui-scrollbar-visible";
|
||||
if (this._$vScrollBar) this._$vScrollBar.removeClass(vclass);
|
||||
if (this._$hScrollBar) this._$hScrollBar.removeClass(vclass);
|
||||
},
|
||||
|
||||
_addBehaviors: function()
|
||||
{
|
||||
var self = this;
|
||||
if (this.options.eventType === "mouse")
|
||||
{
|
||||
this._dragStartEvt = "mousedown";
|
||||
this._dragStartCB = function(e){ return self._handleDragStart(e, e.clientX, e.clientY); };
|
||||
|
||||
this._dragMoveEvt = "mousemove";
|
||||
this._dragMoveCB = function(e){ return self._handleDragMove(e, e.clientX, e.clientY); };
|
||||
|
||||
this._dragStopEvt = "mouseup";
|
||||
this._dragStopCB = function(e){ return self._handleDragStop(e); };
|
||||
}
|
||||
else // "touch"
|
||||
{
|
||||
this._dragStartEvt = "touchstart";
|
||||
this._dragStartCB = function(e)
|
||||
{
|
||||
var t = e.originalEvent.targetTouches[0];
|
||||
return self._handleDragStart(e, t.pageX, t.pageY);
|
||||
};
|
||||
|
||||
this._dragMoveEvt = "touchmove";
|
||||
this._dragMoveCB = function(e)
|
||||
{
|
||||
var t = e.originalEvent.targetTouches[0];
|
||||
return self._handleDragMove(e, t.pageX, t.pageY);
|
||||
};
|
||||
|
||||
this._dragStopEvt = "touchend";
|
||||
this._dragStopCB = function(e){ return self._handleDragStop(e); };
|
||||
}
|
||||
|
||||
this._$view.bind(this._dragStartEvt, this._dragStartCB);
|
||||
|
||||
if (this.options.showScrollBars)
|
||||
{
|
||||
var $c = this._$clip;
|
||||
var prefix = "<div class=\"ui-scrollbar ui-scrollbar-";
|
||||
var suffix = "\"><div class=\"ui-scrollbar-track\"><div class=\"ui-scrollbar-thumb\"></div></div></div>";
|
||||
if (this._vTracker)
|
||||
{
|
||||
$c.append(prefix + "y" + suffix);
|
||||
this._$vScrollBar = $c.children(".ui-scrollbar-y");
|
||||
}
|
||||
if (this._hTracker)
|
||||
{
|
||||
$c.append(prefix + "x" + suffix);
|
||||
this._$hScrollBar = $c.children(".ui-scrollbar-x");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function setElementTransform($ele, x, y)
|
||||
{
|
||||
var v = "translate3d(" + x + "," + y + ", 0px)";
|
||||
$ele.css({
|
||||
"-moz-transform": v,
|
||||
"-webkit-transform": v,
|
||||
"transform": v
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function MomentumTracker(options)
|
||||
{
|
||||
this.options = $.extend({}, options);
|
||||
this.easing = "easeOutQuad";
|
||||
this.reset();
|
||||
}
|
||||
|
||||
var tstates = {
|
||||
scrolling: 0,
|
||||
overshot: 1,
|
||||
snapback: 2,
|
||||
done: 3
|
||||
};
|
||||
|
||||
function getCurrentTime() { return (new Date()).getTime(); }
|
||||
|
||||
$.extend(MomentumTracker.prototype, {
|
||||
start: function(pos, speed, duration, minPos, maxPos)
|
||||
{
|
||||
this.state = (speed != 0) ? ((pos < minPos || pos > maxPos) ? tstates.snapback : tstates.scrolling) : tstates.done;
|
||||
this.pos = pos;
|
||||
this.speed = speed;
|
||||
this.duration = (this.state == tstates.snapback) ? this.options.snapbackDuration : duration;
|
||||
this.minPos = minPos;
|
||||
this.maxPos = maxPos;
|
||||
|
||||
this.fromPos = (this.state == tstates.snapback) ? this.pos : 0;
|
||||
this.toPos = (this.state == tstates.snapback) ? ((this.pos < this.minPos) ? this.minPos : this.maxPos) : 0;
|
||||
|
||||
this.startTime = getCurrentTime();
|
||||
},
|
||||
|
||||
reset: function()
|
||||
{
|
||||
this.state = tstates.done;
|
||||
this.pos = 0;
|
||||
this.speed = 0;
|
||||
this.minPos = 0;
|
||||
this.maxPos = 0;
|
||||
this.duration = 0;
|
||||
},
|
||||
|
||||
update: function()
|
||||
{
|
||||
var state = this.state;
|
||||
if (state == tstates.done)
|
||||
return this.pos;
|
||||
|
||||
var duration = this.duration;
|
||||
var elapsed = getCurrentTime() - this.startTime;
|
||||
elapsed = elapsed > duration ? duration : elapsed;
|
||||
|
||||
if (state == tstates.scrolling || state == tstates.overshot)
|
||||
{
|
||||
var dx = this.speed * (1 - $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
|
||||
|
||||
var x = this.pos + dx;
|
||||
|
||||
var didOverShoot = (state == tstates.scrolling) && (x < this.minPos || x > this.maxPos);
|
||||
if (didOverShoot)
|
||||
x = (x < this.minPos) ? this.minPos : this.maxPos;
|
||||
|
||||
this.pos = x;
|
||||
|
||||
if (state == tstates.overshot)
|
||||
{
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
this.state = tstates.snapback;
|
||||
this.fromPos = this.pos;
|
||||
this.toPos = (x < this.minPos) ? this.minPos : this.maxPos;
|
||||
this.duration = this.options.snapbackDuration;
|
||||
this.startTime = getCurrentTime();
|
||||
elapsed = 0;
|
||||
}
|
||||
}
|
||||
else if (state == tstates.scrolling)
|
||||
{
|
||||
if (didOverShoot)
|
||||
{
|
||||
this.state = tstates.overshot;
|
||||
this.speed = dx / 2;
|
||||
this.duration = this.options.overshootDuration;
|
||||
this.startTime = getCurrentTime();
|
||||
}
|
||||
else if (elapsed >= duration)
|
||||
this.state = tstates.done;
|
||||
}
|
||||
}
|
||||
else if (state == tstates.snapback)
|
||||
{
|
||||
if (elapsed >= duration)
|
||||
{
|
||||
this.pos = this.toPos;
|
||||
this.state = tstates.done;
|
||||
}
|
||||
else
|
||||
this.pos = this.fromPos + ((this.toPos - this.fromPos) * $.easing[this.easing](elapsed/duration, elapsed, 0, 1, duration));
|
||||
}
|
||||
|
||||
return this.pos;
|
||||
},
|
||||
|
||||
done: function() { return this.state == tstates.done; },
|
||||
getPosition: function(){ return this.pos; }
|
||||
});
|
||||
|
||||
jQuery.widget( "mobile.scrolllistview", jQuery.mobile.scrollview, {
|
||||
options: {
|
||||
direction: "y"
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
$.mobile.scrollview.prototype._create.call(this);
|
||||
|
||||
// Cache the dividers so we don't have to search for them everytime the
|
||||
// view is scrolled.
|
||||
//
|
||||
// XXX: Note that we need to update this cache if we ever support lists
|
||||
// that can dynamically update their content.
|
||||
|
||||
this._$dividers = this._$view.find("[data-role=list-divider]");
|
||||
this._lastDivider = null;
|
||||
},
|
||||
|
||||
_setScrollPosition: function(x, y)
|
||||
{
|
||||
// Let the view scroll like it normally does.
|
||||
|
||||
$.mobile.scrollview.prototype._setScrollPosition.call(this, x, y);
|
||||
|
||||
y = -y;
|
||||
|
||||
// Find the dividers for the list.
|
||||
|
||||
var $divs = this._$dividers;
|
||||
var cnt = $divs.length;
|
||||
var d = null;
|
||||
var dy = 0;
|
||||
var nd = null;
|
||||
|
||||
for (var i = 0; i < cnt; i++)
|
||||
{
|
||||
nd = $divs.get(i);
|
||||
var t = nd.offsetTop;
|
||||
if (y >= t)
|
||||
{
|
||||
d = nd;
|
||||
dy = t;
|
||||
}
|
||||
else if (d)
|
||||
break;
|
||||
}
|
||||
|
||||
// If we found a divider to move position it at the top of the
|
||||
// clip view.
|
||||
|
||||
if (d)
|
||||
{
|
||||
var h = d.offsetHeight;
|
||||
var mxy = (d != nd) ? nd.offsetTop : (this._$view.get(0).offsetHeight);
|
||||
if (y + h >= mxy)
|
||||
y = (mxy - h) - dy;
|
||||
else
|
||||
y = y - dy;
|
||||
|
||||
// XXX: Need to convert this over to using $().css() and supporting the non-transform case.
|
||||
|
||||
var ld = this._lastDivider;
|
||||
if (ld && d != ld) {
|
||||
setElementTransform($(ld), 0, 0);
|
||||
}
|
||||
setElementTransform($(d), 0, y + "px");
|
||||
this._lastDivider = d;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery,window,document); // End Component
|
@ -40,4 +40,6 @@ $string['showfullsizeimages'] = 'Show full images on site index and course pages
|
||||
$string['showfullsizeimages_desc'] = 'Show full size images on site index and course pages instead of replaced thumb icon method. Default is to not show full size images.';
|
||||
$string['usetableview'] = 'Tablet View';
|
||||
$string['usetableview_desc'] = 'Use the tablet view for larger devices (yes by default).';
|
||||
$string['yes'] = 'Yes';
|
||||
$string['yes'] = 'Yes';
|
||||
$string['customcss'] = 'Custom CSS';
|
||||
$string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.';
|
@ -35,11 +35,11 @@ if ($showswatch == "light") {
|
||||
$datatheme = 'a';
|
||||
$databodytheme = 'c';
|
||||
}
|
||||
$mypagetype = $PAGE->pagetype;
|
||||
$bodyclasses = array();
|
||||
$mypagetype = $PAGE->pagetype;
|
||||
|
||||
echo $OUTPUT->doctype() ?>
|
||||
<html <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<html id="mymobile" <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<head>
|
||||
<title><?php echo $PAGE->title ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
|
||||
@ -64,7 +64,7 @@ echo $OUTPUT->doctype() ?>
|
||||
<a class="ui-btn-right" data-ajax="false" data-icon="home" href="<?php p($CFG->wwwroot) ?>" data-iconpos="notext"><?php p(get_string('home')); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div data-role="content" data-theme="<?php echo $databodytheme;?>">
|
||||
<div data-role="content" class="mymobilecontent" data-theme="<?php echo $databodytheme;?>">
|
||||
<?php echo $OUTPUT->main_content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -72,4 +72,4 @@ echo $OUTPUT->doctype() ?>
|
||||
<!-- START OF FOOTER -->
|
||||
<?php echo $OUTPUT->standard_end_of_body_html() ?>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -105,7 +105,7 @@ $usercol = (mymobile_get_colpos() == 'on');
|
||||
$renderer = $PAGE->get_renderer('theme_mymobile');
|
||||
|
||||
echo $OUTPUT->doctype() ?>
|
||||
<html <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<html id="mymobile" <?php echo $OUTPUT->htmlattributes() ?>>
|
||||
<head>
|
||||
<title><?php echo $PAGE->title ?></title>
|
||||
<link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
|
||||
@ -122,7 +122,7 @@ echo $OUTPUT->doctype() ?>
|
||||
<?php echo $OUTPUT->standard_top_of_body_html() ?>
|
||||
<div id="<?php p($PAGE->bodyid) ?>PAGE" data-role="page" class="generalpage <?php echo 'ajaxedclass '; p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)); ?> <?php if ($hasmyblocks && $usercol) { echo 'has-myblocks'; } ?> " data-title="<?php p($SITE->shortname) ?>">
|
||||
<!-- start header -->
|
||||
<div data-role="header" <?php echo($datatheme);?> class="mymobileheader">
|
||||
<div data-role="header" <?php echo($datatheme);?> class="mymobileheader" data-position="fixed">
|
||||
<h1><?php echo $PAGE->heading ?></h1>
|
||||
<?php if (isloggedin() && $mypagetype != 'site-index') { ?>
|
||||
<a class="ui-btn-right" data-icon="home" href="<?php p($CFG->wwwroot) ?>" data-iconpos="notext" data-ajax="false"><?php p(get_string('home')); ?></a>
|
||||
@ -210,7 +210,7 @@ echo $OUTPUT->doctype() ?>
|
||||
|
||||
<div data-role="fieldcontain" id="sliderdiv">
|
||||
<label for="slider"><?php p(get_string('mtoggle','theme_mymobile')); ?>:</label>
|
||||
<select name="slider" class="slider" data-role="slider" data-track-theme="b">
|
||||
<select name="slider" class="slider" data-role="slider">
|
||||
<option value="on">On</option>
|
||||
<option value="off">Off</option>
|
||||
</select>
|
||||
|
@ -40,4 +40,27 @@ function mymobile_initialise_colpos(moodle_page $page) {
|
||||
*/
|
||||
function mymobile_get_colpos($default = 'on') {
|
||||
return get_user_preferences('theme_mymobile_chosen_colpos', $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes our changes to the CSS
|
||||
*
|
||||
* @param string $css
|
||||
* @param theme_config $theme
|
||||
* @return string
|
||||
*/
|
||||
function mymobile_user_settings($css, $theme) {
|
||||
if (!empty($theme->settings->customcss)) {
|
||||
$customcss = $theme->settings->customcss;
|
||||
} else {
|
||||
$customcss = null;
|
||||
}
|
||||
$css = mymobile_set_customcss($css, $customcss);
|
||||
return $css;
|
||||
}
|
||||
|
||||
function mymobile_set_customcss($css, $customcss) {
|
||||
$tag = '[[setting:customcss]]';
|
||||
$css = str_replace($tag, $customcss, $css);
|
||||
return $css;
|
||||
}
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 340 B |
BIN
theme/mymobile/pix/ajax-loader2.gif
Normal file
After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.6 KiB |
@ -179,8 +179,8 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
$skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
|
||||
}
|
||||
$testb = $bc->attributes['class'];
|
||||
|
||||
// TODO: Find a better solution to this hardcoded block checks
|
||||
$testc = $bc->attributes['id'];
|
||||
// TODO: Find a better solution to this hardcoded block checks.
|
||||
if ($testb == "block_calendar_month2 block") {
|
||||
$output = html_writer::start_tag('span');
|
||||
} else if ($testb == "block_course_overview block") {
|
||||
@ -196,7 +196,12 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
} else {
|
||||
$dtheme = 'c';
|
||||
}
|
||||
$output = html_writer::start_tag('div', array('data-role' => 'collapsible', 'data-collapsed' => 'true', 'data-content-theme' => $dtheme));
|
||||
if ($testc == "mod_quiz_navblock") {
|
||||
$collap = 'false';
|
||||
} else {
|
||||
$collap = 'true';
|
||||
}
|
||||
$output = html_writer::start_tag('div', array('data-role' => 'collapsible', 'data-collapsed' => $collap, 'data-content-theme' => $dtheme));
|
||||
}
|
||||
|
||||
$output .= html_writer::tag('h1', $this->block_header($bc));
|
||||
@ -359,7 +364,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
} else {
|
||||
$loggedinas .= get_string('failedloginattemptsall', '', $count);
|
||||
}
|
||||
if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (file_exists("$CFG->dirroot/report/log/index.php") and has_capability('report/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
|
||||
}
|
||||
$loggedinas .= '</div>';
|
||||
@ -442,7 +447,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
} else {
|
||||
$loggedinas .= get_string('failedloginattemptsall', '', $count);
|
||||
}
|
||||
if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (has_capability('report/log:view', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
$loggedinas .= ' (<a href="'.$CFG->wwwroot.'/course/report/log/index.php?chooselog=1&id=1&modid=site_errors">'.get_string('logs').'</a>)';
|
||||
}
|
||||
$loggedinas .= '</div>';
|
||||
@ -548,7 +553,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
$attributes['id'] = $id;
|
||||
$attributes['rel'] = 'notexternal';
|
||||
$attributes['data-rel'] = 'dialog';
|
||||
$attributes['data-transition'] = 'slideup';
|
||||
$attributes['data-transition'] = 'flow';
|
||||
$output = html_writer::tag('a', $output, $attributes);
|
||||
|
||||
// and finally span
|
||||
@ -758,7 +763,7 @@ class theme_mymobile_core_renderer extends core_renderer {
|
||||
|
||||
//by john show go button to fix selects
|
||||
$go = '';
|
||||
$output .= html_writer::empty_tag('input data-inline="true"', array('type' => 'submit', 'value' => get_string('go')));
|
||||
$output .= html_writer::empty_tag('input data-inline="true"', array('type' => 'submit','value' => get_string('go')));
|
||||
$output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style' => 'inline'));
|
||||
|
||||
$nothing = empty($select->nothing) ? false : key($select->nothing);
|
||||
|
@ -74,6 +74,13 @@ if ($ADMIN->fulltree) {
|
||||
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
||||
$settings->add($setting);
|
||||
|
||||
$name = 'theme_mymobile/customcss';
|
||||
$title = get_string('customcss','theme_mymobile');
|
||||
$description = get_string('customcssdesc', 'theme_mymobile');
|
||||
$default = '';
|
||||
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
|
||||
$settings->add($setting);
|
||||
|
||||
unset($yesstr);
|
||||
unset($nostr);
|
||||
}
|
@ -124,17 +124,22 @@ div.notifyproblem {
|
||||
cursor:default !important;
|
||||
}
|
||||
/*under footer */
|
||||
#underfooter {
|
||||
padding: 1em 0em;
|
||||
font-size: 90%;
|
||||
}
|
||||
#underfooter .logininfo {
|
||||
text-align: center;
|
||||
padding-top: .8em !important;
|
||||
padding-bottom: .8em;
|
||||
font-size: .8em;
|
||||
font-weight: 400;
|
||||
padding-top: .0em !important;
|
||||
padding-bottom: .0em;
|
||||
font-size: inherit;
|
||||
font-weight: normal;
|
||||
}
|
||||
#underfooter div {
|
||||
#underfooter #theme_switch_link {
|
||||
padding-top: 0.5em;
|
||||
text-align: center;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#underfooter .noajax {
|
||||
padding-bottom: .2em;
|
||||
}
|
||||
@ -584,9 +589,6 @@ table.forumheaderlist2 td.topic a {
|
||||
div.discussioncontrols {
|
||||
display: none;
|
||||
}
|
||||
.path-mod-forum .indent {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.path-mod-forum div.subject {
|
||||
font-size: 120%;
|
||||
}
|
||||
@ -1274,7 +1276,7 @@ li.reportoption, #page-mod-choice-report .downloadreport ul li {
|
||||
width:100%;
|
||||
overflow: auto;
|
||||
}
|
||||
.path-mod-choice .ui-scrollview-clip .names {
|
||||
.path-mod-choice .names {
|
||||
max-width: 1500px;
|
||||
min-width: 480px;
|
||||
}
|
||||
@ -1441,94 +1443,16 @@ overflow:auto !important;
|
||||
.course_category_tree .controls {
|
||||
display: none;
|
||||
}
|
||||
/*scrollview */
|
||||
.ui-scrollview-clip {
|
||||
}
|
||||
.ui-scrollview-view {
|
||||
}
|
||||
.ui-scrolllistview .ui-li-divider {
|
||||
z-index: 10;
|
||||
}
|
||||
.ui-scrollbar {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
-webkit-transition: opacity 500ms;
|
||||
-moz-transition: opacity 500ms;
|
||||
transition: opacity 500ms;
|
||||
opacity: .3;
|
||||
}
|
||||
.ui-scrollbar-visible {
|
||||
opacity: 1;
|
||||
}
|
||||
.ui-scrollbar-y {
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
bottom: 8px;
|
||||
width: 5px;
|
||||
}
|
||||
.ui-scrollbar-x {
|
||||
right: 8px;
|
||||
bottom: 2px;
|
||||
left: 2px;
|
||||
height: 5px;
|
||||
}
|
||||
.ui-scrollbar-track {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-scrollbar-thumb {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.ui-scrollbar-y .ui-scrollbar-thumb {
|
||||
width: 5px;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-scrollbar-x .ui-scrollbar-thumb {
|
||||
width: 100%;
|
||||
height: 5px;
|
||||
/*touch overflow to allow scrolling of divs, replaces old scrollview method*/
|
||||
.gradeparent, .pagelayout-report .no-overflow, .path-mod-choice .response, .resourcecontent.resourceimg, .usersubmissions .no-overflow, .path-course-report-log .generaltable, table.results.anonymous, table.surveytable, div.resultgraph, div.reportsummary a, #completion-progress, #attempts {
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
/*some loader overrides to hide the loading message */
|
||||
body .ui-loader {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 1em;
|
||||
background-color: #000;
|
||||
opacity: 1;
|
||||
background-position: center center;
|
||||
-webkit-border-top-left-radius: 0.7em;
|
||||
-webkit-border-top-right-radius: 0.7em;
|
||||
-webkit-border-bottom-right-radius: 0.7em;
|
||||
-webkit-border-bottom-left-radius: 0.7em;
|
||||
-moz-border-radius-topleft: 0.7em;
|
||||
-moz-border-radius-topright: 0.7em;
|
||||
-moz-border-radius-bottomright: 0.7em;
|
||||
-moz-border-radius-bottomleft: 0.7em;
|
||||
border-top-left-radius: 0.7em;
|
||||
border-top-right-radius: 0.7em;
|
||||
border-bottom-right-radius: 0.7em;
|
||||
border-bottom-left-radius: 0.7em;
|
||||
width: 35px;
|
||||
margin-left: -35px;
|
||||
.ui-loader-default {
|
||||
background: #000000;
|
||||
opacity: 0.8;
|
||||
}
|
||||
body .ui-loader.ui-body-e {
|
||||
width: inherit;
|
||||
color: #fff;
|
||||
padding: 2em;
|
||||
}
|
||||
body .ui-loader h1 {
|
||||
display: none;
|
||||
}
|
||||
body .ui-loader.ui-body-e h1 {
|
||||
display: inherit;
|
||||
}
|
||||
.ui-loader .ui-icon { opacity: 1; }
|
||||
/*current highlight */
|
||||
.weeks .current .headingwrap, .topics .current div.headingwrap, .current .ui-bar-b, .current .left.side, .tabtree ul.tabrow0 li.selected a, .ui-btn-active, #page-course-view-topcollPAGE .current {
|
||||
border: 1px solid #F7C942;
|
||||
@ -1569,9 +1493,13 @@ body .ui-loader.ui-body-e h1 {
|
||||
.ui-navbar .ui-select2 .ui-btn-corner-all, .ui-navbar .ui-select .ui-btn-inner {
|
||||
border-radius: 0em 0em 0em 0em;
|
||||
}
|
||||
.ui-navbar .ui-select .ui-btn-icon-right .ui-btn-inner {
|
||||
.ui-navbar .ui-select .ui-btn-icon-right .ui-btn-inner2 {
|
||||
padding-right: 5px;
|
||||
}
|
||||
.ui-navbar .ui-select .ui-btn-icon-right .ui-btn-inner {
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
.ui-header .ui-navbar li .ui-btn {
|
||||
-webkit-border-radius: .4em /*{global-radii-blocks}*/;
|
||||
-webkit-border-radius: .4em .4em .4em .4em;
|
||||
@ -1594,10 +1522,21 @@ body .ui-loader.ui-body-e h1 {
|
||||
padding-bottom: 0.6em;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
.ui-header .ui-fullsize .ui-btn-inner, .ui-footer .ui-fullsize .ui-btn-inner {
|
||||
font-size: 12.5px;
|
||||
}
|
||||
/*split page stuff for tablets */
|
||||
div.tablets, #sliderdiv, .has-myblocks .jsetsbar {
|
||||
display: none;
|
||||
div.tablets, #sliderdiv, .has-myblocks .jsetsbar {
|
||||
display: none;
|
||||
}
|
||||
@media all and (max-width: 480px){
|
||||
.ui-footer.mobilefooter .ui-btn-icon-top .ui-btn-inner, .mobilefooter .ui-mini .ui-btn-icon-top .ui-btn-inner {
|
||||
padding: 0.7em 3px 0.7em;
|
||||
}
|
||||
.ui-footer.mobilefooter .ui-btn-icon-top .ui-icon, .mobilefooter .ui-mini.ui-btn-icon-top .ui-icon, .mobilefooter .ui-mini .ui-btn-icon-top .ui-icon {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 650px){
|
||||
.has-myblocks div.tablets, .content-secondary, #sliderdiv {
|
||||
display: block;
|
||||
@ -1711,3 +1650,5 @@ body .ui-loader.ui-body-e h1 {
|
||||
max-width: 100px;
|
||||
max-height: 100px;
|
||||
}
|
||||
/** Custom CSS **/
|
||||
[[setting:customcss]]
|
@ -41,6 +41,9 @@
|
||||
.path-mod-forum div.subject {
|
||||
font-size: 100%;
|
||||
}
|
||||
.path-mod-forum .indent {
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
@media all and (max-width: 650px){
|
||||
.forumpost div.commands a {
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2012061700; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2012061700; // Requires this Moodle version
|
||||
$plugin->version = 2012061901; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011070101; // Requires this Moodle version
|
||||
$plugin->component = 'theme_mymobile';
|
||||
$plugin->maturity = MATURITY_STABLE;
|