png',title:'娑堟伅纭',content:content,onyes:onyes||true,onhide:onhide,onno:onno||true});},prompt:function(content,onyes,defaultValue){return new Dialog({id:'ds_dialog_prompt',fixed:true,left:'50%',top:'40%',icon:'confirm.png',title:'娑堟伅纭',content:'<p style="margin:0;padding:0 0 5px;">'+content+'</p><div><input type="text" style="color:#333;font-size:12px;padding:.42em .33em;width:18em;" /></div>',onopen:function(){var self=this,input=this._input;if(!input){input=this._input=this.contentShell.find('input');input.bind('keydown',function(e){if(e.keyCode===13&&self.focusButton){self.focusButton.trigger('click');return false;}});}input.val(defaultValue||'');},onfocus:function(){var input=this._input[0];setTimeout(function(){input.select();input.focus();},32);},onclose:function(){this._input=null;},onyes:function(){var input=this._input[0];return typeof onyes==='function'?onyes.call(this,input.value,input):void 0;},onno:true});},tips:function(content,timeout,follow,lock){if(typeof follow==='boolean'){lock=follow;follow=null;}return new Dialog({id:'ds_dialog_tips',fixed:true,esc:false,lock:!!lock,follow:follow,followOffset:[0,'bottom'],drag:false,content:content,padding:'12px 50px',showCloseButton:false,timeout:timeout||0});}});})(this,this.document,jQuery);
/**
* jquery.select.js
* create: 2012.11.12
* update: 2013.11.14
* admin@laoshu133.com
*/
;(function(global,$,undefined){var DOC=$(document),noop=function(){},picTmpl='<span class="pic"><img src="{src}" height="{height}" width="{width}" alt="{title}" /></span>',itemTmpl='<a href="javascript:;" id="{selectId}_{selectItemInx}">{picHTML}<span class="tit">{title}</span></a>',selectTmpl='<div class="select_label"><span>{label}</span><em class="select_arrow"><i></i></em></div><div class="select_data"><div class="select_data_inner">{itemHTML}</div></div>',_ops={index:0,className:'',imgWidth:40,imgHeight:40,disabled:false,items:[],ondropopen:noop,onchange:noop},_uuid=0,guid=function(){return++_uuid;},Select=global.Select=function(ops){this.init(ops);};Select.prototype={constructor:Select,init:function(ops){this.ops=ops=ops||{};$.each(_ops,function(k,val){typeof ops[k]==='undefined'&&(ops[k]=val);});var shell=DOC[0].createElement('div');shell.className='ds_select'+(ops.className?' '+ops.className:'');shell.id=this.id='ds_select_'+guid();this.shell=$(shell);this.selectedIndex=ops.index||0;this.shell.html(this.buildHTML(ops));this.label=this.shell.find('.select_label span').eq(0);this.setDisabled(!!ops.disabled);this.displayed=false;this.bindHandler();},buildHTML:function(ops){var tmp,html='',items=ops.items,i=0,len=items.length;for(;i<len;i++){tmp=items[i].imgSrc?picTmpl.replace('{src}',items[i].imgSrc).replace('{title}',items[i].text).replace('{width}',items[i].imgWidth||ops.imgWidth).replace('{height}',items[i].imgHeight||ops.imgHeight):'';html+=itemTmpl.replace('{selectId}',this.id).replace('{selectItemInx}',i).replace('{picHTML}',tmp).replace('{title}',items[i].text);}return selectTmpl.replace('{itemHTML}',html).replace('{label}',items[this.selectedIndex]?items[this.selectedIndex].text:'');},bindHandler:function(){var self=this,shell=this.shell;shell.delegate('.select_label','click',function(e){e.preventDefault();if(self.displayed){self.inactive();}else if(!self.disabled){self.active();}}).delegate('.select_data a','click',function(e){e.preventDefault();self.setChange(parseInt(this.id.replace(self.id+'_',''),10)||0);});},active:function(){var self=this;if(!this.disabled&&this.ops.ondropopen.call(this)!==false){setTimeout(function(){DOC.one('click.'+self.id+'_inactive',function(){self.inactive();});},0);this.shell.addClass('ds_select_active');this.displayed=true;}return this;},inactive:function(){this.displayed&&this.shell.removeClass('ds_select_active');this.displayed=false;return this;},setDisabled:function(disabled){if(this.disabled!==disabled){this.shell[!!disabled?'addClass':'removeClass']('ds_select_disabled');this.disabled=!!disabled;}return this;},setChange:function(inx){var items=this.ops.items;if(inx!==this.selectedIndex&&items[inx]&&this.ops.onchange.call(this,items[inx],items[inx].value,inx)!==false){this.selectedIndex=inx;this.label.html(items[inx].text);}return this;},appendTo:function(){this.shell.appendTo.apply(this.shell,arguments);return this;},destory:function(){this.shell.remove();this.shell=this.label=null;DOC.unbind('click.'+this.id+'_inactive');}};$.fn.renderSelect=function(){return this.each(function(i){if(this.nodeType===1&&this.nodeName.toUpperCase()==='SELECT'){var select,self=$(this),ops={},items=[];ops.items=items;ops.disabled=this.disabled;ops.index=this.selectedIndex;ops.imgWidth=this.getAttribute('data-imgwidth');ops.imgHeight=this.getAttribute('data-imgheight');$.each(this.options,function(i,item){items[i]={text:item.text,value:item.value,imgSrc:item.getAttribute('data-imgsrc'),imgWidth:item.getAttribute('data-imgwidth'),imgHeight:item.getAttribute('data-imgheight')};});ops.onchange=function(item,val,inx){self[0].selectedIndex=inx;self.trigger('change');};ops.ondropopen=function(){self.trigger('dropopen');};select=new Select(ops);var _setDisabled=select.setDisabled;select.setDisabled=function(){_setDisabled.apply(select,arguments);self[0].disabled=select.disabled;};if(self.data('ds_select')){self.data('ds_select').shell.remove();}self.data('ds_select',select);self.after(select.shell).
Back to home |
File page
Subscribe |
Register |
Login
| N