初始版本
This commit is contained in:
14
statics/mobile/js/Adaptive.js
Executable file
14
statics/mobile/js/Adaptive.js
Executable file
@@ -0,0 +1,14 @@
|
||||
// JavaScript Document
|
||||
(function (doc, win) {
|
||||
var docEl = doc.documentElement,
|
||||
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
|
||||
recalc = function () {
|
||||
var clientWidth = docEl.clientWidth;
|
||||
if (!clientWidth) return;
|
||||
docEl.style.fontSize = 100 * (clientWidth / 400) + 'px';
|
||||
};
|
||||
|
||||
if (!doc.addEventListener) return;
|
||||
win.addEventListener(resizeEvt, recalc, false);
|
||||
doc.addEventListener('DOMContentLoaded', recalc, false);
|
||||
})(document, window);
|
||||
63
statics/mobile/js/auto-alert.js
Executable file
63
statics/mobile/js/auto-alert.js
Executable file
@@ -0,0 +1,63 @@
|
||||
|
||||
(function() {
|
||||
|
||||
$.extend($.fn, {
|
||||
|
||||
//提示框组件
|
||||
alert: function(options) {
|
||||
|
||||
var defaults = {
|
||||
tip: '选择单据状态',
|
||||
maskColor: '#000',
|
||||
colors:['#449d44','#1B96A9','#e73268'],
|
||||
btnLbl:[['采购订单','购货单', '销货单'],['客户订单','销货单', '销退单']],
|
||||
callback:[[null,null, null],[null,null, null]]
|
||||
};
|
||||
|
||||
var settings = $.extend(defaults, options || {}),
|
||||
$this;
|
||||
|
||||
function initialize() {
|
||||
var HTML = '<div style="background:#000;opacity:.5;position:fixed;z-index:99999;left:0px;top:0px;width:100%;height:100%;">'+
|
||||
'</div>'+
|
||||
'<div style="background-color: #fff;width: 80%;margin: auto;position: fixed;left: 50%;top: 50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align: center;border-radius: 5px;z-index:100000;display:table;">'+
|
||||
'<div style="display:table;width:100%;border-bottom:2px solid #e73268;">'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;text-align:center;font-size:16px;color:#e73268;padding-left:10px;">' +
|
||||
settings.tip +
|
||||
'</span>'+
|
||||
'</div>';
|
||||
for(var i = 0 ; i < settings.btnLbl.length ; i++){
|
||||
var lbl = settings.btnLbl[i];
|
||||
HTML += '<div style="display:table;width:100%;">';
|
||||
for(var j = 0 ; j < lbl.length ; j++){
|
||||
HTML += '<span style="display:'+(lbl[j]?'table-cell':'none')+';width:'+(100/lbl.length)+'%;font-weight:bold;height:60px;line-height:50px;vertical-align:middle;font-size:16px;color:'+settings.colors[i]+';">';
|
||||
HTML += lbl[j];
|
||||
HTML += '</span>';
|
||||
}
|
||||
HTML += '</div>';
|
||||
}
|
||||
HTML += '</div>';
|
||||
$this = $(HTML).appendTo($('body'));
|
||||
for(var i = 0 ; i < settings.btnLbl.length ; i++){
|
||||
var $btn = $this.children('div:eq('+(i+1)+')');
|
||||
var lbl = settings.btnLbl[i];
|
||||
for(var j = 0 ; j < lbl.length ; j++){
|
||||
var callback = settings.callback[i][j];
|
||||
$btn.children().eq(j).off('click',callbackHandler).on('click',callback, callbackHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function callbackHandler(e) {
|
||||
var callback = e.data;
|
||||
$this.remove();
|
||||
if (callback && typeof callback == 'function') {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
initialize();
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})(jQuery)
|
||||
105
statics/mobile/js/date-alert.js
Executable file
105
statics/mobile/js/date-alert.js
Executable file
@@ -0,0 +1,105 @@
|
||||
(function() {
|
||||
Date.prototype.Format = function (fmt) { //author: meizz
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
$.extend($.fn, {
|
||||
|
||||
//提示框组件
|
||||
alert: function(options) {
|
||||
|
||||
var defaults = {
|
||||
tip: '',
|
||||
cancelBtnLbl: '取消',
|
||||
confirmBtnLbl: '确定',
|
||||
otherBtnLbl: '其他',
|
||||
maskColor: '#000',
|
||||
cancelCallback: null,
|
||||
confirmCallback: null
|
||||
};
|
||||
|
||||
var settings = $.extend(defaults, options || {}),
|
||||
$this;
|
||||
|
||||
function initialize() {
|
||||
var HTML = '<div style="background:#000;opacity:.5;position:fixed;z-index:999;left:0px;top:0px;width:100%;height:100%;">'+
|
||||
'</div>'+
|
||||
'<div style="background-color: #fff;width: 80%;margin: auto;position: fixed;left: 50%;top: 50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align: center;border-radius: 5px;z-index:1000;display:table;">'+
|
||||
'<div style="display:table;width:100%;border-bottom:2px solid #e73268;">'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;text-align:center;font-size:16px;color:#e73268;padding-left:10px;">' +
|
||||
settings.tip +
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div style="display:table;width:100%;border-bottom:2px solid #e73268;">'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;font-size:16px;">' +
|
||||
'<input style="text-align:center;height: 40px;width: 90%;display: block;padding: 0 10px;line-height: 40px;font-size: 16px;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;border: 0px #eee solid;margin: 5px auto;" type="text" name="selDate" id="selDate" readonly class="input" />'+
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div style="display:table;width:100%;">'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;font-size:16px;color:#e73268;" id="alertBtn">' +
|
||||
settings.cancelBtnLbl +
|
||||
'</span>'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;border-left:1px solid #EAEAEA;color:#1B96A9;font-size:16px">' +
|
||||
settings.confirmBtnLbl +
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
$this = $(HTML).appendTo($('body'));
|
||||
var $btn = $this.children('div:eq(2)');
|
||||
$btn.children().eq(0).off('click', cancelBtnClickHandler).on('click', cancelBtnClickHandler);
|
||||
$btn.children().eq(1).off('click', confirmBtnClickHandler).on('click', confirmBtnClickHandler);
|
||||
var currYear = (new Date()).getFullYear();
|
||||
var opt={};
|
||||
opt.date = {preset : 'date'};
|
||||
opt.datetime = {preset : 'datetime'};
|
||||
opt.time = {preset : 'time'};
|
||||
opt.default = {
|
||||
theme: 'android-ics light', //皮肤样式
|
||||
display: 'modal', //显示方式
|
||||
mode: 'scroller', //日期选择模式
|
||||
dateFormat: 'yyyy-mm-dd',
|
||||
lang: 'zh',
|
||||
showNow: true,
|
||||
nowText: "今天",
|
||||
startYear: currYear - 50, //开始年份
|
||||
endYear: currYear + 10 //结束年份
|
||||
};
|
||||
|
||||
$("#selDate").mobiscroll($.extend(opt['date'], opt['default']));
|
||||
$("#selDate").val(new Date().Format("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
//取消按钮事件
|
||||
function cancelBtnClickHandler() {
|
||||
if (settings.cancelCallback && typeof settings.cancelCallback == 'function') {
|
||||
settings.cancelCallback();
|
||||
}
|
||||
$this.remove();
|
||||
}
|
||||
|
||||
function confirmBtnClickHandler() {
|
||||
if (settings.confirmCallback && typeof settings.confirmCallback == 'function') {
|
||||
settings.confirmCallback();
|
||||
}
|
||||
$this.remove();
|
||||
}
|
||||
|
||||
|
||||
initialize();
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})(jQuery)
|
||||
12
statics/mobile/js/ichart.1.2.1.min.js
vendored
Executable file
12
statics/mobile/js/ichart.1.2.1.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
4
statics/mobile/js/jquery-1.7.1.min.js
vendored
Executable file
4
statics/mobile/js/jquery-1.7.1.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
136
statics/mobile/js/jquery.fly.min.js
vendored
Executable file
136
statics/mobile/js/jquery.fly.min.js
vendored
Executable file
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Created by zhouweipeng on 2016/12/26.
|
||||
*/
|
||||
/*! fly - v1.0.0 - 2014-12-22
|
||||
* https://github.com/amibug/fly
|
||||
* Copyright (c) 2014 wuyuedong; Licensed MIT */
|
||||
(function ($) {
|
||||
$.fly = function (element, options) {
|
||||
// 默认值
|
||||
var defaults = {
|
||||
version: '1.0.0',
|
||||
autoPlay: true,
|
||||
vertex_Rtop: 20, // 默认顶点高度top值
|
||||
speed: 1.2,
|
||||
start: {}, // top, left, width, height
|
||||
end: {},
|
||||
onEnd: $.noop
|
||||
};
|
||||
|
||||
var self = this,
|
||||
$element = $(element);
|
||||
|
||||
/**
|
||||
* 初始化组件,new的时候即调用
|
||||
*/
|
||||
self.init = function (options) {
|
||||
this.setOptions(options);
|
||||
!!this.settings.autoPlay && this.play();
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置组件参数
|
||||
*/
|
||||
self.setOptions = function (options) {
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
var settings = this.settings,
|
||||
start = settings.start,
|
||||
end = settings.end;
|
||||
|
||||
$element.css({marginTop: '0px', marginLeft: '0px', position: 'fixed'}).appendTo('body');
|
||||
// 运动过程中有改变大小
|
||||
if (end.width != null && end.height != null) {
|
||||
$.extend(true, start, {
|
||||
width: $element.width(),
|
||||
height: $element.height()
|
||||
});
|
||||
}
|
||||
// 运动轨迹最高点top值
|
||||
var vertex_top = Math.min(start.top, end.top) - Math.abs(start.left - end.left) / 3;
|
||||
if (vertex_top < settings.vertex_Rtop) {
|
||||
// 可能出现起点或者终点就是运动曲线顶点的情况
|
||||
vertex_top = Math.min(settings.vertex_Rtop, Math.min(start.top, end.top));
|
||||
}
|
||||
|
||||
/**
|
||||
* 运动轨迹在页面中的top值可以抽象成函数 y = a * x*x + b;
|
||||
* a = curvature
|
||||
* b = vertex_top
|
||||
*/
|
||||
|
||||
var distance = Math.sqrt(Math.pow(start.top - end.top, 2) + Math.pow(start.left - end.left, 2)),
|
||||
// 元素移动次数
|
||||
steps = Math.ceil(Math.min(Math.max(Math.log(distance) / 0.05 - 75, 30), 100) / settings.speed),
|
||||
ratio = start.top == vertex_top ? 0 : -Math.sqrt((end.top - vertex_top) / (start.top - vertex_top)),
|
||||
vertex_left = (ratio * start.left - end.left) / (ratio - 1),
|
||||
// 特殊情况,出现顶点left==终点left,将曲率设置为0,做直线运动。
|
||||
curvature = end.left == vertex_left ? 0 : (end.top - vertex_top) / Math.pow(end.left - vertex_left, 2);
|
||||
|
||||
$.extend(true, settings, {
|
||||
count: -1, // 每次重置为-1
|
||||
steps: steps,
|
||||
vertex_left: vertex_left,
|
||||
vertex_top: vertex_top,
|
||||
curvature: curvature
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 开始运动,可自己调用
|
||||
*/
|
||||
self.play = function () {
|
||||
this.move();
|
||||
};
|
||||
|
||||
/**
|
||||
* 按step运动
|
||||
*/
|
||||
self.move = function () {
|
||||
var settings = this.settings,
|
||||
start = settings.start,
|
||||
count = settings.count,
|
||||
steps = settings.steps,
|
||||
end = settings.end;
|
||||
// 计算left top值
|
||||
var left = start.left + (end.left - start.left) * count / steps,
|
||||
top = settings.curvature == 0 ? start.top + (end.top - start.top) * count / steps : settings.curvature * Math.pow(left - settings.vertex_left, 2) + settings.vertex_top;
|
||||
// 运动过程中有改变大小
|
||||
if (end.width != null && end.height != null) {
|
||||
var i = steps / 2,
|
||||
width = end.width - (end.width - start.width) * Math.cos(count < i ? 0 : (count - i) / (steps - i) * Math.PI / 2),
|
||||
height = end.height - (end.height - start.height) * Math.cos(count < i ? 0 : (count - i) / (steps - i) * Math.PI / 2);
|
||||
$element.css({width: width + "px", height: height + "px", "font-size": Math.min(width, height) + "px"});
|
||||
}
|
||||
$element.css({
|
||||
left: left + "px",
|
||||
top: top + "px"
|
||||
});
|
||||
settings.count++;
|
||||
// 定时任务
|
||||
var time = window.requestAnimationFrame($.proxy(this.move, this));
|
||||
if (count == steps) {
|
||||
window.cancelAnimationFrame(time);
|
||||
// fire callback
|
||||
settings.onEnd.apply(this);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
*/
|
||||
self.destory = function(){
|
||||
$element.remove();
|
||||
};
|
||||
|
||||
self.init(options);
|
||||
};
|
||||
|
||||
// add the plugin to the jQuery.fn object
|
||||
$.fn.fly = function (options) {
|
||||
return this.each(function () {
|
||||
if (undefined == $(this).data('fly')) {
|
||||
$(this).data('fly', new $.fly(this, options));
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
205
statics/mobile/js/jquery.nav.js
Executable file
205
statics/mobile/js/jquery.nav.js
Executable file
@@ -0,0 +1,205 @@
|
||||
|
||||
;(function($, window, document, undefined){
|
||||
|
||||
// our plugin constructor
|
||||
var OnePageNav = function(elem, options){
|
||||
this.elem = elem;
|
||||
this.$elem = $(elem);
|
||||
this.options = options;
|
||||
this.metadata = this.$elem.data('plugin-options');
|
||||
this.$win = $(window);
|
||||
this.sections = {};
|
||||
this.didScroll = false;
|
||||
this.$doc = $(document);
|
||||
this.docHeight = this.$doc.height();
|
||||
};
|
||||
|
||||
// the plugin prototype
|
||||
OnePageNav.prototype = {
|
||||
defaults: {
|
||||
navItems: 'a',
|
||||
currentClass: 'current',
|
||||
changeHash: false,
|
||||
easing: 'swing',
|
||||
filter: '',
|
||||
scrollSpeed: 750,
|
||||
scrollThreshold: 0.5,
|
||||
begin: false,
|
||||
end: false,
|
||||
scrollChange: false
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// Introduce defaults that can be extended either
|
||||
// globally or using an object literal.
|
||||
this.config = $.extend({}, this.defaults, this.options, this.metadata);
|
||||
|
||||
this.$nav = this.$elem.find(this.config.navItems);
|
||||
|
||||
//Filter any links out of the nav
|
||||
if(this.config.filter !== '') {
|
||||
this.$nav = this.$nav.filter(this.config.filter);
|
||||
}
|
||||
|
||||
//Handle clicks on the nav
|
||||
this.$nav.on('click.onePageNav', $.proxy(this.handleClick, this));
|
||||
|
||||
//Get the section positions
|
||||
this.getPositions();
|
||||
|
||||
//Handle scroll changes
|
||||
this.bindInterval();
|
||||
|
||||
//Update the positions on resize too
|
||||
this.$win.on('resize.onePageNav', $.proxy(this.getPositions, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
adjustNav: function(self, $parent) {
|
||||
self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass);
|
||||
$parent.addClass(self.config.currentClass);
|
||||
},
|
||||
|
||||
bindInterval: function() {
|
||||
var self = this;
|
||||
var docHeight;
|
||||
|
||||
self.$win.on('scroll.onePageNav', function() {
|
||||
self.didScroll = true;
|
||||
});
|
||||
|
||||
self.t = setInterval(function() {
|
||||
docHeight = self.$doc.height();
|
||||
|
||||
//If it was scrolled
|
||||
if(self.didScroll) {
|
||||
self.didScroll = false;
|
||||
self.scrollChange();
|
||||
}
|
||||
|
||||
//If the document height changes
|
||||
if(docHeight !== self.docHeight) {
|
||||
self.docHeight = docHeight;
|
||||
self.getPositions();
|
||||
}
|
||||
}, 250);
|
||||
},
|
||||
|
||||
getHash: function($link) {
|
||||
return $link.attr('href').split('#')[1];
|
||||
},
|
||||
|
||||
getPositions: function() {
|
||||
var self = this;
|
||||
var linkHref;
|
||||
var topPos;
|
||||
var $target;
|
||||
|
||||
self.$nav.each(function() {
|
||||
linkHref = self.getHash($(this));
|
||||
$target = $('#' + linkHref);
|
||||
|
||||
if($target.length) {
|
||||
topPos = $target.offset().top;
|
||||
self.sections[linkHref] = Math.round(topPos);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getSection: function(windowPos) {
|
||||
var returnValue = null;
|
||||
var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold);
|
||||
|
||||
for(var section in this.sections) {
|
||||
if((this.sections[section] - windowHeight) < windowPos) {
|
||||
returnValue = section;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
|
||||
handleClick: function(e) {
|
||||
var self = this;
|
||||
var $link = $(e.currentTarget);
|
||||
var $parent = $link.parent();
|
||||
var newLoc = '#' + self.getHash($link);
|
||||
|
||||
if(!$parent.hasClass(self.config.currentClass)) {
|
||||
//Start callback
|
||||
if(self.config.begin) {
|
||||
self.config.begin();
|
||||
}
|
||||
|
||||
//Change the highlighted nav item
|
||||
self.adjustNav(self, $parent);
|
||||
|
||||
//Removing the auto-adjust on scroll
|
||||
self.unbindInterval();
|
||||
|
||||
//Scroll to the correct position
|
||||
self.scrollTo(newLoc, function() {
|
||||
//Do we need to change the hash?
|
||||
if(self.config.changeHash) {
|
||||
window.location.hash = newLoc;
|
||||
}
|
||||
|
||||
//Add the auto-adjust on scroll back in
|
||||
self.bindInterval();
|
||||
|
||||
//End callback
|
||||
if(self.config.end) {
|
||||
self.config.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
scrollChange: function() {
|
||||
var windowTop = this.$win.scrollTop();
|
||||
var position = this.getSection(windowTop);
|
||||
var $parent;
|
||||
|
||||
//If the position is set
|
||||
if(position !== null) {
|
||||
$parent = this.$elem.find('a[href$="#' + position + '"]').parent();
|
||||
|
||||
//If it's not already the current section
|
||||
if(!$parent.hasClass(this.config.currentClass)) {
|
||||
//Change the highlighted nav item
|
||||
this.adjustNav(this, $parent);
|
||||
|
||||
//If there is a scrollChange callback
|
||||
if(this.config.scrollChange) {
|
||||
this.config.scrollChange($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scrollTo: function(target, callback) {
|
||||
var offset = $(target).offset().top;
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: offset
|
||||
}, this.config.scrollSpeed, this.config.easing, callback);
|
||||
},
|
||||
|
||||
unbindInterval: function() {
|
||||
clearInterval(this.t);
|
||||
this.$win.unbind('scroll.onePageNav');
|
||||
}
|
||||
};
|
||||
|
||||
OnePageNav.defaults = OnePageNav.prototype.defaults;
|
||||
|
||||
$.fn.onePageNav = function(options) {
|
||||
return this.each(function() {
|
||||
new OnePageNav(this, options).init();
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
||||
79
statics/mobile/js/lanren-alert.js
Executable file
79
statics/mobile/js/lanren-alert.js
Executable file
@@ -0,0 +1,79 @@
|
||||
|
||||
(function() {
|
||||
|
||||
$.extend($.fn, {
|
||||
|
||||
//提示框组件
|
||||
alert: function(options) {
|
||||
|
||||
var defaults = {
|
||||
tip: '',
|
||||
cancelBtnLbl: '取消',
|
||||
confirmBtnLbl: '确定',
|
||||
otherBtnLbl: '其他',
|
||||
maskColor: '#000',
|
||||
cancelCallback: null,
|
||||
confirmCallback: null,
|
||||
otherCallback:null
|
||||
};
|
||||
|
||||
var settings = $.extend(defaults, options || {}),
|
||||
$this;
|
||||
|
||||
function initialize() {
|
||||
var HTML = '<div style="background:#000;opacity:.5;position:fixed;z-index:99999;left:0px;top:0px;width:100%;height:100%;">'+
|
||||
'</div>'+
|
||||
'<div style="background-color: #fff;width: 80%;margin: auto;position: fixed;left: 50%;top: 50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align: center;border-radius: 5px;z-index:100000;display:table;">'+
|
||||
'<div style="display:table;width:100%;border-bottom:2px solid #e73268;">'+
|
||||
'<span style="display:table-cell;height:50px;line-height:50px;vertical-align:middle;text-align:center;font-size:16px;color:#e73268;padding-left:10px;">' +
|
||||
settings.tip +
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div style="display:table;width:100%;">'+
|
||||
'<span style="display:'+(settings.cancelBtnLbl?'table-cell':'none')+';height:50px;line-height:50px;vertical-align:middle;font-size:16px;color:#449d44;" id="alertBtn">' +
|
||||
settings.cancelBtnLbl +
|
||||
'</span>'+
|
||||
'<span style="display:'+(settings.confirmBtnLbl?'table-cell':'none')+';height:50px;line-height:50px;vertical-align:middle;border-left:1px solid #EAEAEA;color:#1B96A9;font-size:16px">' +
|
||||
settings.confirmBtnLbl +
|
||||
'</span>'+
|
||||
'<span style="display:'+(settings.otherBtnLbl?'table-cell':'none')+';height:50px;line-height:50px;vertical-align:middle;border-left:1px solid #EAEAEA;color:#e73268;font-size:16px">' +
|
||||
settings.otherBtnLbl +
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
$this = $(HTML).appendTo($('body'));
|
||||
var $btn = $this.children('div:eq(1)');
|
||||
$btn.children().eq(0).off('click', cancelBtnClickHandler).on('click', cancelBtnClickHandler);
|
||||
$btn.children().eq(1).off('click', confirmBtnClickHandler).on('click', confirmBtnClickHandler);
|
||||
$btn.children().eq(2).off('click', otherBtnClickHandler).on('click', otherBtnClickHandler);
|
||||
}
|
||||
|
||||
//取消按钮事件
|
||||
function cancelBtnClickHandler() {
|
||||
$this.remove();
|
||||
if (settings.cancelCallback && typeof settings.cancelCallback == 'function') {
|
||||
settings.cancelCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function confirmBtnClickHandler() {
|
||||
$this.remove();
|
||||
if (settings.confirmCallback && typeof settings.confirmCallback == 'function') {
|
||||
settings.confirmCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function otherBtnClickHandler(){
|
||||
$this.remove();
|
||||
if (settings.otherCallback && typeof settings.otherCallback == 'function') {
|
||||
settings.otherCallback();
|
||||
}
|
||||
}
|
||||
|
||||
initialize();
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})(jQuery)
|
||||
658
statics/mobile/js/mobiscroll.js
Executable file
658
statics/mobile/js/mobiscroll.js
Executable file
@@ -0,0 +1,658 @@
|
||||
/*jslint eqeq: true, plusplus: true, undef: true, sloppy: true, vars: true, forin: true */
|
||||
(function ($) {
|
||||
|
||||
var ms = $.mobiscroll,
|
||||
date = new Date(),
|
||||
defaults = {
|
||||
dateFormat: 'mm/dd/yy',
|
||||
dateOrder: 'mmddy',
|
||||
timeWheels: 'hhiiA',
|
||||
timeFormat: 'hh:ii A',
|
||||
startYear: date.getFullYear() - 100,
|
||||
endYear: date.getFullYear() + 1,
|
||||
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
||||
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||
shortYearCutoff: '+10',
|
||||
monthText: 'Month',
|
||||
dayText: 'Day',
|
||||
yearText: 'Year',
|
||||
hourText: 'Hours',
|
||||
minuteText: 'Minutes',
|
||||
secText: 'Seconds',
|
||||
ampmText: ' ',
|
||||
nowText: 'Now',
|
||||
showNow: false,
|
||||
stepHour: 1,
|
||||
stepMinute: 1,
|
||||
stepSecond: 1,
|
||||
separator: ' '
|
||||
},
|
||||
preset = function (inst) {
|
||||
var that = $(this),
|
||||
html5def = {},
|
||||
format;
|
||||
// Force format for html5 date inputs (experimental)
|
||||
if (that.is('input')) {
|
||||
switch (that.attr('type')) {
|
||||
case 'date':
|
||||
format = 'yy-mm-dd';
|
||||
break;
|
||||
case 'datetime':
|
||||
format = 'yy-mm-ddTHH:ii:ssZ';
|
||||
break;
|
||||
case 'datetime-local':
|
||||
format = 'yy-mm-ddTHH:ii:ss';
|
||||
break;
|
||||
case 'month':
|
||||
format = 'yy-mm';
|
||||
html5def.dateOrder = 'mmyy';
|
||||
break;
|
||||
case 'time':
|
||||
format = 'HH:ii:ss';
|
||||
break;
|
||||
}
|
||||
// Check for min/max attributes
|
||||
var min = that.attr('min'),
|
||||
max = that.attr('max');
|
||||
if (min) {
|
||||
html5def.minDate = ms.parseDate(format, min);
|
||||
}
|
||||
if (max) {
|
||||
html5def.maxDate = ms.parseDate(format, max);
|
||||
}
|
||||
}
|
||||
|
||||
// Set year-month-day order
|
||||
var s = $.extend({}, defaults, html5def, inst.settings),
|
||||
offset = 0,
|
||||
wheels = [],
|
||||
ord = [],
|
||||
o = {},
|
||||
i,
|
||||
k,
|
||||
f = { y: 'getFullYear', m: 'getMonth', d: 'getDate', h: getHour, i: getMinute, s: getSecond, a: getAmPm },
|
||||
p = s.preset,
|
||||
dord = s.dateOrder,
|
||||
tord = s.timeWheels,
|
||||
regen = dord.match(/D/),
|
||||
ampm = tord.match(/a/i),
|
||||
hampm = tord.match(/h/),
|
||||
hformat = p == 'datetime' ? s.dateFormat + s.separator + s.timeFormat : p == 'time' ? s.timeFormat : s.dateFormat,
|
||||
defd = new Date(),
|
||||
stepH = s.stepHour,
|
||||
stepM = s.stepMinute,
|
||||
stepS = s.stepSecond,
|
||||
mind = s.minDate || new Date(s.startYear, 0, 1),
|
||||
maxd = s.maxDate || new Date(s.endYear, 11, 31, 23, 59, 59);
|
||||
|
||||
inst.settings = s;
|
||||
|
||||
format = format || hformat;
|
||||
|
||||
if (p.match(/date/i)) {
|
||||
|
||||
// Determine the order of year, month, day wheels
|
||||
$.each(['y', 'm', 'd'], function (j, v) {
|
||||
i = dord.search(new RegExp(v, 'i'));
|
||||
if (i > -1) {
|
||||
ord.push({ o: i, v: v });
|
||||
}
|
||||
});
|
||||
ord.sort(function (a, b) { return a.o > b.o ? 1 : -1; });
|
||||
$.each(ord, function (i, v) {
|
||||
o[v.v] = i;
|
||||
});
|
||||
|
||||
var w = {};
|
||||
for (k = 0; k < 3; k++) {
|
||||
if (k == o.y) {
|
||||
offset++;
|
||||
w[s.yearText] = {};
|
||||
var start = mind.getFullYear(),
|
||||
end = maxd.getFullYear();
|
||||
for (i = start; i <= end; i++) {
|
||||
w[s.yearText][i] = dord.match(/yy/i) ? i : (i + '').substr(2, 2);
|
||||
}
|
||||
} else if (k == o.m) {
|
||||
offset++;
|
||||
w[s.monthText] = {};
|
||||
for (i = 0; i < 12; i++) {
|
||||
var str = dord.replace(/[dy]/gi, '').replace(/mm/, i < 9 ? '0' + (i + 1) : i + 1).replace(/m/, (i + 1));
|
||||
w[s.monthText][i] = str.match(/MM/) ? str.replace(/MM/, '<span class="dw-mon">' + s.monthNames[i] + '</span>') : str.replace(/M/, '<span class="dw-mon">' + s.monthNamesShort[i] + '</span>');
|
||||
}
|
||||
} else if (k == o.d) {
|
||||
offset++;
|
||||
w[s.dayText] = {};
|
||||
for (i = 1; i < 32; i++) {
|
||||
w[s.dayText][i] = dord.match(/dd/i) && i < 10 ? '0' + i : i;
|
||||
}
|
||||
}
|
||||
}
|
||||
wheels.push(w);
|
||||
}
|
||||
|
||||
if (p.match(/time/i)) {
|
||||
|
||||
// Determine the order of hours, minutes, seconds wheels
|
||||
ord = [];
|
||||
$.each(['h', 'i', 's', 'a'], function (i, v) {
|
||||
i = tord.search(new RegExp(v, 'i'));
|
||||
if (i > -1) {
|
||||
ord.push({ o: i, v: v });
|
||||
}
|
||||
});
|
||||
ord.sort(function (a, b) {
|
||||
return a.o > b.o ? 1 : -1;
|
||||
});
|
||||
$.each(ord, function (i, v) {
|
||||
o[v.v] = offset + i;
|
||||
});
|
||||
|
||||
w = {};
|
||||
for (k = offset; k < offset + 4; k++) {
|
||||
if (k == o.h) {
|
||||
offset++;
|
||||
w[s.hourText] = {};
|
||||
for (i = 0; i < (hampm ? 12 : 24); i += stepH) {
|
||||
w[s.hourText][i] = hampm && i == 0 ? 12 : tord.match(/hh/i) && i < 10 ? '0' + i : i;
|
||||
}
|
||||
} else if (k == o.i) {
|
||||
offset++;
|
||||
w[s.minuteText] = {};
|
||||
for (i = 0; i < 60; i += stepM) {
|
||||
w[s.minuteText][i] = tord.match(/ii/) && i < 10 ? '0' + i : i;
|
||||
}
|
||||
} else if (k == o.s) {
|
||||
offset++;
|
||||
w[s.secText] = {};
|
||||
for (i = 0; i < 60; i += stepS) {
|
||||
w[s.secText][i] = tord.match(/ss/) && i < 10 ? '0' + i : i;
|
||||
}
|
||||
} else if (k == o.a) {
|
||||
offset++;
|
||||
var upper = tord.match(/A/);
|
||||
w[s.ampmText] = { 0: upper ? 'AM' : 'am', 1: upper ? 'PM' : 'pm' };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wheels.push(w);
|
||||
}
|
||||
|
||||
function get(d, i, def) {
|
||||
if (o[i] !== undefined) {
|
||||
return +d[o[i]];
|
||||
}
|
||||
if (def !== undefined) {
|
||||
return def;
|
||||
}
|
||||
return defd[f[i]] ? defd[f[i]]() : f[i](defd);
|
||||
}
|
||||
|
||||
function step(v, st) {
|
||||
return Math.floor(v / st) * st;
|
||||
}
|
||||
|
||||
function getHour(d) {
|
||||
var hour = d.getHours();
|
||||
hour = hampm && hour >= 12 ? hour - 12 : hour;
|
||||
return step(hour, stepH);
|
||||
}
|
||||
|
||||
function getMinute(d) {
|
||||
return step(d.getMinutes(), stepM);
|
||||
}
|
||||
|
||||
function getSecond(d) {
|
||||
return step(d.getSeconds(), stepS);
|
||||
}
|
||||
|
||||
function getAmPm(d) {
|
||||
return ampm && d.getHours() > 11 ? 1 : 0;
|
||||
}
|
||||
|
||||
function getDate(d) {
|
||||
var hour = get(d, 'h', 0);
|
||||
return new Date(get(d, 'y'), get(d, 'm'), get(d, 'd', 1), get(d, 'a') ? hour + 12 : hour, get(d, 'i', 0), get(d, 's', 0));
|
||||
}
|
||||
|
||||
inst.setDate = function (d, fill, time, temp) {
|
||||
var i;
|
||||
// Set wheels
|
||||
for (i in o) {
|
||||
this.temp[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
|
||||
}
|
||||
this.setValue(true, fill, time, temp);
|
||||
};
|
||||
|
||||
inst.getDate = function (d) {
|
||||
return getDate(d);
|
||||
};
|
||||
|
||||
return {
|
||||
button3Text: s.showNow ? s.nowText : undefined,
|
||||
button3: s.showNow ? function () { inst.setDate(new Date(), false, 0.3, true); } : undefined,
|
||||
wheels: wheels,
|
||||
headerText: function (v) {
|
||||
return ms.formatDate(hformat, getDate(inst.temp), s);
|
||||
},
|
||||
/**
|
||||
* Builds a date object from the wheel selections and formats it to the given date/time format
|
||||
* @param {Array} d - An array containing the selected wheel values
|
||||
* @return {String} - The formatted date string
|
||||
*/
|
||||
formatResult: function (d) {
|
||||
return ms.formatDate(format, getDate(d), s);
|
||||
},
|
||||
/**
|
||||
* Builds a date object from the input value and returns an array to set wheel values
|
||||
* @return {Array} - An array containing the wheel values to set
|
||||
*/
|
||||
parseValue: function (val) {
|
||||
var d = new Date(),
|
||||
i,
|
||||
result = [];
|
||||
try {
|
||||
d = ms.parseDate(format, val, s);
|
||||
} catch (e) {
|
||||
}
|
||||
// Set wheels
|
||||
for (i in o) {
|
||||
result[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
/**
|
||||
* Validates the selected date to be in the minDate / maxDate range and sets unselectable values to disabled
|
||||
* @param {Object} dw - jQuery object containing the generated html
|
||||
* @param {Integer} [i] - Index of the changed wheel, not set for initial validation
|
||||
*/
|
||||
validate: function (dw, i) {
|
||||
var temp = inst.temp, //.slice(0),
|
||||
mins = { y: mind.getFullYear(), m: 0, d: 1, h: 0, i: 0, s: 0, a: 0 },
|
||||
maxs = { y: maxd.getFullYear(), m: 11, d: 31, h: step(hampm ? 11 : 23, stepH), i: step(59, stepM), s: step(59, stepS), a: 1 },
|
||||
minprop = true,
|
||||
maxprop = true;
|
||||
$.each(['y', 'm', 'd', 'a', 'h', 'i', 's'], function (x, i) {
|
||||
if (o[i] !== undefined) {
|
||||
var min = mins[i],
|
||||
max = maxs[i],
|
||||
maxdays = 31,
|
||||
val = get(temp, i),
|
||||
t = $('.dw-ul', dw).eq(o[i]),
|
||||
y,
|
||||
m;
|
||||
if (i == 'd') {
|
||||
y = get(temp, 'y');
|
||||
m = get(temp, 'm');
|
||||
maxdays = 32 - new Date(y, m, 32).getDate();
|
||||
max = maxdays;
|
||||
if (regen) {
|
||||
$('.dw-li', t).each(function () {
|
||||
var that = $(this),
|
||||
d = that.data('val'),
|
||||
w = new Date(y, m, d).getDay(),
|
||||
str = dord.replace(/[my]/gi, '').replace(/dd/, d < 10 ? '0' + d : d).replace(/d/, d);
|
||||
$('.dw-i', that).html(str.match(/DD/) ? str.replace(/DD/, '<span class="dw-day">' + s.dayNames[w] + '</span>') : str.replace(/D/, '<span class="dw-day">' + s.dayNamesShort[w] + '</span>'));
|
||||
});
|
||||
}
|
||||
}
|
||||
if (minprop && mind) {
|
||||
min = mind[f[i]] ? mind[f[i]]() : f[i](mind);
|
||||
}
|
||||
if (maxprop && maxd) {
|
||||
max = maxd[f[i]] ? maxd[f[i]]() : f[i](maxd);
|
||||
}
|
||||
if (i != 'y') {
|
||||
var i1 = $('.dw-li', t).index($('.dw-li[data-val="' + min + '"]', t)),
|
||||
i2 = $('.dw-li', t).index($('.dw-li[data-val="' + max + '"]', t));
|
||||
$('.dw-li', t).removeClass('dw-v').slice(i1, i2 + 1).addClass('dw-v');
|
||||
if (i == 'd') { // Hide days not in month
|
||||
$('.dw-li', t).removeClass('dw-h').slice(maxdays).addClass('dw-h');
|
||||
}
|
||||
}
|
||||
if (val < min) {
|
||||
val = min;
|
||||
}
|
||||
if (val > max) {
|
||||
val = max;
|
||||
}
|
||||
if (minprop) {
|
||||
minprop = val == min;
|
||||
}
|
||||
if (maxprop) {
|
||||
maxprop = val == max;
|
||||
}
|
||||
// Disable some days
|
||||
if (s.invalid && i == 'd') {
|
||||
var idx = [];
|
||||
// Disable exact dates
|
||||
if (s.invalid.dates) {
|
||||
$.each(s.invalid.dates, function (i, v) {
|
||||
if (v.getFullYear() == y && v.getMonth() == m) {
|
||||
idx.push(v.getDate() - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Disable days of week
|
||||
if (s.invalid.daysOfWeek) {
|
||||
var first = new Date(y, m, 1).getDay(),
|
||||
j;
|
||||
$.each(s.invalid.daysOfWeek, function (i, v) {
|
||||
for (j = v - first; j < maxdays; j += 7) {
|
||||
if (j >= 0) {
|
||||
idx.push(j);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// Disable days of month
|
||||
if (s.invalid.daysOfMonth) {
|
||||
$.each(s.invalid.daysOfMonth, function (i, v) {
|
||||
v = (v + '').split('/');
|
||||
if (v[1]) {
|
||||
if (v[0] - 1 == m) {
|
||||
idx.push(v[1] - 1);
|
||||
}
|
||||
} else {
|
||||
idx.push(v[0] - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
$.each(idx, function (i, v) {
|
||||
$('.dw-li', t).eq(v).removeClass('dw-v');
|
||||
});
|
||||
}
|
||||
|
||||
// Set modified value
|
||||
temp[o[i]] = val;
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* Returns the currently selected date.
|
||||
* @param {Boolean} temp - If true, return the currently shown date on the picker, otherwise the last selected one
|
||||
* @return {Date}
|
||||
*/
|
||||
getDate: function (temp) {
|
||||
var inst = $(this).mobiscroll('getInst');
|
||||
if (inst) {
|
||||
return inst.getDate(temp ? inst.temp : inst.values);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sets the selected date
|
||||
* @param {Date} d - Date to select.
|
||||
* @param {Boolean} [fill] - Also set the value of the associated input element. Default is true.
|
||||
* @return {Object} - jQuery object to maintain chainability
|
||||
*/
|
||||
setDate: function (d, fill, time, temp) {
|
||||
if (fill == undefined) {
|
||||
fill = false;
|
||||
}
|
||||
return this.each(function () {
|
||||
var inst = $(this).mobiscroll('getInst');
|
||||
if (inst) {
|
||||
inst.setDate(d, fill, time, temp);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.each(['date', 'time', 'datetime'], function (i, v) {
|
||||
ms.presets[v] = preset;
|
||||
ms.presetShort(v);
|
||||
});
|
||||
|
||||
/**
|
||||
* Format a date into a string value with a specified format.
|
||||
* @param {String} format - Output format.
|
||||
* @param {Date} date - Date to format.
|
||||
* @param {Object} settings - Settings.
|
||||
* @return {String} - Returns the formatted date string.
|
||||
*/
|
||||
ms.formatDate = function (format, date, settings) {
|
||||
if (!date) {
|
||||
return null;
|
||||
}
|
||||
var s = $.extend({}, defaults, settings),
|
||||
look = function (m) { // Check whether a format character is doubled
|
||||
var n = 0;
|
||||
while (i + 1 < format.length && format.charAt(i + 1) == m) {
|
||||
n++;
|
||||
i++;
|
||||
}
|
||||
return n;
|
||||
},
|
||||
f1 = function (m, val, len) { // Format a number, with leading zero if necessary
|
||||
var n = '' + val;
|
||||
if (look(m)) {
|
||||
while (n.length < len) {
|
||||
n = '0' + n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
},
|
||||
f2 = function (m, val, s, l) { // Format a name, short or long as requested
|
||||
return (look(m) ? l[val] : s[val]);
|
||||
},
|
||||
i,
|
||||
output = '',
|
||||
literal = false;
|
||||
|
||||
for (i = 0; i < format.length; i++) {
|
||||
if (literal) {
|
||||
if (format.charAt(i) == "'" && !look("'")) {
|
||||
literal = false;
|
||||
} else {
|
||||
output += format.charAt(i);
|
||||
}
|
||||
} else {
|
||||
switch (format.charAt(i)) {
|
||||
case 'd':
|
||||
output += f1('d', date.getDate(), 2);
|
||||
break;
|
||||
case 'D':
|
||||
output += f2('D', date.getDay(), s.dayNamesShort, s.dayNames);
|
||||
break;
|
||||
case 'o':
|
||||
output += f1('o', (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
|
||||
break;
|
||||
case 'm':
|
||||
output += f1('m', date.getMonth() + 1, 2);
|
||||
break;
|
||||
case 'M':
|
||||
output += f2('M', date.getMonth(), s.monthNamesShort, s.monthNames);
|
||||
break;
|
||||
case 'y':
|
||||
output += (look('y') ? date.getFullYear() : (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
|
||||
break;
|
||||
case 'h':
|
||||
var h = date.getHours();
|
||||
output += f1('h', (h > 12 ? (h - 12) : (h == 0 ? 12 : h)), 2);
|
||||
break;
|
||||
case 'H':
|
||||
output += f1('H', date.getHours(), 2);
|
||||
break;
|
||||
case 'i':
|
||||
output += f1('i', date.getMinutes(), 2);
|
||||
break;
|
||||
case 's':
|
||||
output += f1('s', date.getSeconds(), 2);
|
||||
break;
|
||||
case 'a':
|
||||
output += date.getHours() > 11 ? 'pm' : 'am';
|
||||
break;
|
||||
case 'A':
|
||||
output += date.getHours() > 11 ? 'PM' : 'AM';
|
||||
break;
|
||||
case "'":
|
||||
if (look("'")) {
|
||||
output += "'";
|
||||
} else {
|
||||
literal = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
output += format.charAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extract a date from a string value with a specified format.
|
||||
* @param {String} format - Input format.
|
||||
* @param {String} value - String to parse.
|
||||
* @param {Object} settings - Settings.
|
||||
* @return {Date} - Returns the extracted date.
|
||||
*/
|
||||
ms.parseDate = function (format, value, settings) {
|
||||
var def = new Date();
|
||||
|
||||
if (!format || !value) {
|
||||
return def;
|
||||
}
|
||||
|
||||
value = (typeof value == 'object' ? value.toString() : value + '');
|
||||
|
||||
var s = $.extend({}, defaults, settings),
|
||||
shortYearCutoff = s.shortYearCutoff,
|
||||
year = def.getFullYear(),
|
||||
month = def.getMonth() + 1,
|
||||
day = def.getDate(),
|
||||
doy = -1,
|
||||
hours = def.getHours(),
|
||||
minutes = def.getMinutes(),
|
||||
seconds = 0, //def.getSeconds(),
|
||||
ampm = -1,
|
||||
literal = false, // Check whether a format character is doubled
|
||||
lookAhead = function (match) {
|
||||
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
||||
if (matches) {
|
||||
iFormat++;
|
||||
}
|
||||
return matches;
|
||||
},
|
||||
getNumber = function (match) { // Extract a number from the string value
|
||||
lookAhead(match);
|
||||
var size = (match == '@' ? 14 : (match == '!' ? 20 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))),
|
||||
digits = new RegExp('^\\d{1,' + size + '}'),
|
||||
num = value.substr(iValue).match(digits);
|
||||
|
||||
if (!num) {
|
||||
return 0;
|
||||
}
|
||||
//throw 'Missing number at position ' + iValue;
|
||||
iValue += num[0].length;
|
||||
return parseInt(num[0], 10);
|
||||
},
|
||||
getName = function (match, s, l) { // Extract a name from the string value and convert to an index
|
||||
var names = (lookAhead(match) ? l : s),
|
||||
i;
|
||||
|
||||
for (i = 0; i < names.length; i++) {
|
||||
if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
|
||||
iValue += names[i].length;
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
//throw 'Unknown name at position ' + iValue;
|
||||
},
|
||||
checkLiteral = function () {
|
||||
//if (value.charAt(iValue) != format.charAt(iFormat))
|
||||
//throw 'Unexpected literal at position ' + iValue;
|
||||
iValue++;
|
||||
},
|
||||
iValue = 0,
|
||||
iFormat;
|
||||
|
||||
for (iFormat = 0; iFormat < format.length; iFormat++) {
|
||||
if (literal) {
|
||||
if (format.charAt(iFormat) == "'" && !lookAhead("'")) {
|
||||
literal = false;
|
||||
} else {
|
||||
checkLiteral();
|
||||
}
|
||||
} else {
|
||||
switch (format.charAt(iFormat)) {
|
||||
case 'd':
|
||||
day = getNumber('d');
|
||||
break;
|
||||
case 'D':
|
||||
getName('D', s.dayNamesShort, s.dayNames);
|
||||
break;
|
||||
case 'o':
|
||||
doy = getNumber('o');
|
||||
break;
|
||||
case 'm':
|
||||
month = getNumber('m');
|
||||
break;
|
||||
case 'M':
|
||||
month = getName('M', s.monthNamesShort, s.monthNames);
|
||||
break;
|
||||
case 'y':
|
||||
year = getNumber('y');
|
||||
break;
|
||||
case 'H':
|
||||
hours = getNumber('H');
|
||||
break;
|
||||
case 'h':
|
||||
hours = getNumber('h');
|
||||
break;
|
||||
case 'i':
|
||||
minutes = getNumber('i');
|
||||
break;
|
||||
case 's':
|
||||
seconds = getNumber('s');
|
||||
break;
|
||||
case 'a':
|
||||
ampm = getName('a', ['am', 'pm'], ['am', 'pm']) - 1;
|
||||
break;
|
||||
case 'A':
|
||||
ampm = getName('A', ['am', 'pm'], ['am', 'pm']) - 1;
|
||||
break;
|
||||
case "'":
|
||||
if (lookAhead("'")) {
|
||||
checkLiteral();
|
||||
} else {
|
||||
literal = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
checkLiteral();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (year < 100) {
|
||||
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
|
||||
(year <= (typeof shortYearCutoff != 'string' ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)) ? 0 : -100);
|
||||
}
|
||||
if (doy > -1) {
|
||||
month = 1;
|
||||
day = doy;
|
||||
do {
|
||||
var dim = 32 - new Date(year, month - 1, 32).getDate();
|
||||
if (day <= dim) {
|
||||
break;
|
||||
}
|
||||
month++;
|
||||
day -= dim;
|
||||
} while (true);
|
||||
}
|
||||
hours = (ampm == -1) ? hours : ((ampm && hours < 12) ? (hours + 12) : (!ampm && hours == 12 ? 0 : hours));
|
||||
var date = new Date(year, month - 1, day, hours, minutes, seconds);
|
||||
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) {
|
||||
throw 'Invalid date';
|
||||
}
|
||||
return date;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1166
statics/mobile/js/mobiscroll_date.js
Executable file
1166
statics/mobile/js/mobiscroll_date.js
Executable file
File diff suppressed because it is too large
Load Diff
62
statics/mobile/js/navbar2.js
Executable file
62
statics/mobile/js/navbar2.js
Executable file
@@ -0,0 +1,62 @@
|
||||
$(function() {
|
||||
|
||||
// Do our DOM lookups beforehand
|
||||
var nav_container = $(".nav-lf");
|
||||
var nav = $("#nav");
|
||||
|
||||
var top_spacing = 0;
|
||||
var waypoint_offset = 0;
|
||||
|
||||
nav_container.waypoint({
|
||||
handler: function(event, direction) {
|
||||
|
||||
if (direction == 'down') {
|
||||
|
||||
nav_container.css({ 'height':nav.outerHeight() });
|
||||
nav.stop().addClass("sticky").css("top",-nav.outerHeight()).animate({"top":top_spacing});
|
||||
|
||||
} else {
|
||||
|
||||
nav_container.css({ 'height':'auto' });
|
||||
nav.stop().removeClass("sticky").css("top",nav.outerHeight()+waypoint_offset).animate({"top":""});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
offset: function() {
|
||||
return -nav.outerHeight()-waypoint_offset;
|
||||
}
|
||||
});
|
||||
|
||||
var sections = $("#container");
|
||||
var navigation_links = $("#nav a");
|
||||
|
||||
sections.waypoint({
|
||||
handler: function(event, direction) {
|
||||
|
||||
var active_section;
|
||||
active_section = $(this);
|
||||
if (direction === "up") active_section = active_section.prev();
|
||||
|
||||
var active_link = $('nav a[href="#' + active_section.attr("id") + '"]');
|
||||
navigation_links.removeClass("#container");
|
||||
active_link.addClass("#container");
|
||||
|
||||
},
|
||||
offset: '25%'
|
||||
})
|
||||
|
||||
|
||||
navigation_links.click( function(event) {
|
||||
|
||||
$.scrollTo(
|
||||
$(this).attr("href"),
|
||||
{
|
||||
duration: 200,
|
||||
offset: { 'left':0, 'top':-0.15*$(window).height() }
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
1
statics/mobile/js/pushbutton.min.js
vendored
Executable file
1
statics/mobile/js/pushbutton.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
19
statics/mobile/js/swiper.min.js
vendored
Executable file
19
statics/mobile/js/swiper.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
8
statics/mobile/js/waypoints.min.js
vendored
Executable file
8
statics/mobile/js/waypoints.min.js
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
jQuery Waypoints - v1.1.4
|
||||
Copyright (c) 2011-2012 Caleb Troughton
|
||||
Dual licensed under the MIT license and GPL license.
|
||||
https://github.com/imakewebthings/jquery-waypoints/blob/master/MIT-license.txt
|
||||
https://github.com/imakewebthings/jquery-waypoints/blob/master/GPL-license.txt
|
||||
*/
|
||||
(function($,k,m,i,d){var e=$(i),g="waypoint.reached",b=function(o,n){o.element.trigger(g,n);if(o.options.triggerOnce){o.element[k]("destroy")}},h=function(p,o){var n=o.waypoints.length-1;while(n>=0&&o.waypoints[n].element[0]!==p[0]){n-=1}return n},f=[],l=function(n){$.extend(this,{element:$(n),oldScroll:0,waypoints:[],didScroll:false,didResize:false,doScroll:$.proxy(function(){var q=this.element.scrollTop(),p=q>this.oldScroll,s=this,r=$.grep(this.waypoints,function(u,t){return p?(u.offset>s.oldScroll&&u.offset<=q):(u.offset<=s.oldScroll&&u.offset>q)}),o=r.length;if(!this.oldScroll||!q){$[m]("refresh")}this.oldScroll=q;if(!o){return}if(!p){r.reverse()}$.each(r,function(u,t){if(t.options.continuous||u===o-1){b(t,[p?"down":"up"])}})},this)});$(n).scroll($.proxy(function(){if(!this.didScroll){this.didScroll=true;i.setTimeout($.proxy(function(){this.doScroll();this.didScroll=false},this),$[m].settings.scrollThrottle)}},this)).resize($.proxy(function(){if(!this.didResize){this.didResize=true;i.setTimeout($.proxy(function(){$[m]("refresh");this.didResize=false},this),$[m].settings.resizeThrottle)}},this));e.load($.proxy(function(){this.doScroll()},this))},j=function(n){var o=null;$.each(f,function(p,q){if(q.element[0]===n){o=q;return false}});return o},c={init:function(o,n){this.each(function(){var u=$.fn[k].defaults.context,q,t=$(this);if(n&&n.context){u=n.context}if(!$.isWindow(u)){u=t.closest(u)[0]}q=j(u);if(!q){q=new l(u);f.push(q)}var p=h(t,q),s=p<0?$.fn[k].defaults:q.waypoints[p].options,r=$.extend({},s,n);r.offset=r.offset==="bottom-in-view"?function(){var v=$.isWindow(u)?$[m]("viewportHeight"):$(u).height();return v-$(this).outerHeight()}:r.offset;if(p<0){q.waypoints.push({element:t,offset:null,options:r})}else{q.waypoints[p].options=r}if(o){t.bind(g,o)}if(n&&n.handler){t.bind(g,n.handler)}});$[m]("refresh");return this},remove:function(){return this.each(function(o,p){var n=$(p);$.each(f,function(r,s){var q=h(n,s);if(q>=0){s.waypoints.splice(q,1)}})})},destroy:function(){return this.unbind(g)[k]("remove")}},a={refresh:function(){$.each(f,function(r,s){var q=$.isWindow(s.element[0]),n=q?0:s.element.offset().top,p=q?$[m]("viewportHeight"):s.element.height(),o=q?0:s.element.scrollTop();$.each(s.waypoints,function(u,x){if(!x){return}var t=x.options.offset,w=x.offset;if(typeof x.options.offset==="function"){t=x.options.offset.apply(x.element)}else{if(typeof x.options.offset==="string"){var v=parseFloat(x.options.offset);t=x.options.offset.indexOf("%")?Math.ceil(p*(v/100)):v}}x.offset=x.element.offset().top-n+o-t;if(x.options.onlyOnScroll){return}if(w!==null&&s.oldScroll>w&&s.oldScroll<=x.offset){b(x,["up"])}else{if(w!==null&&s.oldScroll<w&&s.oldScroll>=x.offset){b(x,["down"])}else{if(!w&&o>x.offset){b(x,["down"])}}}});s.waypoints.sort(function(u,t){return u.offset-t.offset})})},viewportHeight:function(){return(i.innerHeight?i.innerHeight:e.height())},aggregate:function(){var n=$();$.each(f,function(o,p){$.each(p.waypoints,function(q,r){n=n.add(r.element)})});return n}};$.fn[k]=function(n){if(c[n]){return c[n].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof n==="function"||!n){return c.init.apply(this,arguments)}else{if(typeof n==="object"){return c.init.apply(this,[null,n])}else{$.error("Method "+n+" does not exist on jQuery "+k)}}}};$.fn[k].defaults={continuous:true,offset:0,triggerOnce:false,context:i};$[m]=function(n){if(a[n]){return a[n].apply(this)}else{return a.aggregate()}};$[m].settings={resizeThrottle:200,scrollThrottle:100};e.load(function(){$[m]("refresh")})})(jQuery,"waypoint","waypoints",this);
|
||||
Reference in New Issue
Block a user