📄 dy_plug.min.js
字号:
$.win.alert('对不起,' + rule[i].msg + '!');
$("#"+i).focus();
return false;
}
};
if($("#"+i).val() == '') { //非必填写项,不为空才需要进行下面的检测。
continue;
};
/* 检查正则 */
if (rule[i].reg) {
var reg = rule[i].reg.replace(/\/u$/,'/').replace(/\\x\{(.{4})\}/g,"\\u$1");//后一个是子模式匹配,php中文正则和替换成js的
reg = eval(reg);
if (!(reg.test($("#"+i).val()))) {
alert('对不起' + rule[i].msg + '不符合要求!');
$("#"+i).focus();
return false;
}
};
if (rule[i].type) {
var reg;
switch (rule[i].type) {
case 'email' :
reg = /^([a-zA-Z0-9_\-\.])+@([a-zA-Z0-9\-])+\.[a-zA-Z0-9\-\.]+$/;
if (!(reg.test($("#"+i).val()))) {
alert('对不起,email不合法!');
$("#"+i).focus();
return false;
}
break;
case 'tel' :
reg = /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/;
if (!(reg.test($("#"+i).val()))) {
alert('对不起,电话号码不符合要求!');
$("#"+i).focus();
return false;
}
break;
case 'cn' :
reg = /^[\u4e00-\u9fa5]+$/;
if (!(reg.test($("#"+i).val()))) {
alert('对不起,' + rule[i].msg + '要求是纯中文字符');
$("#"+i).focus();
return false;
}
break;
};
reg = eval(reg);
if (!(reg.test($("#"+i).val()))) {
alert('对不起' + rule[i].msg + '不符合要求!');
$("#"+i).focus();
return false;
}
};
if (rule[i].min) {
if ( $("#"+i).val().byteLength() < rule[i].min) {
alert('对不起' + rule[i].msg + '太短!');
$("#"+i).focus();
return false;
}
};
if (rule[i].max) {
if ($("#"+i).val().byteLength() > rule[i].max) {
alert('对不起' + rule[i].msg + '太长!');
$("#"+i).focus();
return false;
}
}
};
return true;
}
})
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
};
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
jQuery.btnCancelClick = function() {
if (top.document.getElementById('popDiv')) {
top.$.pop.hide();
} else {
top.history.go(-1);
}
}
$.fn.slide = function(data) {
//var _this = this;
this.css('position','relative');
//alert($(this).parent().width());
var pid = this.attr('id');
var $body = $('<div id="' + pid + 'body"></div>');
var $foot = $('<div id="' + pid + 'foot"></div>');
var $num = $('<ul id="' + pid + 'num" style="position:absolute;bottom:21px;right:0;z-index:10;margin:0"></ul>');
var $height = this.innerHeight();
var $width = this.innerWidth();
$body.css({width: $width, height: $height - 21,position: 'relative'});
$foot.css({width: $width, height: 21,background: '#f7f7f7',filter: 'alpha(opacity=80)',opacity: '0.8',textAlign: 'center',lineHeight: '21px',position:'absolute',bottom:0,whiteSpace:'nowrap',overflow:'hidden'});
this.append($body).append($foot).append($num);
slide = (typeof slide == 'undefined') ? {} : slide;
slide[pid] = {};
slide[pid].point = 0;
slide[pid].timer = '';
slide[pid].data = data;
slide[pid].total = data.length,
slide[pid].change = function() {
this.point = this.point % this.total;
var h = '<a href="' + this.data[this.point].url + '" target="_blank" onmouseover="slide[\'' + pid + '\'].stop()" onmouseout="slide[\'' + pid + '\'].start()" ';
//var traffic_url = 'index.php?do=sys_traffic_click&id='+this.data[this.point].traffic_id;
if(this.data[this.point].traffic_id != ''){ //有流量统计时,添加onclick事件
h += " id=\"link-"+this.data[this.point].traffic_id+"\"";
//h += " onclick=traffic('" + traffic_url + "')";
};
h += '><img src="' + this.data[this.point].path + '" width="' + ($width) + '" height="' + ($height-21) + '" style="border:0"></a>';
$body.html(h).show()//hide().fadeIn(500);
h = '<a href="' + this.data[this.point].url + '" target="_blank" onmouseover="slide[\'' + pid + '\'].stop()" onmouseout="slide[\'' + pid + '\'].start()" style="font-size:12px;font-weight:700;color:#000;text-decoration:none;font-family:verdana,tahoma,arial;line-height:21px;"';
if(this.data[this.point].traffic_id != ''){ //有流量统计时,添加onclick事件
h += " id=\"link-"+this.data[this.point].traffic_id+"\"";
//h += "onclick=traffic('" + traffic_url + "')";
};
h += '>'+this.data[this.point].title + '</a>';
$foot.html(h);
/* 数字导航 */
var v = '';
for (var i = 0; i < slide[pid].data.length ; i++ ) {
v += '<li style="float:left;background:#ffddee;margin-left:2px;padding:0px 10px;line-height:14px;cursor:pointer;list-style:none">'+(i+1)+'</li>';
}
$('#'+pid + 'num').html(v);
$('#'+pid + 'num li').eq(this.point).attr('style','float:left;margin-left:2px;color:#fff;background:#66aaff;font-weight:bold;cursor:pointer;list-style:none;filter:alpha(opacity=90);opacity:.9;font-size:12px;width:20px;height:20px;line-height:20px;text-align:center;')
.siblings('li').attr('style','float:left;background:#ffccaa;margin-left:2px;cursor:pointer;list-style:none;filter:alpha(opacity=50);opacity:.5;font-size:12px;width:20px;height:20px;line-height:20px;text-align:center;')
/* 点击数字导航 */
$('#'+pid+' li').each(function(){
$(this).mousedown(function(){
slide[pid].point = parseInt($(this).html())-1;
slide[pid].change();
slide[pid].stop();
}).mouseup(function(){
slide[pid].start();
})
})
this.point ++;
},
slide[pid].start = function() {
this.timer = setInterval("slide['" + pid + "'].change()",10000);
},
slide[pid].stop = function() {
clearInterval(this.timer);
}
slide[pid].change();
slide[pid].start();
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -