first commit

This commit is contained in:
2026-08-31 16:22:00 +08:00
commit e969a1e559
2665 changed files with 128795 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,222 @@
(function($) {
$.fn.autopoint = function(options) {
defaults = {
url : options.url,
keyLeft : 37,// 向左方向键
keyUp : 38,// 向上方向键
keyRight : 39,// 向右方向键
keyDown : 40,// 向下方向键
keyEnter : 13,// 回车键
listHoverCSS : 'hoverLi',// 提示框列表鼠标悬浮的样式
topoffset : options.topoffset || 10
};
var options = $.extend(defaults, options);
var dropDiv = $('<ul id="tie" class="hide"></ul>').appendTo('#adjust_text');
var isOver = false;
dropDiv.hover(function() {
isOver = true;
}, function() {
isOver = false;
});
return this
.each(function() {
var pa = $(this);
$(this)
.bind(
'keydown',
function(event) {
if (dropDiv.css('display') != 'none') {// 当提示层显示时才对键盘事件处理
var currentList = dropDiv
.find('.' + options.listHoverCSS);
if (event.keyCode == options.keyDown) {// 如果按的是向下方向键
if (currentList.length == 0 || getPointWord(currentList.next()
.mouseover())=="") {
// 如果提示列表没有一个被选中,则将列表第一个选中
$(this)
.val(
getPointWord(dropDiv
.find('.list:first')
.mouseover()));
} else if (currentList.next().length == 0) {
// 如果是最后一个被选中,则取消选中,即可认为是输入框被选中
unHoverAll();
} else {
unHoverAll();
// 将原先选中列的下一列选中
if (currentList.next().length != 0)
$(this)
.val(
getPointWord(currentList
.next()
.mouseover()));
}
return false;
} else if (event.keyCode == options.keyUp) {// 如果按的是向上方向键
if (currentList.length == 0 || getPointWord(currentList.prev()
.mouseover())=="") {
$(this)
.val(
getPointWord(dropDiv
.find(
'.list:last')
.mouseover()));
} else if (currentList.prev().length == 0) {
unHoverAll();
} else {
unHoverAll();
if (currentList.prev().length != 0)
$(this)
.val(
getPointWord(currentList
.prev()
.mouseover()));
}
return false;
} else if (event.keyCode == options.keyEnter)
{
dropDiv.empty().hide();
}
}
// 当按下键之前记录输入框值,以方便查看键弹起时值有没有变
$(this).attr('alt', $(this).val());
})
.bind(
'keyup',
function(event) {
// 如果弹起的键是向上或向下方向键则返回
if (event.keyCode == options.keyDown
|| event.keyCode == options.keyUp)
return;
//modified by weic.lu 输入英文文本长度大等于2时才搜索
//中文长度>=1
var kwLength = 0;
if($(this).val() != '' && $(this).val().length>1)
{
var kwContent = $(this).val();
for(var i=0; i<kwContent.length; i++)
{
if(kwContent.charCodeAt(i)>255)
{
kwLength += 2;
}
else
{
kwLength += 1;
}
if(kwLength>=2)
{
break;
}
}
}
if ($(this).val() == '' || kwLength.length<2) {
dropDiv.empty().hide();
return;
}
// 若输入框值没有改变或变为空则返回
if ($(this).val() == $(this)
.attr('alt'))
return;
getData(pa, $(this).val());
})
.bind(
'blur',
function() {
if (isOver
&& dropDiv
.find('.' + options.listHoverCSS) != 0)
return;
// 文本输入框失去焦点则清空并隐藏提示层
dropDiv.empty().hide();
});
/** 处理ajax返回成功的方法* */
handleResponse = function(parent, json) {
if (json == null || json.length == 0) {
// 返回数据为空
$("#tie").hide();
return ;
}
refreshDropDiv(parent, json);
dropDiv.show();
}
/** 处理ajax失败的方法* */
handleError = function(error) {
// showError("由于url错误或超时请求失败!");
}
showError = function(error) {
alert(error);
}
/** 通过ajax返回json格式数据生成用来创建dom的字符串* */
render = function(parent, json) {
var appendStr = '';
// 用json对象中内容替换模版字符串中匹配/\{([a-z]+)\}/ig的内容,如{word},{view}
for ( var i = 0; i < json.length; i ++) {
if(i<json.length)
appendStr += '<li class="list" title="'+json[i].name+'"><span>约'+json[i].num+'条</span><div>'+json[i].name+'</div></li>';
}
appendStr += '<li class="close"><a onclick=$("#tie").hide() href="javascript:void(0)">[关闭]</a></li>' ;
jebind(parent, appendStr);
}
/** 将新建dom对象插入到提示框中,并重新绑定mouseover事件监听* */
jebind = function(parent, a) {
dropDiv.append(a);
dropDiv.find('.list').each(function() {
$(this).unbind('mouseover').mouseover(function() {
unHoverAll();
$(this).addClass(options.listHoverCSS);
}).unbind('click').click(function() {
parent.val(getPointWord($(this)));
dropDiv.empty().hide();
parent.focus();
var reqUrl = options.url.replace("searchsuggest.do","searchgoods.do");
window.location.href = reqUrl + "?keyword="
+ encodeURI(parent.val());
});
});
}
/**将提示框中所有列的hover样式去掉**/
unHoverAll = function() {
dropDiv.find('.list').each(function() {
$(this).removeClass(options.listHoverCSS);
});
}
/**在提示框中取得当前选中的提示关键字**/
getPointWord = function(p) {
return p.find('div:first').text()
}
/**刷新提示框,并设定样式**/
refreshDropDiv = function(parent, json) {
var left = parent.offset().left;
var height = parent.height();
var top = parent.offset().top + options.topoffset
+ height;
var width = options.width || parent.width() + 'px';
dropDiv.empty();
dropDiv.css(
{"background":"none repeat scroll 0 0 #FFFFFF",
"border":"1px solid #990005",
"overflow":"hidden",
"position":"absolute",
"top":"30px",
"width":"350px"}
);
render(parent, json);
//防止ajax返回之前输入框失去焦点导致提示框不消失
parent.focus();
}
/**通过ajax向服务器请求数据**/
getData = function(parent, word) {
word = word.replace(/[()'";,{}~!@#$%^&*(){}?\|<>.]/g,"");
$.getJSON(options.url+"?keyword="+encodeURI(encodeURI(word))+"&callback=?",function(json) {
handleResponse(parent, json);
}
);
}
});
}
})(jQuery);
@@ -0,0 +1,6 @@
// html5shiv MIT @rem remysharp.com/html5-enabling-script
// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector
/*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++a<o;)d.createElement(i[a])}function p(d,a){for(var e=-1,b=d.length,j,q=[];++e<b;){j=d[e];if((a=j.media||a)!="screen")q.push(p(j.imports,a),j.cssText)}return q.join("")}var g=c.createElement("div");g.innerHTML="<z>i</z>";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")",
"gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l,
g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d<o;){a=c.getElementsByTagName(i[d]);e=a.length;for(b=-1;++b<e;)if(a[b].className.indexOf("iepp_")<0)a[b].className+=" iepp_"+i[d]}r.appendChild(f);k.appendChild(h);h.className=f.className;h.innerHTML=f.innerHTML.replace(t,"<$1font")});m.attachEvent("onafterprint",
function(){h.innerHTML="";k.removeChild(h);k.appendChild(f);l.styleSheet.cssText=""})}})(this,document);@*/
@@ -0,0 +1,69 @@
jQuery.fn.sSelect = function () {
var selectId = $(this).attr('id');
var selectIndex;
$(this).append('<div class="dropselectbox"><h4><span></span><em></em></h4><ul style="display:none"></ul></div>');
$.each($('#' + selectId + ' > select > option:selected'), function (i) {
$('#' + selectId + ' > div > h4 >em').empty().append($(this).text());
});
$('.dropselectbox').show();
$('#' + selectId + ' > select').hide();
$('#' + selectId).bind("click", function (e) {
selectId = $(this).attr('id');
if ($('#' + selectId + ' > div > ul').css("display") == 'block') {
$('.dropselectbox > ul').empty().hide();
$('.dropselectbox > h4').removeClass("over");
} else {
$('#' + selectId + ' > div > ul').empty().toggle();
$('#' + selectId + ' > div > h4').toggleClass("over");
setSelectValue(selectId);
//select option
$('#' + selectId + ' > div > ul > li').click(function (e) {
selectIndex = $('#' + selectId + ' > div > ul > li').index($(this)[0]);
$('#' + selectId + '> select > option').removeAttr("selected");
$('#' + selectId + '> select > option').eq(selectIndex).attr("selected", "selected");
setSelectValue(selectId);
cleadMenu();
e.stopPropagation()
})
.hover(
function () {
$('#' + selectId + ' > div > ul > li').removeClass("over");
$(this).addClass("over");
},
function () {
$(this).removeClass("over");
}
);
$(document).bind("click", cleadMenu);
}
e.stopPropagation()
})
.bind("selectstart", function () {
return false;
})
.bind("blur", function () {
cleadMenu();
});
}
function cleadMenu(){
$('.dropselectbox > ul').empty().hide();
$('.dropselectbox > h4').removeClass("over");
$(document).unbind("click",cleadMenu);
}
function setSelectValue(sID) {
$.each($('#' + sID + ' > select > option'), function (i) {
var classStr = "";
if($(this).attr("class")){
classStr = " class='" + $(this).attr("class") + "'";
}
$('#' + sID + ' > div > ul').append("<li" + classStr +">" + $(this).text() + "</li>");
});
$.each($('#' + sID + ' > select > option:selected'), function (i) {
$('#' + sID + ' > div > h4 > em').empty().append($(this).text());
$('#' + sID + ' > div > ul > li').eq(i).addClass("over").addClass("selectedli");
});
}
@@ -0,0 +1,176 @@
/*--------------------------------------------------------------------------------------------------*/
$.fn.extend({//添加滚轮事件
mousewheel:function(Func){
return this.each(function(){
var _self = this;
_self.D = 0;//滚动方向
if($.browser.msie||$.browser.safari){
_self.onmousewheel=function(){_self.D = event.wheelDelta;event.returnValue = false;Func && Func.call(_self);};
}else{
_self.addEventListener("DOMMouseScroll",function(e){
_self.D = e.detail>0?-1:1;
e.preventDefault();
Func && Func.call(_self);
},false);
}
});
}
});
$.fn.extend({
jscroll:function(j){
return this.each(function(){
j = j || {}
j.Bar = j.Bar||{};//2级对象
j.Btn = j.Btn||{};//2级对象
j.Bar.Bg = j.Bar.Bg||{};//3级对象
j.Bar.Bd = j.Bar.Bd||{};//3级对象
j.Btn.uBg = j.Btn.uBg||{};//3级对象
j.Btn.dBg = j.Btn.dBg||{};//3级对象
var jun = { W:"15px"
,BgUrl:""
,Bg:"#efefef"
,Bar:{ Pos:"up"
,Bd:{Out:"#b5b5b5",Hover:"#ccc"}
,Bg:{Out:"#fff",Hover:"#fff",Focus:"orange"}}
,Btn:{ btn:true
,uBg:{Out:"#ccc",Hover:"#fff",Focus:"orange"}
,dBg:{Out:"#ccc",Hover:"#fff",Focus:"orange"}}
,Fn:function(){}}
j.W = j.W||jun.W;
j.BgUrl = j.BgUrl||jun.BgUrl;
j.Bg = j.Bg||jun.Bg;
j.Bar.Pos = j.Bar.Pos||jun.Bar.Pos;
j.Bar.Bd.Out = j.Bar.Bd.Out||jun.Bar.Bd.Out;
j.Bar.Bd.Hover = j.Bar.Bd.Hover||jun.Bar.Bd.Hover;
j.Bar.Bg.Out = j.Bar.Bg.Out||jun.Bar.Bg.Out;
j.Bar.Bg.Hover = j.Bar.Bg.Hover||jun.Bar.Bg.Hover;
j.Bar.Bg.Focus = j.Bar.Bg.Focus||jun.Bar.Bg.Focus;
j.Btn.btn = j.Btn.btn!=undefined?j.Btn.btn:jun.Btn.btn;
j.Btn.uBg.Out = j.Btn.uBg.Out||jun.Btn.uBg.Out;
j.Btn.uBg.Hover = j.Btn.uBg.Hover||jun.Btn.uBg.Hover;
j.Btn.uBg.Focus = j.Btn.uBg.Focus||jun.Btn.uBg.Focus;
j.Btn.dBg.Out = j.Btn.dBg.Out||jun.Btn.dBg.Out;
j.Btn.dBg.Hover = j.Btn.dBg.Hover||jun.Btn.dBg.Hover;
j.Btn.dBg.Focus = j.Btn.dBg.Focus||jun.Btn.dBg.Focus;
j.Fn = j.Fn||jun.Fn;
var _self = this;
var Stime,Sp=0,Isup=0;
$(_self).css({overflow:"hidden",position:"relative",padding:"0px"});
var dw = $(_self).width(), dh = $(_self).height()-1;
var sw = j.W ? parseInt(j.W) : 21;
var sl = dw - sw
var bw = j.Btn.btn==true ? sw : 0;
if($(_self).children(".jscroll-c").height()==null){//存在性检测
$(_self).wrapInner("<div class='jscroll-c' style='top:0px;z-index:9999;zoom:1;position:relative'></div>");
$(_self).children(".jscroll-c").prepend("<div style='height:0px;overflow:hidden'></div>");
$(_self).append("<div class='jscroll-e' unselectable='on' style=' height:100%;top:0px;right:0;-moz-user-select:none;position:absolute;overflow:hidden;z-index:10000;'><div class='jscroll-u' style='position:absolute;top:0px;width:100%;left:0;background:blue;overflow:hidden;'></div><div class='jscroll-h' unselectable='on' style='background:green;position:absolute;left:0;-moz-user-select:none;border-top:1px solid;border-bottom:1px solid;'></div><div class='jscroll-d' style='position:absolute;bottom:0px;width:100%;left:0;background:blue;overflow:hidden'></div></div>");
}
var jscrollc = $(_self).children(".jscroll-c");
var jscrolle = $(_self).children(".jscroll-e");
var jscrollh = jscrolle.children(".jscroll-h");
var jscrollu = jscrolle.children(".jscroll-u");
var jscrolld = jscrolle.children(".jscroll-d");
if($.browser.msie){document.execCommand("BackgroundImageCache", false, true);}
jscrollc.css({"padding-right":sw});
jscrolle.css({width:sw,background:j.Bg,"background-image":j.BgUrl});
jscrollh.css({top:bw,background:j.Bar.Bg.Out,"background-image":j.BgUrl,"border-color":j.Bar.Bd.Out,width:sw});
jscrollu.css({height:bw,background:j.Btn.uBg.Out,"background-image":j.BgUrl});
jscrolld.css({height:bw,background:j.Btn.dBg.Out,"background-image":j.BgUrl});
jscrollh.hover(function(){if(Isup==0)$(this).css({background:j.Bar.Bg.Hover,"background-image":j.BgUrl,"border-color":j.Bar.Bd.Hover})},function(){if(Isup==0)$(this).css({background:j.Bar.Bg.Out,"background-image":j.BgUrl,"border-color":j.Bar.Bd.Out})})
jscrollu.hover(function(){if(Isup==0)$(this).css({background:j.Btn.uBg.Hover,"background-image":j.BgUrl})},function(){if(Isup==0)$(this).css({background:j.Btn.uBg.Out,"background-image":j.BgUrl})})
jscrolld.hover(function(){if(Isup==0)$(this).css({background:j.Btn.dBg.Hover,"background-image":j.BgUrl})},function(){if(Isup==0)$(this).css({background:j.Btn.dBg.Out,"background-image":j.BgUrl})})
var sch = jscrollc.height();
//var sh = Math.pow(dh,2) / sch ;//Math.pow(x,y)x的y次方
var sh = (dh-2*bw)*dh / sch
if(sh<10){sh=10}
var wh = sh/6//滚动时候跳动幅度
// sh = parseInt(sh);
var curT = 0,allowS=false;
jscrollh.height(sh);
if(sch<=dh){jscrollc.css({padding:0});jscrolle.css({display:"none"})}else{allowS=true;}
if(j.Bar.Pos!="up"){
curT=dh-sh-bw;
setT();
}
jscrollh.bind("mousedown",function(e){
j['Fn'] && j['Fn'].call(_self);
Isup=1;
jscrollh.css({background:j.Bar.Bg.Focus,"background-image":j.BgUrl})
var pageY = e.pageY ,t = parseInt($(this).css("top"));
$(document).mousemove(function(e2){
curT =t+ e2.pageY - pageY;//pageY浏览器可视区域鼠标位置,screenY屏幕可视区域鼠标位置
setT();
});
$(document).mouseup(function(){
Isup=0;
jscrollh.css({background:j.Bar.Bg.Out,"background-image":j.BgUrl,"border-color":j.Bar.Bd.Out})
$(document).unbind();
});
return false;
});
jscrollu.bind("mousedown",function(e){
j['Fn'] && j['Fn'].call(_self);
Isup=1;
jscrollu.css({background:j.Btn.uBg.Focus,"background-image":j.BgUrl})
_self.timeSetT("u");
$(document).mouseup(function(){
Isup=0;
jscrollu.css({background:j.Btn.uBg.Out,"background-image":j.BgUrl})
$(document).unbind();
clearTimeout(Stime);
Sp=0;
});
return false;
});
jscrolld.bind("mousedown",function(e){
j['Fn'] && j['Fn'].call(_self);
Isup=1;
jscrolld.css({background:j.Btn.dBg.Focus,"background-image":j.BgUrl})
_self.timeSetT("d");
$(document).mouseup(function(){
Isup=0;
jscrolld.css({background:j.Btn.dBg.Out,"background-image":j.BgUrl})
$(document).unbind();
clearTimeout(Stime);
Sp=0;
});
return false;
});
_self.timeSetT = function(d){
var self=this;
if(d=="u"){curT-=wh;}else{curT+=wh;}
setT();
Sp+=2;
var t =500 - Sp*50;
if(t<=0){t=0};
Stime = setTimeout(function(){self.timeSetT(d);},t);
}
jscrolle.bind("mousedown",function(e){
j['Fn'] && j['Fn'].call(_self);
curT = curT + e.pageY - jscrollh.offset().top - sh/2;
asetT();
return false;
});
function asetT(){
if(curT<bw){curT=bw;}
if(curT>dh-sh-bw){curT=dh-sh-bw;}
jscrollh.stop().animate({top:curT},100);
var scT = -((curT-bw)*sch/(dh-2*bw));
jscrollc.stop().animate({top:scT},1000);
};
function setT(){
if(curT<bw){curT=bw;}
if(curT>dh-sh-bw){curT=dh-sh-bw;}
jscrollh.css({top:curT});
var scT = -((curT-bw)*sch/(dh-2*bw));
jscrollc.css({top:scT});
};
$(_self).mousewheel(function(){
if(allowS!=true) return;
j['Fn'] && j['Fn'].call(_self);
if(this.D>0){curT-=wh;}else{curT+=wh;};
setT();
})
});
}
});