信呼OA版本v2.3.8
This commit is contained in:
21
mode/plugin/css/jquery-rockdatepicker.css
Normal file
21
mode/plugin/css/jquery-rockdatepicker.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/*时间选择器插件样式*/
|
||||
.rockdatepicker{z-index:9999;box-shadow:2px 2px 2px #cccccc;border:1px #cccccc solid; background-color:#ffffff; left:0px; top:0px; padding:0px}
|
||||
.rockdatepicker td{cursor:pointer}
|
||||
.rockdatepicker td.td00:hover,.rockdatepicker td.td01{background:#dedede}
|
||||
.rockdatepicker_table td{border:1px #eeeeee solid;}
|
||||
.rockdatepicker .a{cursor:pointer;border:none;padding:2px 5px;color:#555555}
|
||||
.rockdatepicker .a:hover{color:red}
|
||||
.rockdatepicker_span{padding:1px 3px;margin:0px 2px;}
|
||||
|
||||
.rockdatepicker_fudong{ position:absolute;padding:2px;border:1px #cccccc solid; background-color:#f8f8f8;z-index:2;box-shadow:2px 2px 2px #cccccc;overflow:auto}
|
||||
.rockdatepicker_fudong div{padding:0px 5px;cursor:pointer;height:24px;overflow:hidden;line-height:24px}
|
||||
.rockdatepicker_fudong div:hover{background:#cccccc}
|
||||
.rockdatepicker_fudong .div01{background:#aaaaaa;color:white}
|
||||
|
||||
.rockdatepicker .a02:link,.rockdatepicker .a02:visited{padding:2px 5px;color:#555555}
|
||||
.rockdatepicker .a02:hover{color:#000000;background:#dddddd}
|
||||
.rockdatepicker .a03:link,.rockdatepicker .a03:visited{padding:2px 5px;color:#000000;background:#dddddd}
|
||||
|
||||
.rockdatepicker .not:link,.rockdatepicker .not:visited,.rockdatepicker .not{color:#cccccc}
|
||||
.rockdatepicker .not:hover{background:#ffffff}
|
||||
|
||||
150
mode/plugin/jquery-edittable.js
vendored
Normal file
150
mode/plugin/jquery-edittable.js
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
edittable 编辑单元格
|
||||
caratename:chenxihu
|
||||
caratetime:214-04-06 21:40:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function edittable(element, options){
|
||||
var obj = element;
|
||||
var can = options;
|
||||
var rand = ''+parseInt(Math.random()*99999)+'';
|
||||
var me = this;
|
||||
var timeci = 0;
|
||||
this.rand = rand;
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
var o = obj.find('[edittable]');
|
||||
var len = o.length;
|
||||
for(var i=0;i<len;i++){
|
||||
$(o[i])[can.trigger](function(){
|
||||
me.changcell($(this));
|
||||
});
|
||||
}
|
||||
};
|
||||
this.changcell = function(o){
|
||||
var ntml = o.html();
|
||||
if(ntml.indexOf('input')>=0 || ntml.indexOf('INPUT')>=0 || ntml.indexOf('SELECT')>=0 || ntml.indexOf('select')>=0)return false;
|
||||
|
||||
timeci++;
|
||||
var fid = o.attr('edittable');//字段名
|
||||
var ocaa= can.data[fid];
|
||||
var xty = 'text';
|
||||
if(ocaa)if(ocaa.xtype)xty = ocaa.xtype;
|
||||
var val = o.text(),
|
||||
nid = 'edittable_'+rand+'_'+timeci+'',
|
||||
off = o.offset(),
|
||||
wid = o.width(),
|
||||
canslw = 'fields="'+fid+'" id="'+nid+'" changeid="'+js.changeid+'"';
|
||||
s='',
|
||||
othval = ntml.replace(val,'');
|
||||
if(xty == 'text'){
|
||||
s+= '<input style="width:'+(wid-10)+'px;line-height:18px;height:25px;border:1px #888888 solid;padding:0px 3px" '+canslw+'>';
|
||||
o.html(s);
|
||||
var o1 = $('#'+nid+'');
|
||||
o1.focus();
|
||||
o1.val(val);
|
||||
o1.blur(function(){
|
||||
me.textblur($(this),val,o,othval);
|
||||
});
|
||||
}
|
||||
if(xty == 'select'){
|
||||
var da = ocaa.store;
|
||||
s+= '<select style="width:'+wid+'px" '+canslw+'>';
|
||||
for(var i=0; i<da.length; i++){
|
||||
var v1 = '',v2 = '',v = da[i];
|
||||
if(typeof(v)!='object'){
|
||||
v1 = v;
|
||||
v2 = v;
|
||||
}else{
|
||||
var oi = 0;
|
||||
if(v[0]){
|
||||
v1 = v[0];
|
||||
v2 = v[0];
|
||||
if(v[1])v2=v[1];
|
||||
}else{
|
||||
v1 = v.value;
|
||||
v2 = v.name;
|
||||
}
|
||||
}
|
||||
s+='<option '+((v1==val)?'selected':'')+' value="'+v1+'">'+v2+'</option>';
|
||||
}
|
||||
s+='</select>';
|
||||
o.html(s);
|
||||
var o1 = $('#'+nid+'');
|
||||
o1.focus();
|
||||
o1.blur(function(){
|
||||
me.textblur($(this),val,o);
|
||||
});
|
||||
}
|
||||
if(xty == 'checkbox'){
|
||||
var che = '',
|
||||
dis = ocaa.display,
|
||||
cval= 0;
|
||||
for(var i=0;i<dis.length;i++){
|
||||
if(dis[i]==strreplace(val)){
|
||||
cval = i;
|
||||
}
|
||||
}
|
||||
if(cval==1)che='checked';
|
||||
s+= '<input type="checkbox" '+che+' '+canslw+'>'+ocaa.label+'';
|
||||
o.html(s);
|
||||
var o1 = $('#'+nid+'');
|
||||
o1.focus();
|
||||
o1.blur(function(){
|
||||
me.checkboxblur(this,cval,o);
|
||||
});
|
||||
}
|
||||
can.changcell(o);
|
||||
};
|
||||
this.checkboxblur = function(o1,oval,oba){
|
||||
var nval = '0';
|
||||
if(o1.checked)nval='1';
|
||||
var o = $(o1);
|
||||
var fields = o.attr('fields');
|
||||
this.savedata(o,nval,oval);
|
||||
var ocaa= can.data[fields];
|
||||
var s = '<font color="'+ocaa.displaycolor[nval]+'">'+ocaa.display[nval]+'</font>';
|
||||
oba.html(s);
|
||||
};
|
||||
//保存数据
|
||||
this.savedata = function(o,nval,oval){
|
||||
if(nval == oval)return;
|
||||
var canid = o.attr('changeid');
|
||||
var fields = o.attr('fields');
|
||||
var saveurl = can.saveurl;
|
||||
can.savedata(saveurl,{id:canid,fields:fields,newvalue:nval,table:can.table,keyfields:can.keyfields},function(da){
|
||||
|
||||
});
|
||||
}
|
||||
this.textblur = function(o,oval,oba,ovs){
|
||||
var nval = o.val();
|
||||
if(!ovs)ovs = '';
|
||||
o.remove();
|
||||
this.savedata(o,nval,oval);
|
||||
oba.html(ovs+nval);
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.edittable = function(options){
|
||||
var defaultVal = {
|
||||
trigger:'dblclick', //默认双击编辑
|
||||
data:{},
|
||||
keyfields:'id',//主键字段名
|
||||
saveurl:js.getajaxurl('saveeditable','user','system'), //保存表格的地址
|
||||
savedata:function(url,das,sboole){
|
||||
$.post(url,das,sboole);
|
||||
},
|
||||
changcell:function(){}
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var funcls = new edittable($(this), can);
|
||||
funcls.init();
|
||||
return funcls;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
306
mode/plugin/jquery-rockbase.js
vendored
Normal file
306
mode/plugin/jquery-rockbase.js
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
rockbase 基础信息
|
||||
*/
|
||||
|
||||
|
||||
var backautocloseupload = {};
|
||||
(function ($) {
|
||||
|
||||
|
||||
function rockupload(element, options){
|
||||
var obj = element;
|
||||
var can = options;
|
||||
var me = this,
|
||||
rand= 'sdh_'+js.getrand();
|
||||
this.init = function(){
|
||||
var s = '<div class="form-control" id="view_'+rand+'" style="height:'+can.height+'px;overflow:auto;padding:0px"></div><div><a onclick="return false" id="add_'+rand+'" href="javascript:"><i class="icon-plus"></i> '+can.uploadtext+'</a> <span id="count_'+rand+'"></span></div><input type="hidden" id="fileid_'+rand+'" name="'+can.name+'">';
|
||||
obj.html(s);
|
||||
$('#add_'+rand+'').click(function(){
|
||||
me._upload();
|
||||
});
|
||||
this.loadfile();
|
||||
};
|
||||
|
||||
this._upload= function(){
|
||||
if(!can.addbool)return;
|
||||
|
||||
js.tanbody('uploadaction','上传文件',550,250,{
|
||||
html:'<iframe src="" name="uploadiframea" width="100%" height="250px" frameborder="0"></iframe>',bbar:'none'
|
||||
});
|
||||
var cans=can.uploadparams;
|
||||
cans.showid=rand;
|
||||
var url= js.upload('',cans,'url');
|
||||
uploadiframea.location.href=url;
|
||||
return false;
|
||||
};
|
||||
this.loadfile = function(mtype, mid){
|
||||
if(!mtype)mtype=can.mtype;
|
||||
if(!mid)mid=can.mid;
|
||||
if(!mtype || !mid || mid==0)return;
|
||||
var url = js.getajaxurl('getfile','upload','public',{mtype:mtype,mid:mid});
|
||||
var o = $('#view_'+rand+'');
|
||||
o.html('<div style="padding:10px"><img src="images/loading.gif" align="absmiddle"> 加载中...</div>');
|
||||
$.get(url, function(da){
|
||||
o.html('');
|
||||
var a = js.decode(da);
|
||||
js.downupshow(a,rand);
|
||||
});
|
||||
};
|
||||
this.removedel = function(){
|
||||
$('#view_'+rand+'').find("temp='dela'").remove();
|
||||
};
|
||||
this.idAdd = function(bo){
|
||||
can.addbool = bo;
|
||||
};
|
||||
};
|
||||
$.fn.rockupload = function(options){
|
||||
var defaultVal = {
|
||||
name:'fileid',uploadtext:'添加文件',mtype:'',mid:0,height:80,delbool:true,addbool:true,
|
||||
uploadparams:{}
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var clsa = new rockupload($(this), can);
|
||||
clsa.init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
|
||||
//搜索工具条
|
||||
function rocksearch(element, options){
|
||||
var obj = element;
|
||||
var can = options;
|
||||
var me = this,
|
||||
rand= js.getrand();
|
||||
this.luojiarr = [{
|
||||
name:'包含',value:'LIKE'
|
||||
},{
|
||||
name:'不包含',value:'NOT LIKE'
|
||||
},{
|
||||
name:'等于',value:'='
|
||||
},{
|
||||
name:'不等于',value:'!='
|
||||
},{
|
||||
name:'大于',value:'>'
|
||||
},{
|
||||
name:'大于等于',value:'>='
|
||||
},{
|
||||
name:'小于',value:'<'
|
||||
},{
|
||||
name:'小于等于',value:'<='
|
||||
}];
|
||||
|
||||
this.init = function(){
|
||||
|
||||
if(can.listtable){
|
||||
this.createlisttable();
|
||||
return;
|
||||
}
|
||||
|
||||
var s = '';
|
||||
s = '<div class="input-group" style="width:'+can.width+'px;">'+
|
||||
'<span class="input-group-btn">'+
|
||||
' <a type="button" id="fields_'+rand+'" class="btn btn-default">字段 <span class="caret"></span></a>'+
|
||||
' <a type="button" id="luoji_'+rand+'" class="btn btn-default">包含 <span class="caret"></span></a>'+
|
||||
'</span>'+
|
||||
'<input class="form-control" id="key_'+rand+'" placeholder="关键词">'+
|
||||
'<input class="form-control" style="display:none" readonly id="date_'+rand+'">'+
|
||||
'<span style="display:none" id="selectdivshoa_'+rand+'"></span>'+
|
||||
'<span class="input-group-btn">'+
|
||||
' <button class="btn btn-default" style="display:none" id="datebtn_'+rand+'" type="button"><i class="icon-calendar"></i></button>'+
|
||||
' <button class="btn btn-default" id="soubtn_'+rand+'" type="button"><i class="icon-search"></i> 查询 </button>';
|
||||
|
||||
s+=' <button class="btn btn-default" id="soubtndown_'+rand+'" type="button"><i class="icon-caret-down"></i></button>';
|
||||
s+=' </span>';
|
||||
s+='</div>';
|
||||
obj.html(s);
|
||||
$('#soubtn_'+rand+'').click(function(){
|
||||
me._search(false);
|
||||
});
|
||||
|
||||
$('#fields_'+rand+'').rockmenu({
|
||||
data:can.columns,top:35,width:150,
|
||||
itemsclick:function(d, oi){
|
||||
me.changefields(oi);
|
||||
}
|
||||
});
|
||||
|
||||
$('#luoji_'+rand+'').rockmenu({
|
||||
data:this.luojiarr,top:35,width:100,
|
||||
itemsclick:function(d){
|
||||
me.changeluoji(d);
|
||||
}
|
||||
});
|
||||
|
||||
var ds = [{name:'结果中查询',oi:0},{name:'高级查询...',oi:1}];
|
||||
if(!can.highsearch){
|
||||
ds = [{name:'(',val:'('},{name:')',val:')'},{name:'并且',val:'and'},{name:'或者',val:'or'}];
|
||||
$('#soubtn_'+rand+'').html('<i class="icon-plus"></i>');
|
||||
}
|
||||
$('#soubtndown_'+rand+'').rockmenu({
|
||||
data:ds,top:35,width:100,
|
||||
itemsclick:function(d){
|
||||
if(can.highsearch){
|
||||
if(d.oi==0)me._search(true);
|
||||
if(d.oi==1)me._highsearch();
|
||||
}else{
|
||||
me._showhighsearch(d.val, d.name, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.dateobj = $('#datebtn_'+rand+'').rockdatepicker({inputid:'date_'+rand+''});
|
||||
this.selobj = $('#selectdivshoa_'+rand+'').bootstigger({
|
||||
data:[],valuefields:'id',clearbool:true
|
||||
});
|
||||
this.changefields(0);
|
||||
this.changeluoji(this.luojiarr[0]);
|
||||
};
|
||||
this.oldkeysou = '';
|
||||
this._search = function(bo){
|
||||
var awhere = '',oper,key,fields,type;
|
||||
oper = this.luojiobj.value;
|
||||
key = $('#key_'+rand+'').val();
|
||||
arr = this.fieldsobj;
|
||||
fields= arr.dataIndex;
|
||||
type = arr.atype;
|
||||
if(!type)type='';
|
||||
if(type.indexOf('date')>-1)key = this.dateobj.getValue();
|
||||
if(type=='select')key = this.selobj.getValue();;
|
||||
var qz=arr.qz;
|
||||
if(isempt(qz))qz='';
|
||||
|
||||
var keyss = key+'',
|
||||
keyss1 = key+'';
|
||||
if(type=='select')keyss1=this.selobj.getRawValue();
|
||||
if(oper.indexOf('LIKE')>=0)key='%'+key+'%';
|
||||
key="[F]"+key+"[F]";
|
||||
if(can.highsearch)awhere='[K][A]';
|
||||
awhere+="[K]"+qz+"`"+fields+"`[K]"+oper+"[K]"+key+"[K]";
|
||||
if(arr.searchtpl){
|
||||
awhere = '[K][A][K]'+arr.searchtpl.replace('?0', oper);
|
||||
awhere = awhere.replace('?1', key);
|
||||
}
|
||||
if((oper.indexOf('LIKE')>=0 || oper=='=') && keyss =='')awhere='';
|
||||
if(bo)awhere = this.oldkeysou+awhere;
|
||||
this.oldkeysou = awhere;
|
||||
var awhes = ''+arr.name+' '+this.luojiobj.name+' '+keyss1+'';
|
||||
can.backcall(awhere, awhes, this);
|
||||
return awhere;
|
||||
};
|
||||
this._highsearchstr = '';
|
||||
this._highsearch = function(){
|
||||
var s = '<div><div id="highsearch_list_tools"></div><div id="highsearch_list" style="height:180px;overflow:auto;">'+this._highsearchstr+'</div></div>';
|
||||
js.tanbody('highsearch','高级查询',450, 250,{html:s,btn:[{text:'查询',icons:'search'}]});
|
||||
var soutools=$('#highsearch_list_tools').rocksearch({
|
||||
columns:can.columns,width:448,highsearch:false,
|
||||
backcall:function(s, s1){
|
||||
if(s!='')me._showhighsearch(s, ' '+s1, 1);
|
||||
}
|
||||
});
|
||||
$('#highsearch_btn0').click(function(){
|
||||
me._highsearchok();
|
||||
});
|
||||
};
|
||||
this._highsearchok = function(){
|
||||
var o = $('#highsearch_list');
|
||||
this._highsearchstr = o.html();
|
||||
var o1 = o.find('font'),s= '',i,v;
|
||||
for(i=0; i<o1.length; i++){
|
||||
v = o1[i].innerHTML;
|
||||
v = v.replace('<','<');
|
||||
v = v.replace('>','>');
|
||||
s+=''+v;
|
||||
}
|
||||
can.backcall(s);
|
||||
js.tanclose('highsearch');
|
||||
};
|
||||
this._showhighsearch = function(s, s1, lx){
|
||||
var o = $('#highsearch_list');
|
||||
var h = '<div ondblclick="$(this).remove()" onmouseover="this.style.backgroundColor=\'#f1f1f1\'" onmouseout="this.style.backgroundColor=\'\'" style="padding:8px 10px;border-bottom:1px #eeeeee solid"><span>'+s1+'</span><font style="display:none">'+s+'</font></div>';
|
||||
if(lx==1){
|
||||
var las = o.find('font:last').html(),
|
||||
lass= ',(,),and,or,';
|
||||
if(lass.indexOf(','+las+',')<0){
|
||||
this._showhighsearch('and','并且',0);
|
||||
}
|
||||
}
|
||||
o.append(h);
|
||||
this._highsearchstr = o.html();
|
||||
};
|
||||
this.changefields = function(oi){
|
||||
var d = can.columns[oi];
|
||||
$('#fields_'+rand+'').html(''+d.name+' <span class="caret"></span>');
|
||||
this.fieldsobj = d;
|
||||
if(!d.atype)d.atype='';
|
||||
if(d.atype.indexOf('date')>-1){
|
||||
$('#key_'+rand+'').hide();
|
||||
this.selobj.hide();
|
||||
$('#date_'+rand+'').show();
|
||||
$('#datebtn_'+rand+'').show();
|
||||
this.dateobj.setView(d.atype);
|
||||
}else if(d.atype=='select'){
|
||||
$('#key_'+rand+'').hide();
|
||||
this.selobj.show();
|
||||
$('#date_'+rand+'').hide();
|
||||
$('#datebtn_'+rand+'').hide();
|
||||
var sdv = d.valuefields;
|
||||
if(!sdv)sdv='value';
|
||||
this.selobj.setData(d.data,d.displayfields, sdv);
|
||||
this.selobj.setValue('');
|
||||
this.changeluoji(this.luojiarr[2]);
|
||||
}else{
|
||||
this.selobj.hide();
|
||||
$('#key_'+rand+'').show();
|
||||
$('#date_'+rand+'').hide();
|
||||
$('#datebtn_'+rand+'').hide();
|
||||
}
|
||||
};
|
||||
this.changeluoji = function(d){
|
||||
$('#luoji_'+rand+'').html(''+d.name+' <span class="caret"></span>');
|
||||
this.luojiobj = d;
|
||||
};
|
||||
this.setData = function(fi, da){
|
||||
var i,
|
||||
a = can.columns;
|
||||
for(i=0; i<a.length; i++){
|
||||
if(a[i].dataIndex==fi){
|
||||
can.columns[i].data = da;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.createlisttable = function(){
|
||||
var s = '';
|
||||
s='<table><tr>';
|
||||
var i,a = can.columns;
|
||||
for(i=0; i<a.length; i++){
|
||||
s+='<td>';
|
||||
if(a[i].atype=='select'){
|
||||
}else{
|
||||
s+='<input class="form-control" name="'+a[i].dataIndex+'" placeholder="'+a[i].name+'" style="width:100px">';
|
||||
}
|
||||
s+='</td>';
|
||||
}
|
||||
s+='</tr></table>';
|
||||
obj.html(s);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.rocksearch = function(options){
|
||||
var defaultVal = {
|
||||
columns:[{
|
||||
|
||||
}],
|
||||
highsearch:true,
|
||||
listtable:false,
|
||||
width:500,backcall:function(){}
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var clsa = new rocksearch($(this), can);
|
||||
clsa.init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
268
mode/plugin/jquery-rockdatepicker-mobile.js
vendored
Normal file
268
mode/plugin/jquery-rockdatepicker-mobile.js
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
/**
|
||||
* rockdatepicker 时间选择插件-手机版本使用
|
||||
* caratename:雨中磐石(rainrock)
|
||||
* caratetime:2017-06-19 21:40:00
|
||||
* email:admin@rockoa.com
|
||||
* homepage:www.rockoa.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
js.onchangedate = function(){}; //选择时间回调
|
||||
function rockdatepicker_mobile(options){
|
||||
|
||||
var me = this;
|
||||
this.marr = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
this.weekarr= ['日','一','二','三','四','五','六'];
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
for(var i in options)this[i]=options[i];
|
||||
this.inputarr = ['year','month','day','hour','miners','miao'];
|
||||
this.inputkey = ['Y','m','d','H','i','s'];
|
||||
this.initdevvalue();
|
||||
this.showtoday();
|
||||
this.setcontent();
|
||||
};
|
||||
this.initdevvalue = function(){
|
||||
if(this.view=='date')this.format='Y-m-d';
|
||||
if(this.view=='year')this.format='Y';
|
||||
if(this.view=='month')this.format='Y-m';
|
||||
if(this.view=='datetime')this.format='Y-m-d H:i:s';
|
||||
if(this.view=='time')this.format='H:i:s';
|
||||
if(this.formats)this.format = this.formats;
|
||||
var lx = this.format;
|
||||
if(lx=='H:i:00'||lx=='H:i'||lx=='i:s')this.view='time';
|
||||
var minv = this.mindate;
|
||||
if(isempt(minv))minv= '1930-01-01 00:00:00';//最小时间
|
||||
this.mindate = minv;
|
||||
var maxv = this.maxdate;
|
||||
if(isempt(maxv))maxv= '2050-12-31 23:59:59';//最大时间
|
||||
this.maxdate = maxv;
|
||||
|
||||
this.max = this.shijienges(this.maxdate)
|
||||
this.min = this.shijienges(this.mindate);
|
||||
};
|
||||
this.showtoday = function(){
|
||||
var val = this.value;
|
||||
if(this.inputid!='')val=$('#'+this.inputid+'').val();
|
||||
if(this.inputobj)val=this.inputobj.value;
|
||||
if(this.view.indexOf('date')>-1 && val){
|
||||
if(!this.isdate(val))val = js.now('now');
|
||||
}
|
||||
if(this.view=='time'){
|
||||
if(val==''){val=js.now('now');}else{val=js.now('Y-m-d')+' '+val;}
|
||||
}
|
||||
if(val=='')val = js.now(this.view=='datetime' ? 'Y-m-d H:i:00' : this.format, val);
|
||||
this.nowtext= val;
|
||||
this.now = this.shijienges(val);
|
||||
};
|
||||
this.isdate = function(sj){
|
||||
if(!sj)return false;
|
||||
var bo = /^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/.test(sj);
|
||||
return bo;
|
||||
};
|
||||
this.setcontent=function(){
|
||||
var h = $('body,html').height();
|
||||
if(h<winHb())h=winHb();
|
||||
|
||||
var s = '<div pickermobile="qx" id="pickermobile_div0" style="background:rgba(0,0,0,0.5);width:100%;height:'+h+'px;z-index:9;position:absolute;text-align:center;left:0px;top:0px">';
|
||||
var inst = 'background:none;border:none;padding:10px 8px;color:#1389D3;font-size:20px';
|
||||
s+='</div>';
|
||||
s+='<div id="pickermobile_div1" style="width:100%;background:white;position:fixed;top:30%;z-index:10;">';
|
||||
s+='<div style="margin:5px;"><table width="100%"><tr>';
|
||||
|
||||
if(this.view != 'time'){
|
||||
s+=' <td style="padding:5px" align="center">';
|
||||
s+=' <div><input type="button" value="+" pickermobile="y1" style="'+inst+'"></div>';
|
||||
s+=' <div><select id="pickermobile_input_year" style="width:100%;height:30px">'+this.selectoption(this.min.Y,this.max.Y,this.now.Y)+'</select></div>';
|
||||
s+=' <div><input type="button" value="-" pickermobile="y2" style="'+inst+'"></div>';
|
||||
s+=' </td>';
|
||||
|
||||
s+=' <td style="padding:5px" align="center">';
|
||||
s+=' <div><input type="button" value="+" pickermobile="m1" style="'+inst+'"></div>';
|
||||
s+=' <div><select id="pickermobile_input_month" style="width:100%;height:30px">'+this.selectoption(1,12,this.now.m)+'</select></div>';
|
||||
s+=' <div><input type="button" value="-" pickermobile="m2" style="'+inst+'"></div>';
|
||||
s+=' </td>';
|
||||
|
||||
s+=' <td style="padding:5px" align="center">';
|
||||
s+=' <div><input type="button" value="+" pickermobile="d1" style="'+inst+'"></div>';
|
||||
s+=' <div><select id="pickermobile_input_day" style="width:100%;height:30px">'+this.selectoption(1,31,this.now.d)+'</select></div>';
|
||||
s+=' <div><input type="button" value="-" pickermobile="d2" style="'+inst+'"></div>';
|
||||
s+=' </td>';
|
||||
s+=' <td>日</td>';
|
||||
}
|
||||
if(this.view=='datetime' || this.view=='time'){
|
||||
|
||||
s+=' <td style="padding:5px" align="center">';
|
||||
s+=' <div><input type="button" value="+" pickermobile="h1" style="'+inst+'"></div>';
|
||||
s+=' <div><select id="pickermobile_input_hour" style="width:100%;height:30px">'+this.selectoption(0,23,this.now.H)+'</select></div>';
|
||||
s+=' <div><input type="button" value="-" pickermobile="h2" style="'+inst+'"></div>';
|
||||
s+=' </td>';
|
||||
|
||||
s+=' <td>:</td>';
|
||||
s+=' <td style="padding:5px" align="center">';
|
||||
s+=' <div><input type="button" value="+" pickermobile="i1" style="'+inst+'"></div>';
|
||||
s+=' <div><select id="pickermobile_input_miners" style="width:100%;height:30px">'+this.selectoption(0,59,this.now.i)+'</select></div>';
|
||||
s+=' <div><input type="button" value="-" pickermobile="i2" style="'+inst+'"></div>';
|
||||
s+=' </td>';
|
||||
|
||||
}
|
||||
s+='</tr>';
|
||||
|
||||
s+='</table></div>';
|
||||
s+='<div style="padding-bottom:20px"><table width="100%"><tr><td width="25%" align="center"><input type="button" value="清空" pickermobile="qk" style="background:none;border:none;padding:5px 10px;color:#888888"></td><td width="25%" align="center"><input type="button" value="现在" pickermobile="now" style="background:none;border:none;padding:5px 10px;color:#1389D3"></td><td width="25%" align="center"><input type="button" value="确定" pickermobile="ok" style="background:none;border:none;padding:5px 10px;color:#1389D3"></td><td width="25%" align="center"><input type="button" value="取消" pickermobile="qx" style="background:none;border:none;padding:5px 10px;color:#888888"></td></tr></table></div>';
|
||||
s+='</div>';
|
||||
$('body').append(s);
|
||||
$('[pickermobile]').click(function(){
|
||||
var lx = $(this).attr('pickermobile');
|
||||
me.clickbtn(lx);
|
||||
});
|
||||
this._changeday();
|
||||
$('#pickermobile_input_year').change(function(){
|
||||
me._changeday();
|
||||
});
|
||||
$('#pickermobile_input_month').change(function(){
|
||||
me._changeday();
|
||||
});
|
||||
};
|
||||
this.shijienges = function(sj){
|
||||
var Y=2017,m=1,d=17,H=0,i=0,s=0,ss1,ss2,ss3,total=0;
|
||||
ss1 = sj.split(' ');
|
||||
ss2 = ss1[0].split('-');
|
||||
Y = parseFloat(ss2[0]);
|
||||
if(ss2.length>1)m= parseFloat(ss2[1]);
|
||||
if(ss2.length>2)d= parseFloat(ss2[2]);
|
||||
if(ss1[1]){
|
||||
ss3 = ss1[1].split(':');
|
||||
H = parseFloat(ss3[0]);
|
||||
i = parseFloat(ss3[1]);
|
||||
if(ss3.length>2)s= parseFloat(ss3[2]);
|
||||
}
|
||||
total = parseFloat(''+Y+''+this.sa(m)+''+this.sa(d)+''+this.sa(H)+''+this.sa(i)+''+this.sa(s)+'');
|
||||
return {Y:Y,m:m,d:d,H:H,i:i,s:s,total:total};
|
||||
};
|
||||
this._changeday=function(){
|
||||
var o = get('pickermobile_input_day');
|
||||
if(!o)return;
|
||||
var Y = parseFloat(get('pickermobile_input_year').value);
|
||||
var m = parseFloat(get('pickermobile_input_month').value);
|
||||
var def= parseFloat(o.value);
|
||||
var max = me.marr[m-1];//这个月最大天数
|
||||
if(Y%4==0&&m==2)max=29;//判断是不是轮年
|
||||
if(def>max)def=max;
|
||||
o.length = 0;
|
||||
var oi;
|
||||
for(var i=1;i<=max;i++){
|
||||
oi = this.sa(i);
|
||||
o.options.add(new Option(oi,oi));
|
||||
}
|
||||
o.value = this.sa(def);
|
||||
};
|
||||
this.cancal=function(){
|
||||
$('#pickermobile_div0').remove();
|
||||
$('#pickermobile_div1').remove();
|
||||
};
|
||||
this.clickbtn=function(lx){
|
||||
if(lx=='qx')this.cancal();
|
||||
if(lx=='y1'||lx=='y2')this.addjian('year', lx, this.min.Y,this.max.Y);
|
||||
if(lx=='m1'||lx=='m2')this.addjian('month', lx, 1,12);
|
||||
if(lx=='d1'||lx=='d2')this.addjian('day', lx, 1,31);
|
||||
if(lx=='h1'||lx=='h2')this.addjian('hour', lx, 0,23);
|
||||
if(lx=='i1'||lx=='i2')this.addjian('miners', lx, 0,59);
|
||||
if(lx=='now')this.getnow();
|
||||
if(lx=='ok')this.queding();
|
||||
if(lx=='qk')this.clearo();
|
||||
};
|
||||
this.addjian=function(inp, lx,min,max){
|
||||
var jg =1;if(lx.indexOf('2')>0)jg=-1;
|
||||
var o = get('pickermobile_input_'+inp+'');
|
||||
if(!o)return;
|
||||
var ye = parseFloat(o.value);
|
||||
var jgs= ye+jg;
|
||||
if(jgs<min)jgs=max;
|
||||
if(jgs>max)jgs=min;
|
||||
o.value = this.sa(jgs);
|
||||
if(inp=='year'||inp=='month')this._changeday();
|
||||
};
|
||||
this.queding=function(){
|
||||
var Y=2017,m=1,d=17,H=16,i=26,s=0,o;
|
||||
var val = this.format;
|
||||
o = get('pickermobile_input_year');if(o)Y=o.value;
|
||||
o = get('pickermobile_input_month');if(o)m=o.value;
|
||||
o = get('pickermobile_input_day');if(o)d=o.value;
|
||||
o = get('pickermobile_input_hour');if(o)H=o.value;
|
||||
o = get('pickermobile_input_miners');if(o)i=o.value;
|
||||
val = val.replace('Y', this.sa(Y));
|
||||
val = val.replace('m', this.sa(m));
|
||||
val = val.replace('d', this.sa(d));
|
||||
val = val.replace('H', this.sa(H));
|
||||
val = val.replace('i', this.sa(i));
|
||||
val = val.replace('s', this.sa(s));
|
||||
var nobj = false;
|
||||
if(this.inputid&&get(this.inputid)){
|
||||
nobj = get(this.inputid);
|
||||
}
|
||||
if(this.inputobj){
|
||||
nobj = this.inputobj;
|
||||
}
|
||||
if(nobj){
|
||||
nobj.value=val;
|
||||
nobj.focus();
|
||||
js.onchangedate(nobj.name, nobj, val, this);
|
||||
}
|
||||
this.cancal();
|
||||
};
|
||||
this.clearo=function(){
|
||||
var val='',nobj = false;
|
||||
if(this.inputid&&get(this.inputid)){
|
||||
nobj = get(this.inputid);
|
||||
}
|
||||
if(this.inputobj){
|
||||
nobj = this.inputobj;
|
||||
}
|
||||
if(nobj){
|
||||
nobj.value=val;
|
||||
nobj.focus();
|
||||
js.onchangedate(nobj.name, nobj, val, this);
|
||||
}
|
||||
this.cancal();
|
||||
};
|
||||
this.sa = function(v){
|
||||
v = parseFloat(v);
|
||||
var v1 = ''+v+'';
|
||||
if(v<10)v1='0'+v+'';
|
||||
return v1;
|
||||
};
|
||||
this.getnow=function(){
|
||||
var now = this.shijienges(js.now('now')),mon= this.inputarr,mons= this.inputkey,i,o;
|
||||
for(i=0;i<mon.length;i++){
|
||||
o = get('pickermobile_input_'+mon[i]+'');
|
||||
if(o)o.value = this.sa(now[mons[i]]);
|
||||
}
|
||||
this.queding();
|
||||
};
|
||||
this.selectoption=function(min,max,dev){
|
||||
var s='',oi,sel;
|
||||
for(var i=min;i<=max;i++){
|
||||
oi = this.sa(i);
|
||||
sel= (dev && oi==this.sa(dev))?'selected':'';
|
||||
s='<option '+sel+' value="'+oi+'">'+oi+'</option>'+s+'';
|
||||
}
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
$.rockdatepicker_mobile = function(options){
|
||||
var defaultVal = {
|
||||
itemsclick:function(){},onshow:function(){},
|
||||
inputid:'',
|
||||
value:'',inputobj:false,
|
||||
format:'Y-m-d',view:'datetime'
|
||||
};
|
||||
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var aobj = new rockdatepicker_mobile(can);
|
||||
aobj.init();
|
||||
return aobj;
|
||||
};
|
||||
})(jQuery);
|
||||
652
mode/plugin/jquery-rockdatepicker.js
vendored
Normal file
652
mode/plugin/jquery-rockdatepicker.js
vendored
Normal file
@@ -0,0 +1,652 @@
|
||||
/**
|
||||
rockdatepicker 时间选择插件
|
||||
caratename:chenxihu
|
||||
caratetime:2014-05-13 21:40:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
js.onchangedate = function(){}; //选择时间回调
|
||||
function rockdatepicker(elet, options){
|
||||
var obj = $(elet);
|
||||
var can = options;
|
||||
var rand = js.getrand();
|
||||
var me = this;
|
||||
var timeas = null;
|
||||
this.rand = rand;
|
||||
|
||||
this.nY = 2014;//当前月份
|
||||
this.nm = 5;
|
||||
this.marr = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
this.weekarr= ['日','一','二','三','四','五','六'];
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
this.initdevvalue();
|
||||
obj[can.trigger](function(){
|
||||
me.setcontent();
|
||||
return false;
|
||||
});
|
||||
if(can.initshow){
|
||||
me.setcontent();
|
||||
};
|
||||
obj.attr('rockdatepickerbool','true');
|
||||
if(!can.editable)elet.readOnly =true;
|
||||
};
|
||||
this.initdevvalue = function(){
|
||||
if(can.view=='date')can.format='Y-m-d';
|
||||
if(can.view=='year')can.format='Y';
|
||||
if(can.view=='month')can.format='Y-m';
|
||||
if(can.view=='datetime')can.format='Y-m-d H:i:s';
|
||||
if(can.view=='time')can.format='H:i:s';
|
||||
if(can.formats)can.format = can.formats;
|
||||
var lx = can.format;
|
||||
if(lx=='H:i:00'||lx=='H:i'||lx=='i:s')can.view='time';
|
||||
var minv = can.mindate;
|
||||
if(isempt(minv))minv= obj.attr('mindate');
|
||||
if(isempt(minv))minv= '1930-01-01 00:00:00';//最小时间
|
||||
can.mindate = minv;
|
||||
var maxv = can.maxdate;
|
||||
if(isempt(maxv))maxv= obj.attr('maxdate');
|
||||
if(isempt(maxv))maxv= '2050-12-31 23:59:59';//最大时间
|
||||
can.maxdate = maxv;
|
||||
|
||||
this.max = this.shijienges(can.maxdate)
|
||||
this.min = this.shijienges(can.mindate);
|
||||
};
|
||||
this.showtoday = function(){
|
||||
this.todatetext = this.formdt('now');
|
||||
this.todate = this.shijienges(this.todatetext);
|
||||
var val = obj.val();
|
||||
if(can.inputid!='')val=$('#'+can.inputid+'').val();
|
||||
if(can.view.indexOf('date')>-1 && val){
|
||||
if(!this.isdate(val))val = this.todatetext;
|
||||
}
|
||||
if(can.view=='time'){
|
||||
if(val==''){val=js.now('now');}else{val=js.now('Y-m-d')+' '+val;}
|
||||
}
|
||||
if(val=='')val = this.formdt(can.view=='datetime' ? 'Y-m-d H:i:00' : can.format, val);
|
||||
this.nowtext= val;
|
||||
this.now = this.shijienges(val);
|
||||
};
|
||||
this.shijienges = function(sj){
|
||||
var Y=2014,m=1,d=1,H=0,i=0,s=0,ss1,ss2,ss3,total=0;
|
||||
ss1 = sj.split(' ');
|
||||
ss2 = ss1[0].split('-');
|
||||
Y = parseFloat(ss2[0]);
|
||||
if(ss2.length>1)m= parseFloat(ss2[1]);
|
||||
if(ss2.length>2)d= parseFloat(ss2[2]);
|
||||
if(ss1[1]){
|
||||
ss3 = ss1[1].split(':');
|
||||
H = parseFloat(ss3[0]);
|
||||
i = parseFloat(ss3[1]);
|
||||
if(ss3.length>2)s= parseFloat(ss3[2]);
|
||||
}
|
||||
total = parseFloat(''+Y+''+this.sa(m)+''+this.sa(d)+''+this.sa(H)+''+this.sa(i)+''+this.sa(s)+'');
|
||||
return {Y:Y,m:m,d:d,H:H,i:i,s:s,total:total};
|
||||
};
|
||||
this.sa = function(v){
|
||||
v = parseFloat(v);
|
||||
var v1 = ''+v+'';
|
||||
if(v<10)v1='0'+v+'';
|
||||
return v1;
|
||||
};
|
||||
this.createbasic = function(w, h){
|
||||
var s= '';
|
||||
s+= '<div class="rockdatepicker" id="rockdatepicker_'+rand+'" style="width:'+w+'px;height:'+h+'px;overflow:hidden;position:absolute;display:none;"></div>';
|
||||
$('body').prepend(s);
|
||||
|
||||
var oac = $('#rockdatepicker_'+rand+'');
|
||||
oac.show();
|
||||
this.setweizhi();
|
||||
setTimeout(function(){js.addbody(rand, 'remove', 'rockdatepicker_'+rand+''); },100);
|
||||
return oac;
|
||||
};
|
||||
this.setView = function(vis){
|
||||
can.view = vis;
|
||||
this.initdevvalue();
|
||||
};
|
||||
this.setcontent = function(){
|
||||
this.showtoday();
|
||||
$("div[class='rockdatepicker']").remove();
|
||||
if(can.view =='month' || can.format=='Y-m'){
|
||||
this.createmontview(1);
|
||||
return false;
|
||||
}
|
||||
if(can.view =='year' || can.format=='Y'){
|
||||
this.createmontview(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
var s= '',oi=0,w=270,h=278;
|
||||
if(can.view!='time'){
|
||||
s+=' <div style="background:#eeeeee;height:30px;overflow:hidden">';
|
||||
s+=' <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>';
|
||||
s+=' <td style="padding:0px 4px" class="td00" tdaddclick="-y" title="上一年">〈<td>';
|
||||
s+=' <td height="30" style="padding:0px 5px" nowrap><span class="rockdatepicker_span" id="rockdatepicker_year'+rand+'">2014</span>年<td>';
|
||||
s+=' <td style="padding:0px 4px" class="td00" tdaddclick="y" title="下一年">〉<td>';
|
||||
s+=' <td style="padding:0px 2px"><td>';
|
||||
s+=' <td style="padding:0px 4px" class="td00" tdaddclick="-m" title="上个月">〈<td>';
|
||||
s+=' <td height="30" style="padding:0px 5px" nowrap><span lass="rockdatepicker_span" id="rockdatepicker_month'+rand+'">06</span>月<td>';
|
||||
s+=' <td style="padding:0px 4px" class="td00" tdaddclick="m" title="下个月">〉<td>';
|
||||
s+=' <td style="padding:0px 4px" width="30%"> <td>';
|
||||
s+=' <td style="padding:0px 4px" class="td00" nowrap tdaddclick="today" title="当月"> 当月 <td>';
|
||||
s+=' </tr></table>';
|
||||
s+=' </div>';
|
||||
|
||||
s+=' <div style="height:188px;overflow:hidden" id="rockdatepicker_table'+rand+'" >';
|
||||
s+=' <table border="0" class="rockdatepicker_table" style="border-collapse:collapse" width="100%" cellspacing="0" cellpadding="0">';
|
||||
s+=' <tr height="30" bgcolor="#dedede">';
|
||||
for(var d=0; d<7; d++){
|
||||
s+='<td align="center" width="14.28%">'+this.weekarr[d]+'</td>';
|
||||
}
|
||||
s+=' </tr>';
|
||||
for(var r=1; r<=6; r++){
|
||||
s+='<tr height="26">';
|
||||
for(var d=1; d<=7; d++){
|
||||
oi++;
|
||||
s+='<td align="center" xu="'+oi+'" temp="nr">'+oi+'</td>';
|
||||
}
|
||||
s+='</tr>';
|
||||
}
|
||||
s+=' </table>';
|
||||
s+=' </div>';
|
||||
}else{
|
||||
s+='<div id="rockdatepicker_table'+rand+'" style="height:140px;overflow:hidden">';
|
||||
s+='</div>';
|
||||
w = 220;h=200;
|
||||
}
|
||||
|
||||
s+=' <div style="line-height:30px"> <font color="#888888">选择:</font><span id="rockdatepicker_span'+rand+'"></span>';
|
||||
s+=' <span><input min="0" max="23" onfocus="js.focusval=this.value" onblur="js.number(this)" id="rockdatepicker_input_h'+rand+'" style="width:24px;text-align:center;height:20px;line-height:16px;border:1px #cccccc solid;background:none" value="00" maxlength="2"></span>:';
|
||||
s+=' <span><input min="0" max="59" onfocus="js.focusval=this.value" onblur="js.number(this)" id="rockdatepicker_input_i'+rand+'" style="width:24px;text-align:center;height:20px;line-height:16px;border:1px #cccccc solid;background:none" value="00" maxlength="2"></span>:';
|
||||
s+=' <span><input min="0" max="59" onfocus="js.focusval=this.value" onblur="js.number(this)" id="rockdatepicker_input_s'+rand+'" style="width:24px;text-align:center;height:20px;line-height:16px;border:1px #cccccc solid;background:none" value="00" maxlength="2"></span>';
|
||||
s+= '</div>';
|
||||
s+=' <div style="height:30px;overflow:hidden;text-align:right;background:#eeeeee;line-height:28px">';
|
||||
s+=' <a href="javascript:;" class="a" id="rockdatepicker_clear'+rand+'">清空</a> ';
|
||||
s+=' <a href="javascript:;" class="a" id="rockdatepicker_now'+rand+'">现在</a> ';
|
||||
s+=' <a href="javascript:;" class="a" id="rockdatepicker_queding'+rand+'">确定</a> ';
|
||||
s+=' <a href="javascript:;" class="a" id="rockdatepicker_close'+rand+'">关闭</a> ';
|
||||
s+=' </div>';
|
||||
|
||||
|
||||
var oac = this.createbasic(w,h);
|
||||
oac.html(s);
|
||||
|
||||
this.objtd = oac.find("td[temp='nr']");
|
||||
oac.find("td[tdaddclick]").click(function(){
|
||||
me.changedatec($(this));
|
||||
});
|
||||
this.objtd.click(function(){
|
||||
me.tdclick(this);
|
||||
});
|
||||
this.setcontentinit();
|
||||
$('#rockdatepicker_close'+rand+'').click(function(){
|
||||
me.hidemenu();
|
||||
});
|
||||
$('#rockdatepicker_queding'+rand+'').click(function(){
|
||||
me.queding();
|
||||
});
|
||||
$('#rockdatepicker_now'+rand+'').click(function(){
|
||||
me.quenow();
|
||||
});
|
||||
$('#rockdatepicker_clear'+rand+'').click(function(){
|
||||
me.queclear();
|
||||
});
|
||||
$('#rockdatepicker_table'+rand+'').dblclick(function(){
|
||||
me.queding();
|
||||
});
|
||||
$('#rockdatepicker_table'+rand+'').mouseover(function(){
|
||||
me.hidefudong();
|
||||
});
|
||||
if(can.view!='time'){
|
||||
this.setcontentinit();
|
||||
this.addcale(this.now.Y, this.now.m);
|
||||
}else{
|
||||
$('#rockdatepicker_span'+rand+'').hide();
|
||||
}
|
||||
this.shetispannvel(0);
|
||||
};
|
||||
this.shetispannvel = function(lx){
|
||||
$('#rockdatepicker_span'+rand+'').html(''+this.now.Y+'-'+this.sa(this.now.m)+'-'+this.sa(this.now.d)+'');
|
||||
var ho = $('#rockdatepicker_input_h'+rand+'');
|
||||
var io = $('#rockdatepicker_input_i'+rand+'');
|
||||
var so = $('#rockdatepicker_input_s'+rand+'');
|
||||
ho.val(this.sa(this.now.H));
|
||||
io.val(this.sa(this.now.i));
|
||||
so.val(this.sa(this.now.s));
|
||||
|
||||
if(can.format.indexOf('H')<0){
|
||||
get('rockdatepicker_input_h'+rand+'').disabled=true;
|
||||
}else{
|
||||
if(lx==0)this.shetispannvelbulr('h');
|
||||
}
|
||||
if(can.format.indexOf('i')<0){
|
||||
get('rockdatepicker_input_i'+rand+'').disabled=true;
|
||||
}else{
|
||||
if(lx==0)this.shetispannvelbulr('i');
|
||||
}
|
||||
|
||||
if(can.format.indexOf('s')<0){
|
||||
get('rockdatepicker_input_s'+rand+'').disabled=true;
|
||||
}else{
|
||||
if(lx==0)this.shetispannvelbulr('s');
|
||||
}
|
||||
};
|
||||
this.shetispannvelbulr = function(lx){
|
||||
var o = $('#rockdatepicker_input_'+lx+''+rand+'');
|
||||
o.blur(function(){
|
||||
me.blurnum(this);
|
||||
});
|
||||
o.focus(function(){
|
||||
me.foucsnum(this);
|
||||
});
|
||||
};
|
||||
this.setcontentinit = function(){
|
||||
$('#rockdatepicker_year'+rand+'').parent().click(function(){
|
||||
me.changeyear(this);
|
||||
});
|
||||
$('#rockdatepicker_month'+rand+'').parent().click(function(){
|
||||
me.changemonth(this);
|
||||
});
|
||||
};
|
||||
//选择年的
|
||||
this.changeyear=function(o1){
|
||||
this.hidefudong();
|
||||
var o = $(o1);
|
||||
var off = o.offset();
|
||||
var s='<div class="rockdatepicker_fudong" id="rockdatepicker_fudong'+rand+'" style="left:'+(off.left-this.mleft-5)+'px;top:'+((off.top-this.mtop)+25)+'px;height:200px;width:70px">';
|
||||
var xuoi = 0,oi=0;
|
||||
for(var i=this.max.Y; i>=this.min.Y; i--){
|
||||
oi++;
|
||||
var cls= '';
|
||||
if(i==this.Y){
|
||||
cls='div01';
|
||||
xuoi = oi;
|
||||
}
|
||||
s+='<div class="'+cls+'">'+i+'</div>';
|
||||
}
|
||||
s+='</div>';
|
||||
$('#rockdatepicker_'+rand+'').append(s);
|
||||
$('#rockdatepicker_fudong'+rand+'').scrollTop(xuoi*20);
|
||||
$('#rockdatepicker_fudong'+rand+'').find('div').click(function(){
|
||||
me.changeyeara(this);
|
||||
});
|
||||
};
|
||||
//选择年的
|
||||
this.changemonth=function(o1){
|
||||
this.hidefudong();
|
||||
var o = $(o1);
|
||||
var off = o.offset();
|
||||
var s='<div class="rockdatepicker_fudong" id="rockdatepicker_fudong'+rand+'" style="left:'+(off.left-this.mleft-5)+'px;top:'+((off.top-this.mtop)+25)+'px;height:200px;width:60px">';
|
||||
var xuoi = 0,oi=0;
|
||||
for(var i=1; i<=12; i++){
|
||||
oi++;
|
||||
var cls= '';
|
||||
if(i==this.m){
|
||||
cls='div01';
|
||||
xuoi = oi;
|
||||
}
|
||||
s+='<div class="'+cls+'">'+i+'</div>';
|
||||
}
|
||||
s+='</div>';
|
||||
$('#rockdatepicker_'+rand+'').append(s);
|
||||
$('#rockdatepicker_fudong'+rand+'').scrollTop(xuoi*20);
|
||||
$('#rockdatepicker_fudong'+rand+'').find('div').click(function(){
|
||||
me.changemontha(this);
|
||||
});
|
||||
};
|
||||
this.hidefudong = function(){
|
||||
$('#rockdatepicker_fudong'+rand+'').remove();
|
||||
};
|
||||
this.changeyeara = function(o1){
|
||||
$('#rockdatepicker_year'+rand+'').html($(o1).html());
|
||||
this.selchagnge();
|
||||
};
|
||||
this.changemontha = function(o1){
|
||||
$('#rockdatepicker_month'+rand+'').html($(o1).html());
|
||||
this.selchagnge();
|
||||
};
|
||||
this.selchagnge=function(){
|
||||
var Y=parseFloat($('#rockdatepicker_year'+rand+'').html());
|
||||
var m=parseFloat($('#rockdatepicker_month'+rand+'').html());
|
||||
this.addcale(Y,m);
|
||||
me.hidefudong();
|
||||
};
|
||||
this.setweizhi = function(){
|
||||
var off = obj.offset();;
|
||||
if(can.inputid != '')off = $('#'+can.inputid+'').offset();
|
||||
var o = $('#rockdatepicker_'+rand+'');
|
||||
var nh = get('rockdatepicker_'+rand+'').clientHeight,
|
||||
nw = get('rockdatepicker_'+rand+'').clientWidth,
|
||||
t = off.top+can.top,
|
||||
dy = t+nh-winHb()-$(document).scrollTop(),
|
||||
l = off.left+can.left,
|
||||
jl = l+nw-winWb(),
|
||||
jl1 = 5;
|
||||
if($('body,html').height()>winHb())jl1=22;
|
||||
jl=jl+jl1;
|
||||
if(dy>0)t=t-dy-5;
|
||||
if(jl>0)l=l-jl;
|
||||
this.mleft = l;
|
||||
this.mtop = t;
|
||||
o.css({'left':''+l+'px','top':''+t+'px'});
|
||||
};
|
||||
//单元格单击
|
||||
this.tdclick = function(o){
|
||||
var o1 = $(o);
|
||||
var d = o1.text();
|
||||
if(isempt(d))return;
|
||||
this.now.Y = parseFloat(this.Y);
|
||||
this.now.m = parseFloat(this.m);
|
||||
this.now.d = parseFloat(d);
|
||||
this.objtd.removeClass();
|
||||
this.objtd.addClass('td00');
|
||||
o.className='td01';
|
||||
this.shetispannvel(1);
|
||||
};
|
||||
//确定
|
||||
this.queding = function(){
|
||||
var jg = $('#rockdatepicker_span'+rand+'').html();
|
||||
if(can.view=='time')jg=js.now('Y-m-d');
|
||||
var ho = get('rockdatepicker_input_h'+rand+'');
|
||||
var io = get('rockdatepicker_input_i'+rand+'');
|
||||
var so = get('rockdatepicker_input_s'+rand+'');
|
||||
if(ho)if(!ho.disabled)jg+=' '+ho.value+'';
|
||||
if(io)if(!io.disabled)jg+=':'+io.value+'';
|
||||
if(so)if(!so.disabled)jg+=':'+so.value+'';
|
||||
var val = jg;
|
||||
if(this.isdate(val)){
|
||||
val=this.formdt(can.format, val);
|
||||
}
|
||||
this.setValue(val);
|
||||
};
|
||||
this.quenow = function(){
|
||||
var val = this.formdt(can.format);
|
||||
this.setValue(val);
|
||||
};
|
||||
this.setValue = function(v){
|
||||
var nobj = false;
|
||||
if(can.inputid!=''){
|
||||
nobj = get(can.inputid);
|
||||
$('#'+can.inputid+'').val(v).focus();;
|
||||
}else{
|
||||
nobj = elet;
|
||||
obj.val(v).focus();;
|
||||
}
|
||||
if(nobj){
|
||||
js.onchangedate(nobj.name, nobj, v, this);
|
||||
}
|
||||
can.itemsclick(v, this);
|
||||
this.hidemenu();
|
||||
};
|
||||
this.getValue = function(){
|
||||
var s = '';
|
||||
if(can.inputid!=''){
|
||||
s = $('#'+can.inputid+'').val();;
|
||||
}else{
|
||||
s = obj.val();
|
||||
}
|
||||
return s;
|
||||
};
|
||||
this.queclear = function(){
|
||||
this.setValue('');
|
||||
};
|
||||
//单击
|
||||
this.itemsclick = function(o,event){
|
||||
|
||||
};
|
||||
this.hidemenu = function(){
|
||||
$('#rockdatepicker_'+rand+'').remove();
|
||||
};
|
||||
this.changedatec= function(o){
|
||||
var lx = o.attr('tdaddclick');
|
||||
if(lx=='m'){
|
||||
this.plftmonth(1);
|
||||
}
|
||||
if(lx=='-m'){
|
||||
this.plftmonth(-1);
|
||||
}
|
||||
if(lx=='y'){
|
||||
this.plftyear(1);
|
||||
}
|
||||
if(lx=='-y'){
|
||||
this.plftyear(-1);
|
||||
}
|
||||
if(lx =='today'){
|
||||
this.addcale(this.todate.Y,this.todate.m);
|
||||
}
|
||||
};
|
||||
//上个月
|
||||
this.plftmonth=function(lx)
|
||||
{
|
||||
var Y=parseFloat(this.Y),m=parseFloat(this.m);
|
||||
m=m+lx;
|
||||
if(m==0)m=12;
|
||||
if(m==13)m=1;
|
||||
if(m==12&&lx==-1)Y--;
|
||||
if(m==1&&lx==1)Y++;
|
||||
this.addcale(Y,m);
|
||||
};
|
||||
this.plftyear=function(lx){
|
||||
var Y=parseFloat(this.Y)+lx;
|
||||
this.addcale(Y,this.m);
|
||||
};
|
||||
|
||||
this.formdt=function(type,sj){
|
||||
return js.now(type, sj);
|
||||
};
|
||||
this.isdate = function(sj){
|
||||
if(!sj)return false;
|
||||
var bo = /^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/.test(sj);
|
||||
return bo;
|
||||
};
|
||||
this.addcale = function(Y,m){
|
||||
this.objtd.removeClass();
|
||||
this.objtd.html('');
|
||||
me.Y=parseFloat(Y);
|
||||
me.m=parseFloat(m);
|
||||
var first = ''+Y+'-'+m+'-01';
|
||||
var stuat = me.formdt('Y-m-w',first);
|
||||
stuat=stuat.split('-');
|
||||
var year = parseFloat(stuat[0]);
|
||||
var month = parseFloat(stuat[1]);
|
||||
var maxday = me.marr[month-1];//这个月最大天数
|
||||
if(year%4==0&&month==2)maxday=29;//判断是不是轮年
|
||||
if(month<10)month='0'+month;
|
||||
var ic=parseFloat(stuat[2]);
|
||||
var maic=1;
|
||||
var xq = 0,nic=ic-1;
|
||||
var xqarr=[0,0,0,0,0,0,0];
|
||||
var cls = '';
|
||||
for(var i=0;i<maxday;i++){
|
||||
maic=i+ic;
|
||||
var o = me.objtd[maic];
|
||||
var d = i+1;
|
||||
o.innerHTML=''+d+'';
|
||||
cls = 'td00';
|
||||
if(d== this.now.d)cls='td01';
|
||||
o.className = cls;
|
||||
}
|
||||
$('#rockdatepicker_year'+rand+'').html(Y);
|
||||
$('#rockdatepicker_month'+rand+'').html(month);
|
||||
};
|
||||
this.focusval = 0;
|
||||
this.blurnum = function(o){
|
||||
var o1 = $(o);
|
||||
var val = o.value;
|
||||
var mi = parseFloat(o1.attr('min'));
|
||||
var ma = parseFloat(o1.attr('max'));
|
||||
if(isNaN(val)||!val)val=this.focusval;
|
||||
val=parseFloat(val);
|
||||
if(val<mi)val=mi;
|
||||
if(val>ma)val=ma;
|
||||
o.value=this.sa(val);
|
||||
this.setoutshow=setTimeout("$('#rockdatepicker_spanselfaei"+rand+"').remove();",200);
|
||||
};
|
||||
this.foucsnum=function(o){
|
||||
clearTimeout(this.setoutshow);
|
||||
this.focusval = o.value;
|
||||
var o1 = $(o);
|
||||
var mi = parseFloat(o1.attr('min'));
|
||||
var ma = parseFloat(o1.attr('max'));
|
||||
o.select();
|
||||
$('#rockdatepicker_spanselfaei'+rand+'').remove();
|
||||
var s='<div style="bottom:52px;position:absolute;right:1px;padding:2px;border:1px #cccccc solid;background-color:#ffffff;font-size:14px;text-align:left" id="rockdatepicker_spanselfaei'+rand+'">';
|
||||
this.inputhis=o;
|
||||
for(var a=mi;a<=ma;a++){
|
||||
var ai = this.sa(a);
|
||||
if(ai==o.value)ai='<span style="color:#ff0000">'+ai+'</span>';
|
||||
s+='<font style="margin:2px">'+ai+'</font>';
|
||||
if((a+1)%10==0)s+='<br>';
|
||||
}
|
||||
s+='</div>';
|
||||
$('#rockdatepicker_'+rand+'').append(s);
|
||||
$('#rockdatepicker_spanselfaei'+rand+'').find('font').click(function(){
|
||||
var x = $(this).text();
|
||||
o.value = x;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.createmontview = function(lx){
|
||||
var w = 220,w1=109;
|
||||
if(lx==0){
|
||||
w=130;
|
||||
w1=w;
|
||||
}
|
||||
var oac = this.createbasic(w,270);
|
||||
var s = '';
|
||||
s+='<table border="0" width="100%" id="rockdatepicker_table'+rand+'" cellspacing="0" cellpadding="0"><tr valign="top">';
|
||||
s+=' <td width="'+w1+'"><div align="center" style="line-height:30px;background:#eeeeee"><a href="javascript:" id="rockdatepicker_yearshang'+rand+'" onclick="return false" class="a02">←</a> 年份 <a href="javascript:" id="rockdatepicker_yearxia'+rand+'" onclick="return false" class="a02">→</a> </div><div id="rockdatepicker_yearlist'+rand+'" style="line-height:30px;height:180px;overflow:hidden" align="center"></div></td>';
|
||||
if(lx == 1){
|
||||
s+=' <td width="2" bgcolor="#cccccc"></td>';
|
||||
s+=' <td width="109"><div align="center" style="line-height:30px;background:#eeeeee">月份</div><div id="rockdatepicker_monthlist'+rand+'" style="line-height:30px" align="center"></div></td>';
|
||||
}
|
||||
s+='</tr></table>';
|
||||
s+='<div style="line-height:30px"> <font color="#888888">选择:</font><span id="rockdatepicker_span'+rand+'">'+this.now.Y+'-0'+this.now.d+'</span></div>';
|
||||
s+='<div style="height:30px;overflow:hidden;text-align:right;background:#eeeeee;line-height:28px">';
|
||||
s+=' <a href="javascript:" onclick="return false" class="a" id="rockdatepicker_clear'+rand+'">清空</a>';
|
||||
s+=' <a href="javascript:" onclick="return false" class="a" id="rockdatepicker_now'+rand+'">现在</a>';
|
||||
s+=' <a href="javascript:" onclick="return false" class="a" id="rockdatepicker_queding'+rand+'">确定</a>';
|
||||
s+=' <a href="javascript:" onclick="return false" class="a" id="rockdatepicker_close'+rand+'">关闭</a>';
|
||||
s+='</div>';
|
||||
oac.html(s);
|
||||
$('#rockdatepicker_close'+rand+'').click(function(){
|
||||
me.hidemenu();
|
||||
});
|
||||
$('#rockdatepicker_queding'+rand+'').click(function(){
|
||||
me.queding();
|
||||
});
|
||||
$('#rockdatepicker_now'+rand+'').click(function(){
|
||||
me.quenow();
|
||||
});
|
||||
$('#rockdatepicker_clear'+rand+'').click(function(){
|
||||
me.queclear();
|
||||
});
|
||||
$('#rockdatepicker_yearshang'+rand+'').click(function(){
|
||||
me.montviewyear(me.montviewyearmin-1,1);
|
||||
});
|
||||
$('#rockdatepicker_yearxia'+rand+'').click(function(){
|
||||
me.montviewyear(me.montviewyearax+1,2);
|
||||
});
|
||||
$('#rockdatepicker_table'+rand+'').dblclick(function(){
|
||||
me.queding();
|
||||
});
|
||||
if(lx == 1)this.montviewmonth();
|
||||
this.montviewyear(this.now.Y,0);
|
||||
this.showviewffwfwe();
|
||||
};
|
||||
this.montviewmonth = function(){
|
||||
var s = '';
|
||||
for(var i=1; i<=12; i++){
|
||||
var oi = ''+i+'';
|
||||
if(i<10)oi = '0'+i+'';
|
||||
var cls = 'a02';
|
||||
if(i==this.now.m)cls='a03';
|
||||
var deval = parseFloat(''+this.now.Y+''+this.sa(i)+'01000000');
|
||||
if(deval<this.min.total || deval>this.max.total)cls+=' not';
|
||||
s+='<a href="javascript:" onclick="return false" class="'+cls+'">'+oi+'月</a> ';
|
||||
if(i%2==0)s+='<br>';
|
||||
}
|
||||
if(s=='')return false;
|
||||
var oss = $('#rockdatepicker_monthlist'+rand+'');
|
||||
oss.html(s);
|
||||
oss.find('a').click(function(){
|
||||
me.montviewyearcheng(this,1);
|
||||
});
|
||||
};
|
||||
this.montviewyear = function(y,lx){
|
||||
var min = y - 5;
|
||||
var max = y + 6;
|
||||
if(lx==1){
|
||||
max = y;
|
||||
min = y-11;
|
||||
}
|
||||
if(lx==2){
|
||||
min = y;
|
||||
max = y+11;
|
||||
}
|
||||
if(min<this.min.Y)min = this.min.Y;
|
||||
if(max>this.max.Y)max = this.max.Y;
|
||||
var oi = 0,s='',cls='';
|
||||
for(var i=min; i<=max; i++){
|
||||
if(oi==0)this.montviewyearmin = i;
|
||||
this.montviewyearax = i;
|
||||
cls = 'a02';
|
||||
if(i==this.now.Y)cls='a03';
|
||||
oi++;
|
||||
s+='<a href="javascript:" onclick="return false" class="'+cls+'">'+i+'</a> ';
|
||||
if(oi%2==0)s+='<br>';
|
||||
}
|
||||
if(s=='')return false;
|
||||
var oss = $('#rockdatepicker_yearlist'+rand+'');
|
||||
oss.html(s);
|
||||
oss.find('a').click(function(){
|
||||
me.montviewyearcheng(this,0);
|
||||
});
|
||||
};
|
||||
this.montviewyearcheng = function(o1,lx){
|
||||
if(o1.className.indexOf('not')>-1)return false;
|
||||
var ossa = $(o1).parent().find('a');
|
||||
for(var i=0;i<ossa.length;i++){
|
||||
var cls = ossa[i].className.replace('a03','a02');
|
||||
ossa[i].className = cls;
|
||||
}
|
||||
o1.className='a03';
|
||||
var val = o1.innerHTML.replace('月','');
|
||||
if(lx==0){
|
||||
this.now.Y = parseFloat(val);
|
||||
if(get('rockdatepicker_monthlist'+rand+''))this.montviewmonth();
|
||||
}
|
||||
if(lx==1){
|
||||
this.now.m = parseFloat(val);
|
||||
}
|
||||
this.showviewffwfwe();
|
||||
};
|
||||
this.showviewffwfwe=function(){
|
||||
var m = this.now.m;
|
||||
var y = this.now.Y;
|
||||
if(m<10)m='0'+m+'';
|
||||
var s = ''+y+'-'+m+'';
|
||||
if(!get('rockdatepicker_monthlist'+rand+''))s=y;
|
||||
$('#rockdatepicker_span'+rand+'').html(s);
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.rockdatepicker = function(options){
|
||||
var defaultVal = {
|
||||
left:2,top:28,width:0,autohide:true,
|
||||
itemsclick:function(){},onshow:function(){},initshow:false,removebo:false,
|
||||
trigger:'click',editable:false,inputid:'',format:'Y-m-d',formats:'',maxdate:'',mindate:'',view:'date'
|
||||
};
|
||||
|
||||
var o = $(this);
|
||||
if(o.attr('rockdatepickerbool')=='true')return false;
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var aobj = new rockdatepicker(this, can);
|
||||
aobj.init();
|
||||
return aobj;
|
||||
};
|
||||
})(jQuery);
|
||||
335
mode/plugin/jquery-rockdoupull.js
vendored
Normal file
335
mode/plugin/jquery-rockdoupull.js
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
/**
|
||||
* jqury的下拉上拉加载插件,带样式滚动条,呵呵。
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (xh829.com)
|
||||
* Date:2016-11-24
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function rockclass(element, options){
|
||||
var me = this;
|
||||
var opts = $.extend({
|
||||
ondragstart:function(){},
|
||||
ondrag:function(){},
|
||||
ondrayrl:function(){},
|
||||
ondrayrlend:false,
|
||||
scrollbool:true, //是否添加滚动条样式
|
||||
downbool:false, //是否下拉加载
|
||||
upbool:false, //是否上拉加载
|
||||
leftbool:false, //左
|
||||
rightbool:false, //右
|
||||
ondownbefore:function(){return true},
|
||||
onupbefore:function(){return true},
|
||||
downbgcolor:'#f1f1f1', //下拉背景
|
||||
upmsgdiv:'' //上来提示区域
|
||||
}, options);
|
||||
|
||||
var obj = element;
|
||||
this._init=function(){
|
||||
this.rand = js.getrand();
|
||||
this.reloadbo = false;
|
||||
this.mobj = $(obj);
|
||||
for(var a in opts)this[a]=opts[a];
|
||||
obj.addEventListener('touchstart',function(e){
|
||||
me._dragstart(e);
|
||||
},false);
|
||||
obj.addEventListener('touchmove',function(e){
|
||||
me._dragmove(e);
|
||||
},false);
|
||||
obj.addEventListener('touchend',function(e){
|
||||
this.removeEventListener('touchmove', function(){}, false);
|
||||
this.removeEventListener('touchstart', function(){}, false);
|
||||
me._dragend(e);
|
||||
},false);
|
||||
this._initscrool();
|
||||
};
|
||||
this._dragstart=function(e){
|
||||
if(this.reloadbo)return;
|
||||
$('#updowns_'+this.rand+'').remove();
|
||||
this.startarr = [e.touches[0].clientX, e.touches[0].clientY, this.mobj.scrollTop(),obj.scrollHeight-this.mobj.height()];
|
||||
if(this.upbool && this.upmsgdiv)this.startarr[4]=$('#'+this.upmsgdiv+'').html();
|
||||
this.upstartbo = false;
|
||||
this.up_ysa = 0;
|
||||
this.movearr = [0,0];
|
||||
this.ondragstart(e);
|
||||
};
|
||||
this._dragmove=function(e){
|
||||
if(this.reloadbo)return;
|
||||
this.upheight = 0;
|
||||
var hei = e.touches[0].clientY-this.startarr[1],downbo=false,upbo=false,ler = e.touches[0].clientX-this.startarr[0];
|
||||
this.movearr = [ler,hei];
|
||||
var updown = Math.abs(hei) > Math.abs(ler);
|
||||
if(this.up_ysa==0)this.up_ysa = updown ? 1 :2;
|
||||
//js.msg('msg',''+hei+'.'+ler+'');
|
||||
|
||||
//下拉刷新
|
||||
if(this.downbool && this.up_ysa==1){
|
||||
var dowbcak = this.ondownbefore();
|
||||
if(hei>0 && dowbcak && this.startarr[2]==0){
|
||||
e.preventDefault();
|
||||
downbo = true;
|
||||
}
|
||||
if(downbo){
|
||||
this._downstart(hei, dowbcak);
|
||||
}
|
||||
if(!downbo)$('#downs_'+this.rand+'').remove();
|
||||
}
|
||||
|
||||
//上拉刷新
|
||||
if(this.upbool && this.up_ysa==1){
|
||||
var upback = this.onupbefore();
|
||||
if(hei<0 && upback && this.startarr[2]==this.startarr[3]){
|
||||
e.preventDefault();
|
||||
upbo = true;
|
||||
}
|
||||
if(upbo){
|
||||
this._upstart(hei, upback);
|
||||
}
|
||||
if(!upbo)this.translateY(0);
|
||||
}
|
||||
|
||||
if(this.up_ysa==2){
|
||||
e.preventDefault();
|
||||
this.ondrayrl(ler, e);
|
||||
}
|
||||
|
||||
//左滑动
|
||||
if(this.leftbool && ler<0 && this.up_ysa==2){
|
||||
this.mobj.css('transform','translateX('+ler+'px)');
|
||||
}
|
||||
|
||||
//右滑动
|
||||
if(this.rightbool && ler>0 && this.up_ysa==2){
|
||||
this.mobj.css('transform','translateX('+ler+'px)');
|
||||
}
|
||||
|
||||
this.ondrag(e,this.movearr);
|
||||
};
|
||||
this._downstart=function(hei){
|
||||
if(this.reloadbo)return;
|
||||
hei = hei*0.6;
|
||||
this.upheight = hei;
|
||||
if(hei>200)return;
|
||||
var sid = 'downs_'+this.rand+'',tx= '↓ 下拉刷新',o1;
|
||||
if(hei>50)tx='↑ 释放立即刷新';
|
||||
if(get(sid)){
|
||||
o1 = $('#'+sid+'');
|
||||
o1.css('height',''+hei+'px').find('div').html(tx);
|
||||
}else{
|
||||
var s = '<div id="'+sid+'" style="height:'+hei+'px;overflow:hidden; line-height:50px;text-align:center;color:#666666;background:'+this.downbgcolor+';font-size:14px;position:relative"><div style="height:50px;line-height:50px;position:absolute;left:0px;bottom:0px;width:100%">'+tx+'</div></div>';
|
||||
this.mobj.before(s);
|
||||
}
|
||||
};
|
||||
this._upstart=function(hei, bsrs){
|
||||
if(this.reloadbo)return;
|
||||
hei = hei*0.6;
|
||||
this.upheight = hei;
|
||||
if(hei<-200)return;
|
||||
var a = {msg:'↑ 上拉刷新','msgok': '↓ 释放立即刷新','msgdiv':this.upmsgdiv},i;
|
||||
if(typeof(bsrs)=='object'){
|
||||
for(i in bsrs)a[i]=bsrs[i];
|
||||
}
|
||||
var tx= a.msg;
|
||||
if(hei<-50)tx=a.msgok;
|
||||
if(a.msgdiv)$('#'+a.msgdiv+'').html(tx);
|
||||
this.upstartbo = true;
|
||||
this.translateY(hei);
|
||||
};
|
||||
this.translateY=function(h){
|
||||
var o = obj,val= "translateY("+h+"px)";
|
||||
o.style.transform=val;
|
||||
o.style.webkitTransform=val;
|
||||
o.style.msTransform=val;
|
||||
o.style.MozTransform=val;
|
||||
o.style.OTransform=val;
|
||||
};
|
||||
this._dragend=function(e){
|
||||
var sid = 'downs_'+this.rand+'';
|
||||
if(get(sid)){
|
||||
var o1 = $('#'+sid+'');
|
||||
if(this.upheight>50){
|
||||
this.reloadbo = true;
|
||||
o1.animate({'height':'50px'},200,function(){
|
||||
o1.html('<img src="images/loading.gif" align="absmiddle"> 刷新中...');
|
||||
me.ondownsuccess ? me.ondownsuccess(e) : me.ondownok();
|
||||
});
|
||||
}else{
|
||||
$('#'+sid+'').slideUp(200);
|
||||
}
|
||||
}
|
||||
var bhui = true;
|
||||
if(this.upheight<0){
|
||||
this.translateY(0);
|
||||
if(this.upheight<-50){
|
||||
this.reloadbo = true;
|
||||
if(this.onupsuccess){
|
||||
this.onupsuccess();
|
||||
}else{
|
||||
setTimeout(function(){me.onupok()}, 500);
|
||||
}
|
||||
bhui = false;
|
||||
}
|
||||
}
|
||||
if(this.upstartbo || bhui){
|
||||
if(this.upmsgdiv)$('#'+this.upmsgdiv+'').html(this.startarr[4]);
|
||||
}
|
||||
if(this.ondrayrlend){
|
||||
this.ondrayrlend(this.movearr[0], e);
|
||||
}
|
||||
};
|
||||
this.ondownok=function(ts){
|
||||
this.reloadbo = false;
|
||||
var o1 = $('#downs_'+this.rand+'');
|
||||
if(!ts)ts='√ 刷新成功';
|
||||
o1.html(ts);
|
||||
setTimeout(function(){o1.slideUp(200,function(){o1.remove();});}, 500);
|
||||
};
|
||||
this.ondownerror=function(ts){
|
||||
if(!ts)ts='× 超时失败';
|
||||
this.ondownok(ts);
|
||||
};
|
||||
this.onupok=function(ts){
|
||||
this.reloadbo = false;
|
||||
this.upstartbo = false;
|
||||
};
|
||||
this.onuperror=function(ts){
|
||||
if(!ts)ts='× 超时失败';
|
||||
this.ondownok(ts);
|
||||
};
|
||||
this._initscrool=function(){
|
||||
if(!this.scrollbool)return;
|
||||
var off = this.mobj.offset();
|
||||
this.scrollsid = 'scrolllists_'+this.rand+'';
|
||||
var l = off.left+this.mobj.width()-6;
|
||||
this.scroor_h = 80;
|
||||
this.scroor_hs = obj.scrollHeight;
|
||||
var s = '<div style="height:'+this.scroor_h+'px;width:5px;background:rgba(0,0,0,0.3);display:none;overflow:hidden;border-radius:2px;right:0px;top:0px;position:absolute" id="'+this.scrollsid+'"></div>';
|
||||
s='<div id="'+this.scrollsid+'_min" style="height:'+obj.clientHeight+'px;width:5px;overflow:hidden;position:fixed;z-index:1;background:rgba(0,0,0,0);left:'+l+'px;top:'+off.top+'px">'+s+'</div>';
|
||||
$('body').append(s);
|
||||
this.resize();
|
||||
this.mobj.scroll(function(){
|
||||
me._scrollov();
|
||||
});
|
||||
};
|
||||
this._hidescrolls = function(){
|
||||
clearTimeout(this._hidescrollstime);
|
||||
this._hidescrollstime = setTimeout(function(){
|
||||
$('#'+me.scrollsid+'').fadeOut();
|
||||
},1000);
|
||||
};
|
||||
this._scrollovs=function(){
|
||||
clearTimeout(this._scrollovstime);
|
||||
this._scrollovstime=setTimeout(function(){
|
||||
me._scrollov();
|
||||
},1);
|
||||
};
|
||||
this._scrollov=function(){
|
||||
var top,zh,bl,mh,wzh;
|
||||
top = this.mobj.scrollTop();
|
||||
wzh = obj.scrollHeight;
|
||||
if(wzh!=this.scroor_hs){
|
||||
this.resize();
|
||||
}
|
||||
zh = wzh-obj.clientHeight;
|
||||
mh = obj.clientHeight-this.scroor_h; //可滚动高度
|
||||
bl = top/zh;
|
||||
var jgt = bl*mh;
|
||||
$('#'+this.scrollsid+'').css('top',''+jgt+'px').show();
|
||||
this._hidescrolls();
|
||||
};
|
||||
|
||||
|
||||
this.hidescrolls=function(){
|
||||
$('#'+this.scrollsid+'').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗口改变时重新设置滚动条
|
||||
*/
|
||||
this.resize = function(){
|
||||
if(!this.scrollbool)return;
|
||||
var off = this.mobj.offset(),zh;
|
||||
var l = off.left+this.mobj.width()-6,hei = obj.clientHeight;
|
||||
zh = obj.scrollHeight;
|
||||
$('#'+this.scrollsid+'_min').css({'left':''+l+'px','top':''+off.top+'px','height':''+hei+'px'});
|
||||
var bl = hei/zh;if(bl>1)bl=0.9;
|
||||
this.scroor_h = bl * hei;
|
||||
$('#'+this.scrollsid+'').css({'height':''+this.scroor_h+'px'});
|
||||
this.scroor_hs = zh;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.rockdoupull = function(options){
|
||||
var can = $.extend({}, options);
|
||||
var clsa = new rockclass(this[0], can);
|
||||
clsa._init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
/**
|
||||
* 长按
|
||||
*/
|
||||
function longpress(element, options){
|
||||
var me = this;
|
||||
var opts = $.extend({
|
||||
ondragstart:function(){return true;}, //按下前
|
||||
ondragend:function(){return true;}, //按下后
|
||||
downbgcolor:'#f1f1f1', //下拉背景
|
||||
presstime:500,
|
||||
onpress:function(){}
|
||||
}, options);
|
||||
|
||||
var obj = element;
|
||||
|
||||
var obj = element;
|
||||
this.ele = obj;
|
||||
this._init=function(){
|
||||
this.mobj = $(obj);
|
||||
for(var a in opts)this[a]=opts[a];
|
||||
obj.addEventListener('touchstart',function(e){
|
||||
me._dragstart(e);
|
||||
},false);
|
||||
obj.addEventListener('touchend',function(e){
|
||||
me._dragend(e);
|
||||
},false);
|
||||
};
|
||||
|
||||
this._dragstart=function(e){
|
||||
if(!this.ondragstart(e))return false;
|
||||
e.preventDefault();
|
||||
this.oldbackcolor = obj.style.backgroundColor;
|
||||
obj.style.backgroundColor = this.downbgcolor;
|
||||
this.anxiamiao = 0;
|
||||
clearInterval(this.shumiaotime);
|
||||
this.shumiaotime=setInterval(function(){
|
||||
me.downtimes(e);
|
||||
},100);
|
||||
};
|
||||
|
||||
this.downtimes=function(e){
|
||||
this.anxiamiao+=100;
|
||||
|
||||
if(this.anxiamiao>=this.presstime){
|
||||
this._dragend(e);
|
||||
this.onpress();//触发
|
||||
}
|
||||
};
|
||||
|
||||
this._dragend=function(e){
|
||||
obj.removeEventListener('touchstart', function(){}, false);
|
||||
clearInterval(this.shumiaotime);
|
||||
if(typeof(this.oldbackcolor=='string'))obj.style.backgroundColor = this.oldbackcolor;
|
||||
this.ondragend(this.anxiamiao>=this.presstime,e);
|
||||
};
|
||||
}
|
||||
|
||||
$.fn.longpress = function(options){
|
||||
var can = $.extend({}, options);
|
||||
var clsa = new longpress(this[0], can);
|
||||
clsa._init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
218
mode/plugin/jquery-rockediter.js
vendored
Normal file
218
mode/plugin/jquery-rockediter.js
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
/**
|
||||
编辑器
|
||||
caratename:chenxihu
|
||||
caratetime:214-09-01 21:40:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
*/
|
||||
var rockediterarray = [];
|
||||
(function ($) {
|
||||
|
||||
function rockediter(contid, can){
|
||||
|
||||
var me = this;
|
||||
this.selecttext = '';
|
||||
var obj = get(contid);
|
||||
var rand = js.getrand();
|
||||
this.oi = rockediterarray.length;
|
||||
|
||||
this.formatarray={
|
||||
'font':['字体样式','FontName', 'down'],
|
||||
'fontsize':['字体大小','FontSize', 'down'],
|
||||
'forecolor':['字体颜色','ForeColor', 'down'],
|
||||
'marks':['插入特殊符号','Marks'],
|
||||
'images':['上传图片','Images'],
|
||||
'imageslink':['插入图片链接','Imageslink'],
|
||||
'backcolor':['字体背景色','BackColor', 'down'],
|
||||
'html':['查看源码','HTML'],
|
||||
'arrow_out':['全屏',''],
|
||||
'emot':['插入表情',''],
|
||||
'cut':['剪切','Cut'],
|
||||
'paste':['粘贴','Paste'],
|
||||
'copy':['复制','Copy'],
|
||||
'selectall':['全选','SelectAll'],
|
||||
'hr':['添加水平线','InsertHorizontalRule'],
|
||||
'link_add':['添加链接','CreateLink'],
|
||||
'link_del':['删除链接','UnLink'],
|
||||
'bold':['加粗','Bold'],
|
||||
'italic':['斜体','Italic'],
|
||||
'underline':['下划线','Underline'],
|
||||
'strikethrough':['删除线','StrikeThrough'],
|
||||
'align_center':['居中对齐','JustifyCenter'],
|
||||
'align_justify':['两端对齐','JustifyFull'],
|
||||
'align_left':['左对齐','JustifyLeft'],
|
||||
'align_right':['右对齐','JustifyRight'],
|
||||
'list_bullets':['项目符号','insertunorderedlist'],
|
||||
'list_numbers':['数字编号','insertorderedlist'],
|
||||
'indent':['增加缩进量','Indent'],
|
||||
'indent_remove':['减小缩进量','Outdent'],
|
||||
'undo':['返回上一步','Undo'],
|
||||
'removeformat':['删除格式','RemoveFormat']
|
||||
}
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
this.createtbar();
|
||||
$('#'+contid+'_tbar a').click(function(event){
|
||||
me.toolsclick(event, this);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
this.createtbar = function(){
|
||||
var a = can.tbaricons.split(',');
|
||||
var s = '';
|
||||
for(var i=0; i<a.length; i++){
|
||||
var s1 = a[i];
|
||||
if(s1=='|'){
|
||||
s+='<span>|</span>';
|
||||
}else{
|
||||
var c = this.formatarray[s1];
|
||||
s+='<a title="'+c[0]+'" href="javascript:" xtype="'+c[1]+'"><img src="images/editer/text_'+s1+'.png" class="icons" align="absmiddle">';
|
||||
if(can.showtext)s+=' '+c[0]+'';
|
||||
if(c[2] == 'down')s+='<img src="images/editer/desc.gif" style="margin-left:3px" align="absmiddle">';
|
||||
s+='</a>';
|
||||
}
|
||||
}
|
||||
$('#'+contid+'_tbar').html(s);
|
||||
};
|
||||
|
||||
this.toolsclick = function(event, o1){
|
||||
var o = $(o1);
|
||||
var xtype = o.attr('xtype');
|
||||
this.selecttext = this.getSelText();
|
||||
if(xtype == 'Bold'){
|
||||
this.strreplace(this.selecttext, '[B]'+this.selecttext+'[/B]');
|
||||
}
|
||||
if(xtype == 'Italic'){
|
||||
this.strreplace(this.selecttext, '[I]'+this.selecttext+'[/I]');
|
||||
}
|
||||
if(xtype == 'Underline'){
|
||||
this.strreplace(this.selecttext, '[U]'+this.selecttext+'[/U]');
|
||||
}
|
||||
|
||||
if(xtype == 'RemoveFormat'){
|
||||
this.removeformat();
|
||||
}
|
||||
if(xtype == 'CreateLink'){
|
||||
this.createlink();
|
||||
}
|
||||
if(xtype == 'Images'){
|
||||
this.uploadImages();
|
||||
}
|
||||
};
|
||||
|
||||
this.createlink = function(){
|
||||
var h = '<div style="padding:10px;line-height:30px">';
|
||||
h+='<div style="padding:5px 0px"><font color="#888888">连接文字</font> <input id="createlinkwindow_text" style="width:50%" class="input" value="'+this.selecttext+'"></div>';
|
||||
h+='<div style="padding:5px 0px"><font color="#888888">连接地址</font> <input id="createlinkwindow_texturl" value="http://" class="input" style="width:78%"></div>';
|
||||
h+='</div>';
|
||||
js.tanbody('createlinkwindow', '添加连接', 400, 200, {html:h,btn:[{text:'确定'}]});
|
||||
get('createlinkwindow_texturl').focus();
|
||||
$('#createlinkwindow_btn0').click(function(){
|
||||
me.quedingadd();
|
||||
});
|
||||
};
|
||||
this.quedingadd = function(){
|
||||
var text = $('#createlinkwindow_text').val();
|
||||
var url = $('#createlinkwindow_texturl').val();
|
||||
var str1 = '[A,'+url+']'+text+'[/A]';
|
||||
if(isempt(text))return false;
|
||||
this.strreplace(text,str1);
|
||||
js.tanclose('createlinkwindow');
|
||||
};
|
||||
|
||||
//清除格式
|
||||
this.removeformat = function(){
|
||||
var cont = obj.value;
|
||||
cont = cont.replace(/\[.*?\]/gi, '');
|
||||
cont = cont.replace(/\<.*?\>/gi, '');
|
||||
obj.value = cont;
|
||||
};
|
||||
|
||||
this.addcont = function(str){
|
||||
obj.value+=str;
|
||||
};
|
||||
|
||||
this.strreplace = function(str,str1){
|
||||
if(isempt(str) || !get(contid))return false;
|
||||
var cont = obj.value;
|
||||
var s = '';
|
||||
if(isIE){
|
||||
var patt1 = new RegExp(""+str+"", "gi");
|
||||
s = cont.replace(patt1, str1);
|
||||
}else{
|
||||
var st = obj.selectionStart;
|
||||
var et = obj.selectionEnd;
|
||||
s = cont.substr(0, st)+str1;
|
||||
s+=cont.substr(et);
|
||||
}
|
||||
get(contid).value = s;
|
||||
if(!isIE)get(contid).focus();
|
||||
};
|
||||
this.getSelText = function(){
|
||||
var o = obj;
|
||||
var txt = '';
|
||||
if(isIE){
|
||||
txt = document.selection.createRange().text;
|
||||
} else {
|
||||
txt = o.value.substr(o.selectionStart,o.selectionEnd-o.selectionStart);
|
||||
}
|
||||
return txt;
|
||||
};
|
||||
|
||||
//删除图片
|
||||
this.uploadImages= function(){
|
||||
var h = '<div style="padding:10px;line-height:30px">';
|
||||
h+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
|
||||
h+='<tr>';
|
||||
h+=' <td width="110" height="110" align="center"><img id="createlinkwindow_imagesview" src="images/noface.jpg" width="100" height="100"></td>';
|
||||
h+=' <td style="padding:5px 10px;line-height:30px">';
|
||||
h+=' <div style="padding:5px 0px"><font color="#888888">图片地址:</font> <a href="javascript:" onclick="return rockediteruploadimage()">↑从本地上传</a></div>';
|
||||
h+=' <div style="padding:0px 0px"><input id="createlinkwindow_images" class="input" style="width:250px"></div>';
|
||||
//h+=' <div style="height:20px;overflow:hidden"></div>';
|
||||
//h+=' <div style="padding:5px 0px">宽:<input class="inputs" id="createlinkwindow_width" readonly style="width:60px"> 高:<input id="createlinkwindow_height" class="inputs" readonly style="width:60px"></div>';
|
||||
h+=' </td>';
|
||||
h+='</tr>';
|
||||
h+='</table>';
|
||||
h+='</div>';
|
||||
js.tanbody('createlinkwindow', '插入图片', 400, 200, {
|
||||
html:h,btn:[{text:'确定'}]
|
||||
});
|
||||
$('#createlinkwindow_btn0').click(function(){
|
||||
me.uploadImagesback();
|
||||
});
|
||||
};
|
||||
this.uploadImagesback= function(){
|
||||
var url = get('createlinkwindow_images').value;
|
||||
if(isempt(url))return false;
|
||||
this.addcont('[IMG,'+url+']');
|
||||
js.tanclose('createlinkwindow');
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
$.rockediter = function(contid,can){
|
||||
var fcan = js.apply({
|
||||
showtext : true,
|
||||
tbaricons : 'bold,italic,underline,|,link_add,images,removeformat'
|
||||
}, can);
|
||||
var clsa = new rockediter(contid, fcan);
|
||||
clsa.init();
|
||||
rockediterarray.push(clsa);
|
||||
return clsa;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
function rockediteruploadimage(){
|
||||
js.upload('rockediteruploadimageautoclose',{title:escape('本地上传图片'),maxup:1,uptype:'image',maxwidth:600});
|
||||
return false;
|
||||
}
|
||||
function rockediteruploadimageautoclose(a){
|
||||
var d = a[0];
|
||||
//$('#createlinkwindow_width').val(d.width);
|
||||
//$('#createlinkwindow_height').val(d.height);
|
||||
$('#createlinkwindow_images').val(d.thumbpath);
|
||||
get('createlinkwindow_imagesview').src=d.thumbpath;
|
||||
}
|
||||
59
mode/plugin/jquery-rockmodels.js
vendored
Normal file
59
mode/plugin/jquery-rockmodels.js
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* rockmodelmsg 模式窗口
|
||||
* caratename:rainrock
|
||||
* caratetime:2014-05-13 21:40:00
|
||||
* email:admin@rockoa.com
|
||||
* homepage:www.rockoa.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
//模式提示
|
||||
$.rockmodelmsg = function(lx, txt, sj,fun){
|
||||
clearTimeout($.rockmodelmsgtime);
|
||||
$('#rockmodelmsg').remove();
|
||||
js.msg('none');
|
||||
if(!fun)fun=function(){};
|
||||
if(lx=='none')return;
|
||||
var s = '<div id="rockmodelmsg" onclick="$(this).remove()" align="center" style="position:fixed;left:45%;top:30%;z-index:9999;border-radius:10px; background:rgba(0,0,0,0.7);color:white;font-size:18px;min-width:80px"><div style="padding:30px;">';
|
||||
if(lx=='wait'){
|
||||
if(!txt)txt='处理中...';
|
||||
s+='<div><img src="images/mloading.gif"></div>';
|
||||
s+='<div style="padding-top:5px">'+txt+'</div>';
|
||||
if(!sj)sj= 60;
|
||||
}
|
||||
if(lx=='ok'){
|
||||
if(!txt)txt='处理成功';
|
||||
s+='<div style="font-size:40px">✔</div>';
|
||||
s+='<div>'+txt+'</div>';
|
||||
}
|
||||
if(lx=='msg' || !lx){
|
||||
if(!txt)txt='提示';
|
||||
s+='<div style="font-size:40px;color:red">☹</div>';
|
||||
s+='<div style="color:red">'+txt+'</div>';
|
||||
}
|
||||
s+='</div></div>';
|
||||
$('body').append(s);
|
||||
if(!sj)sj = 3;
|
||||
var le = (winWb()-$('#rockmodelmsg').width())*0.5;
|
||||
var te = (winHb()-$('#rockmodelmsg').height())*0.5-10;
|
||||
$('#rockmodelmsg').css({'left':''+le+'px','top':''+te+'px'});
|
||||
$.rockmodelmsgtime = setTimeout(function(){
|
||||
$('#rockmodelmsg').remove();
|
||||
fun();
|
||||
}, sj*1000);
|
||||
}
|
||||
js.msgok = function(msg,fun,sj){
|
||||
$.rockmodelmsg('ok', msg,sj, fun);
|
||||
};
|
||||
js.msgerror = function(msg,fun,sj){
|
||||
$.rockmodelmsg('msg', msg,sj, fun);
|
||||
};
|
||||
js.loading = function(msg,sj){
|
||||
$.rockmodelmsg('wait', msg,sj);
|
||||
};
|
||||
js.unloading= function(){
|
||||
$.rockmodelmsg('none');
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
60
mode/plugin/jquery-rockqipao.js
vendored
Normal file
60
mode/plugin/jquery-rockqipao.js
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
rockqipao 提示气泡
|
||||
caratename:chenxihu
|
||||
caratetime:2014-09-02 17:00:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function rockqipao(element, options){
|
||||
var obj = element;
|
||||
var can = options;
|
||||
var rand = ''+parseInt(Math.random()*99999)+'';
|
||||
var me = this;
|
||||
this.rand = rand;
|
||||
|
||||
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
var s = '';
|
||||
var id = 'rockqipaoshowdiv_'+rand+'';
|
||||
var glid= obj.attr('id');
|
||||
s+='<div id="'+id+'" guanliid="'+glid+'" title="'+can.tip+'" style="position:absolute;z-index:8;left:5px;top:5px;width:'+can.width+'px;height:'+can.width+'px;background:'+can.bgcolor+';overflow:hidden;color:white;border-radius:'+(can.width*0.5)+'px;line-height:'+can.width+'px;cursor:pointer;font-size:12px" align="center">'+can.text+'</div>';
|
||||
$('body').append(s);
|
||||
|
||||
$('#'+id+'').click(function(){
|
||||
can.click(this);
|
||||
});
|
||||
$('#'+id+'').mouseover(function(){
|
||||
me.setweizhi();
|
||||
});
|
||||
this.setweizhi();
|
||||
};
|
||||
this.setweizhi = function(){
|
||||
var off = obj.offset();
|
||||
var l = off.left+ can.left - can.width*0.5;
|
||||
var t = off.top + can.top-can.width;
|
||||
$('#rockqipaoshowdiv_'+rand+'').css({left:''+l+'px',top:''+t+'px'});
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.rockqipao = function(options){
|
||||
var defaultVal = {
|
||||
click:function(){},
|
||||
text:'',
|
||||
left:5,
|
||||
top:0,
|
||||
width:20,
|
||||
bgcolor:'#ff6600',
|
||||
tip:''
|
||||
};
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var clsa = new rockqipao($(this), can);
|
||||
clsa.init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
109
mode/plugin/jquery-rocksilder.js
vendored
Normal file
109
mode/plugin/jquery-rocksilder.js
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
rocktabs 图片切换
|
||||
caratename:chenxihu
|
||||
caratetime:214-04-06 21:40:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function rocksilder(options){
|
||||
var rand = ''+parseInt(Math.random()*99999)+'';
|
||||
var me = this;
|
||||
this.rand = rand;
|
||||
for(var i1 in options)this[i1]=options[i1];
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
var i,len=this.data.length;
|
||||
this.oldoi = -1;
|
||||
var s = '<div id="rocksilder_'+this.rand+'" style="position:relative;height:'+this.height+'">';
|
||||
if(len==0)return;
|
||||
for(i=0;i<len;i++){
|
||||
s+='<div index="'+i+'" style="height:'+this.height+';overflow:hidden;display:none;position:absolute;left:0px;top:0px;width:100%">';
|
||||
s+='<div><img src="'+this.data[i].src+'" width="100%"></div>';
|
||||
s+='</div>';
|
||||
}
|
||||
var bo = 0;
|
||||
if(this.titlebool){
|
||||
bo = 30;
|
||||
s+='<div style="position:absolute;bottom:0px;left:0px;width:100%;background:rgba(0,0,0,0.3);text-align:center;color:white;line-height:30px;height:30px;padding:0px 0px;overflow:hidden" id="rocksildertitle_'+this.rand+'">'+this.data[0].title+'</div>';
|
||||
}
|
||||
s+='<div style="position:absolute;bottom:'+bo+'px;left:0px;width:100%;text-align:center;color:white;line-height:20px;height:20px;overflow:hidden;" id="rocksildertitlev_'+this.rand+'"></div>';
|
||||
s+='</div>';
|
||||
if(this.view==''){
|
||||
$('body').append(s);
|
||||
}else{
|
||||
$('#'+this.view+'').html(s);
|
||||
}
|
||||
this.mobj = $('#rocksilder_'+this.rand+'');
|
||||
this.mobj.find('div[index]').click(function(){
|
||||
me._click(this);
|
||||
return false;
|
||||
});
|
||||
this._showview(0);
|
||||
};
|
||||
this._click=function(o1){
|
||||
var oi= parseFloat($(o1).attr('index'));
|
||||
var d = this.data[oi];
|
||||
if(this.onclick){
|
||||
this.onclick(d);
|
||||
}else{
|
||||
if(d.url)js.location(d.url);
|
||||
}
|
||||
};
|
||||
this._showview=function(oi){
|
||||
clearTimeout(this.timeoutobj);
|
||||
if(!get('rocksilder_'+this.rand+''))return;
|
||||
var len = this.data.length;
|
||||
if(oi>=len)oi=0;
|
||||
var i,s='';
|
||||
if(this.oldoi>=0){
|
||||
this.mobj.find('div[index="'+this.oldoi+'"]').hide();
|
||||
this.mobj.find('div[index="'+oi+'"]').show();
|
||||
}else{
|
||||
this.mobj.find('div[index]').hide();
|
||||
this.mobj.find('div[index="'+oi+'"]').show();
|
||||
}
|
||||
$('#rocksildertitle_'+this.rand+'').html(this.data[oi].title);
|
||||
for(i=0;i<len;i++){
|
||||
if(i>0)s+=' ';
|
||||
if(i==oi){
|
||||
s+='<span style="font-size:18px">●</span>';
|
||||
}else{
|
||||
s+='<span style="font-size:16px" xu="'+i+'">○</span>';
|
||||
}
|
||||
}
|
||||
$('#rocksildertitlev_'+this.rand+'').html(s).find('span[xu]').click(function(){
|
||||
var xu = parseFloat($(this).attr('xu'));
|
||||
me._showview(xu);
|
||||
return false;
|
||||
});
|
||||
this.oldoi = oi;
|
||||
this.timeoutobj = setTimeout(function(){me._showview(oi+1);},this.changtime);
|
||||
};
|
||||
this.remove=function(){
|
||||
clearTimeout(this.timeoutobj);
|
||||
$('#rocksilder_'+this.rand+'').remove();
|
||||
}
|
||||
}
|
||||
|
||||
$.rocksilder = function(options){
|
||||
var defaultVal = {
|
||||
'view': '',
|
||||
'data':[],
|
||||
'height' :'150px',
|
||||
'titlebool':true,
|
||||
'onclick':false,
|
||||
'changtime':5000 //5秒
|
||||
};
|
||||
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
var clsa = new rocksilder(can);
|
||||
clsa.init();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
81
mode/plugin/jquery-rocktabs.js
vendored
Normal file
81
mode/plugin/jquery-rocktabs.js
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
rocktabs 选择卡
|
||||
caratename:chenxihu
|
||||
caratetime:214-04-06 21:40:00
|
||||
email:qqqq2900@126.com
|
||||
homepage:www.xh829.com
|
||||
|
||||
<div class="tabs" tabsindex="0">
|
||||
<div class="tabstitle">
|
||||
<ul>
|
||||
<li index="1" class="li01">公告</li>
|
||||
<li index="2">聚品茶</li>
|
||||
<li index="3">促销信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabscont hborder" style="height:259px; border-top:none">
|
||||
<div index="1">
|
||||
</div>
|
||||
<div index="2">
|
||||
</div>
|
||||
<div index="3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
function rocktabs(element, options){
|
||||
var obj = element;
|
||||
var can = options;
|
||||
var rand = ''+parseInt(Math.random()*99999)+'';
|
||||
var me = this;
|
||||
this.rand = rand;
|
||||
|
||||
var titobj,contobj;
|
||||
|
||||
//初始化
|
||||
this.init = function(){
|
||||
titobj = obj.find("div[class^='tabstitle']").find('li[index]');
|
||||
contobj = obj.find("div[class^='tabscont']").find('div[index]');
|
||||
var tri = obj.attr('trigger');
|
||||
if(tri == null || !tri)tri='click';
|
||||
|
||||
titobj[tri](function(){
|
||||
me.clicktitle(this);
|
||||
});
|
||||
var ind = obj.attr('tabsindex');//选中第几个选择卡
|
||||
if(ind == null || !ind)ind='0';
|
||||
if(ind == 'last')ind = titobj.length-1;
|
||||
this.indexshow(parseInt(ind));
|
||||
};
|
||||
|
||||
this.clicktitle = function(o1){
|
||||
var o = $(o1);
|
||||
var oi = o.attr('index');
|
||||
this.indexshow(parseInt(oi));
|
||||
};
|
||||
|
||||
this.indexshow = function(oi){
|
||||
titobj.removeClass();
|
||||
$(titobj[oi]).addClass('li01');
|
||||
contobj.hide();
|
||||
$(contobj[oi]).show();
|
||||
};
|
||||
}
|
||||
|
||||
$.fn.rocktabs = function(options){
|
||||
var defaultVal = {
|
||||
trigger:'click'
|
||||
};
|
||||
|
||||
var can = $.extend({}, defaultVal, options);
|
||||
return this.each(function() {
|
||||
var clsa = new rocktabs($(this), can);
|
||||
clsa.init();
|
||||
return clsa;
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
169
mode/plugin/jquery-rocktouch.js
vendored
Normal file
169
mode/plugin/jquery-rocktouch.js
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* 居于touch.js下屏幕滚动操作的
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
|
||||
function rockclass(element, options){
|
||||
var me = this;
|
||||
var opts = $.extend({
|
||||
ondragstart:function(){},
|
||||
ondrag:function(){},
|
||||
ondragrlend:function(){},
|
||||
ondragrl:function(){},
|
||||
scrollbool:false,
|
||||
dropdown_bgcolor:'#f1f1f1', //下拉背景色
|
||||
dropdown_success:function(){} //下拉回调
|
||||
}, options);
|
||||
var obj = element;
|
||||
|
||||
this._init=function(){
|
||||
this.rand = js.getrand();
|
||||
this.reloadbo = false;
|
||||
this.mobj = $(obj);
|
||||
for(var a in opts)this[a]=opts[a];
|
||||
touch.on(obj, 'dragstart', function(e){
|
||||
me._dragstart(e);
|
||||
});
|
||||
touch.on(obj, 'drag', function(e){
|
||||
e.preventDefault()
|
||||
me._drag(e);
|
||||
});
|
||||
touch.on(obj, 'dragend', function(e){
|
||||
me._dragend(e);
|
||||
});
|
||||
};
|
||||
this._dragstart=function(e){
|
||||
if(this.reloadbo)return;
|
||||
this.startarr = [e.distanceX, e.distanceY, this.mobj.scrollTop(), e.timeStamp];
|
||||
this.mobj.stop();
|
||||
this.ondragstart(e);
|
||||
};
|
||||
this._drag=function(e){
|
||||
if(this.reloadbo)return;
|
||||
var lx = e.direction;
|
||||
if(lx=='right' || lx=='left'){
|
||||
this._dragrightleft(e)
|
||||
return;
|
||||
}
|
||||
this.upheight = 0;
|
||||
if(this.scrollbool){
|
||||
clearTimeout(this._hidescrollstime);
|
||||
var hei = e.distanceY-this.startarr[1];
|
||||
var lef = this.startarr[2]-hei;
|
||||
if(lef<0)lef=0;
|
||||
this.mobj.scrollTop(lef);
|
||||
if(lef==0 && hei>0 && this.startarr[2]==0)this._upstart(hei,e);//继续下拉刷新
|
||||
}
|
||||
|
||||
this.ondrag(e);
|
||||
};
|
||||
this._dragrightleft=function(e){
|
||||
var yd = e.distanceX-this.startarr[0];
|
||||
this.ondragrl(yd,e);
|
||||
};
|
||||
this._upstart=function(hei){
|
||||
if(this.reloadbo)return;
|
||||
hei = hei*0.5;
|
||||
this.upheight = hei;
|
||||
if(hei>200)return;
|
||||
var sid = 'updowns_'+this.rand+'';
|
||||
$('#'+sid+'').remove();
|
||||
var tx= '↓ 下拉刷新';
|
||||
if(hei>50)tx='↑ 释放立即刷新';
|
||||
var s = '<div id="'+sid+'" style="height:'+hei+'px;overflow:hidden; line-height:50px;text-align:center;color:#666666;background:'+this.dropdown_bgcolor+';font-size:14px;position:relative"><div style="height:50px;line-height:50px;position:absolute;left:0px;bottom:0px;width:100%">'+tx+'</div></div>';
|
||||
this.mobj.before(s);
|
||||
};
|
||||
this._dragend=function(e){
|
||||
var lx = e.direction;
|
||||
var jg,hei,heis,hms,jgs,ass;
|
||||
jg = e.timeStamp-this.startarr[3];
|
||||
if(lx=='right' || lx=='left'){
|
||||
this._dragrightleftend(e);
|
||||
return;
|
||||
}
|
||||
hei = e.distanceY-this.startarr[1];
|
||||
heis= hei >0 ? -1 : 1;
|
||||
hms = 200;
|
||||
jgs = (hms-jg)/0.2 * heis;
|
||||
if(jg<hms){
|
||||
ass = this.mobj.scrollTop();
|
||||
this.mobj.animate({scrollTop:ass+jgs}, hms-jg+400);
|
||||
}
|
||||
var sid = 'updowns_'+this.rand+'';
|
||||
if(get(sid)){
|
||||
var o1 = $('#'+sid+'');
|
||||
if(this.upheight>50){
|
||||
this.reloadbo = true;
|
||||
o1.animate({'height':'50px'},200,function(){
|
||||
o1.html('<img src="images/loading.gif" align="absmiddle"> 刷新中...');
|
||||
me.dropdown_success(e);
|
||||
});
|
||||
}else{
|
||||
$('#'+sid+'').slideUp(200);
|
||||
}
|
||||
}
|
||||
};
|
||||
this._dragrightleftend=function(e){
|
||||
var yd = e.distanceX-this.startarr[0];
|
||||
this.ondragrlend(yd,e);
|
||||
};
|
||||
this.dropdown_ok=function(ts){
|
||||
this.reloadbo = false;
|
||||
var o1 = $('#updowns_'+this.rand+'');
|
||||
if(!ts)ts='√ 刷新成功';
|
||||
o1.html(ts);
|
||||
setTimeout(function(){o1.slideUp(200,function(){o1.remove();});}, 500);
|
||||
};
|
||||
this.scroll = function(){
|
||||
this.scrollbool = true;
|
||||
this.mobj.css('overflow','hidden');
|
||||
var off = this.mobj.offset();
|
||||
this.scrollsid = 'scrolllists_'+this.rand+'';
|
||||
var l = off.left+this.mobj.width()-6;
|
||||
var s = '<div style="height:80px;width:5px;background:rgba(0,0,0,0.3);display:none;overflow:hidden;border-radius:2px;right:0px;top:0px;position:absolute" id="'+this.scrollsid+'"></div>';
|
||||
s='<div id="'+this.scrollsid+'_min" style="height:'+obj.clientHeight+'px;width:5px;overflow:hidden;position:fixed;z-index:1;background:rgba(0,0,0,0);left:'+l+'px;top:'+off.top+'px">'+s+'</div>';
|
||||
$('body').append(s);
|
||||
this.resize();
|
||||
this.mobj.scroll(function(){
|
||||
me._scrollov();
|
||||
});
|
||||
this.mobj.resize(function(){
|
||||
me.resize();
|
||||
});
|
||||
};
|
||||
this._hidescrolls = function(){
|
||||
clearTimeout(this._hidescrollstime);
|
||||
this._hidescrollstime = setTimeout(function(){
|
||||
$('#'+me.scrollsid+'').fadeOut();
|
||||
},1000);
|
||||
};
|
||||
this._scrollov=function(){
|
||||
var top,zh,bl,mh,off,lets;
|
||||
top = this.mobj.scrollTop();
|
||||
off = this.mobj.offset();
|
||||
lets= off.top;
|
||||
zh = obj.scrollHeight-obj.clientHeight;
|
||||
mh = obj.clientHeight-80; //可滚动高度
|
||||
bl = top/zh;
|
||||
var jgt = bl*mh;
|
||||
$('#'+this.scrollsid+'').css('top',''+jgt+'px').show();
|
||||
this._hidescrolls();
|
||||
};
|
||||
this.resize = function(){
|
||||
var off = this.mobj.offset();
|
||||
var l = off.left+this.mobj.width()-6,hei = obj.clientHeight;
|
||||
$('#'+this.scrollsid+'_min').css({'left':''+l+'px','top':''+off.top+'px','height':''+hei+'px'});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.rocktouch = function(lx, options){
|
||||
var can = $.extend({}, options);
|
||||
var clsa = new rockclass(this[0], can);
|
||||
clsa._init();
|
||||
clsa[lx]();
|
||||
return clsa;
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
1
mode/plugin/jquery-signature.js
vendored
Normal file
1
mode/plugin/jquery-signature.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/*! jq-signature.min.js, v1.0.0, minified 2015-05-25 */!function(a,b,c){"use strict";function d(a,b){this.element=a,this.$element=c(this.element),this.canvas=!1,this.$canvas=!1,this.ctx=!1,this.drawing=!1,this.currentPos={x:0,y:0},this.lastPos=this.currentPos,this._data=this.$element.data(),this.settings=c.extend({},f,b,this._data),this.init()}a.requestAnimFrame=function(b){return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimaitonFrame||function(b){a.setTimeout(b,1e3/60)}}();var e="jqSignature",f={lineColor:"#222222",lineWidth:1,border:"1px dashed #AAAAAA",background:"#FFFFFF",width:300,height:100,autoFit:!1},g="<canvas></canvas>";d.prototype={init:function(){this.$canvas=c(g).appendTo(this.$element),this.$canvas.attr({width:this.settings.width,height:this.settings.height}),this.$canvas.css({boxSizing:"border-box",width:this.settings.width+"px",height:this.settings.height+"px",border:this.settings.border,background:this.settings.background,cursor:"crosshair"}),this.settings.autoFit===!0&&this._resizeCanvas(),this.canvas=this.$canvas[0],this._resetCanvas(),this.$canvas.on("mousedown touchstart",c.proxy(function(a){this.drawing=!0,this.lastPos=this.currentPos=this._getPosition(a)},this)),this.$canvas.on("mousemove touchmove",c.proxy(function(a){this.currentPos=this._getPosition(a)},this)),this.$canvas.on("mouseup touchend",c.proxy(function(a){this.drawing=!1;var b=c.Event("jq.signature.changed");this.$element.trigger(b)},this)),c(b).on("touchstart touchmove touchend",c.proxy(function(a){a.target===this.canvas&&a.preventDefault()},this));var d=this;!function e(){a.requestAnimFrame(e),d._renderCanvas()}()},clearCanvas:function(){this.canvas.width=this.canvas.width,this._resetCanvas()},getDataURL:function(){return this.canvas.toDataURL()},_getPosition:function(a){var b,c,d;return d=this.canvas.getBoundingClientRect(),a=a.originalEvent,-1!==a.type.indexOf("touch")?(b=a.touches[0].clientX-d.left,c=a.touches[0].clientY-d.top):(b=a.clientX-d.left,c=a.clientY-d.top),{x:b,y:c}},_renderCanvas:function(){this.drawing&&(this.ctx.moveTo(this.lastPos.x,this.lastPos.y),this.ctx.lineTo(this.currentPos.x,this.currentPos.y),this.ctx.stroke(),this.lastPos=this.currentPos)},_resetCanvas:function(){this.ctx=this.canvas.getContext("2d"),this.ctx.strokeStyle=this.settings.lineColor,this.ctx.lineWidth=this.settings.lineWidth},_resizeCanvas:function(){var a=this.$element.outerWidth();this.$canvas.attr("width",a),this.$canvas.css("width",a+"px")}},c.fn[e]=function(a){var b=arguments;if(void 0===a||"object"==typeof a)return this.each(function(){c.data(this,"plugin_"+e)||c.data(this,"plugin_"+e,new d(this,a))});if("string"==typeof a&&"_"!==a[0]&&"init"!==a){var f;return this.each(function(){var g=c.data(this,"plugin_"+e);g instanceof d&&"function"==typeof g[a]&&(f=g[a].apply(g,Array.prototype.slice.call(b,1))),"destroy"===a&&c.data(this,"plugin_"+e,null)}),void 0!==f?f:this}}}(window,document,jQuery);
|
||||
Reference in New Issue
Block a user