📄 poll.js
字号:
'white-space':'nowrap',
'vertical-align':'middle'
},
TITLE:{
'font-weight':'bold',
padding:'4px',
'border-bottom':'1px solid #CDCDCD'
},
ITEMS:{
'overflow-x': (linb.browser.ie || linb.browser.gek)?'hidden':'',
zoom:linb.browser.ie?1:null,
margin:'4px 4px 4px 5px'
},
OUTER:{
position:'relative',
zoom:linb.browser.ie?1:null,
'padding-left':'15px',
'border-bottom':'1px dashed #CDCDCD'
},
TOGGLE:{
position:'absolute',
left:0,
top:'4px'
},
BODY:{
display:'none',
'padding-left':'27px'
},
ITEM:{
display:'block',
position:'relative',
zoom:linb.browser.ie?1:null,
padding:'4px 2px 4px 2px'
},
'ITEM-checked':{},
OPTION:{
position:'absolute',
left:'2px',
top:'4px'
},
CAPTION:{
'float':'left',
zoom:linb.browser.ie?1:null,
'margin-left':'24px',
//{*1*}for: ie6 double margin bug
display:linb.browser.ie6?'inline':null
},
'EDIT, EDITS':{
$order:2,
'float':'none',
'background-color':'#EBEADB',
cursor:'pointer',
//{*1*}for: ie6 double margin bug
display:linb.browser.ie6?'block':null
},
CHART:{
'float':'right'
},
CLEAR:{
clear:'both',
'text-align':'right'
},
'BAR, BARI':{
width:'150px',
height:'12px',
border:0,
'line-height':0,
'font-size':0
},
BAR:{
'margin-left':'2px',
background: linb.UI.$bg('cmds.gif', ' no-repeat -130px -190px', true)
},
BARI:{
background: linb.UI.$bg('cmds.gif', ' no-repeat -150px -225px ', true)
},
'MARK, MARK2, MARK3' : {
cursor:'pointer',
width:'16px',
height:'16px',
'vertical-align':'middle',
'margin-right':'6px'
},
MARK:{
background: linb.UI.$bg('cmds.gif', ' no-repeat -144px top', true)
},
'ITEM-mouseover MARK':{
$order:1,
'background-position':' -144px -17px'
},
'ITEM-mousedown MARK':{
$order:2,
'background-position':' -144px -34px'
},
'ITEM-checked MARK':{
$order:3,
'background-position':' -128px top'
},
'ITEM-checked-mouseover MARK':{
$order:4,
'background-position':' -128px -17px'
},
'ITEM-checked-mousedown MARK':{
$order:5,
'background-position':' -128px -34px'
},
MARK2:{
background: linb.UI.$bg('cmds.gif', ' no-repeat -112px top', true)
},
'ITEM-mouseover MARK2':{
$order:1,
'background-position':' -112px -17px'
},
'ITEM-mousedown MARK2':{
$order:2,
'background-position':' -112px -34px'
},
'ITEM-checked MARK2':{
$order:3,
'background-position':' -96px top'
},
'ITEM-checked-mouseover MARK2':{
$order:4,
'background-position':' -96px -17px'
},
'ITEM-checked-mousedown MARK2':{
$order:5,
'background-position':' -96px -34px'
},
MARK3:{
$order:11,
background: linb.UI.$bg('cmds.gif', ' no-repeat -56px -222px', true)
},
'ITEM-mouseover MARK3':{
$order:11,
'background-position':' -56px -222px'
},
'ITEM-mousedown MARK3':{
$order:11,
'background-position':' -56px -222px'
},
DEL:{
margin:'0 0 0 4px'
}
},
DataModel:{
$checkbox:1,
title:{
action:function(v){
this.getSubNode('TITLE').html(v);
}
},
selMode:{
ini:'single',
listbox:['single','multi'],
action:function(){
this.boxing().refresh();
}
},
cmds:{
ini:null
},
noTitle:{
ini:false,
action:function(v){
this.getSubNode('TITLE').css('display',v?'none':'');
}
},
toggle:{
ini:false,
action:function(v){
this.getSubNode('TOGGLE',true).css('display',v?'':'none');
}
},
removeText:{
ini:'remove',
action:function(v){
this.getSubNode('DEL',true).text(v);
}
},
editable:{
ini:false,
action:function(v){
var self=this,t,cls;
self.getSubNode('DEL',true).css('display',v?'':'none');
t=self.getSubNode('CAPTION',true).merge(self.getSubNode('TITLE'));
cls=self.getClass('EDIT');
if(v)
t.addClass(cls);
else
t.removeClass(cls);
}
},
newOption:{
ini:'',
action:function(v){
var self=this,
id='$custom',
sid='_special',
t,
cs=self._cs;
if(!v){
if(cs)
cs.remove();
}else{
if(!cs){
t={
id:id,
caption:v
};
t[linb.UI.$tag_subId]=sid;
cs=self.buildItems('items',self.box._prepareItems(self,[t]));
self.getSubNode('ITEMS').addNext(self._cs=_.str.toDom(cs));
}else
self.getSubNodeByItemId('CAPTION',sid).html(v);
}
}
},
editorType:'none'
},
EventHandlers:{
beforeTitleChanged:function(profile, value){},
beforeOptionAdded:function(profile, value){},
beforeOptionRemoved:function(profile, item){},
beforeOptionChanged:function(profile, item, value){},
onCustomEdit:function(profile, node, flag, value, item, callback){},
onClickButton:function(profile, key, src){},
onGetContent:function(profile,item,callback){}
},
RenderTrigger:function(){
var self=this,t=self.properties.newOption;
if(t)
self.boxing().setNewOption(t,true);
},
_dynamicTemplate:function(profile){
var properties = profile.properties,
hash = profile._exhash = "$" + 'selMode:'+properties.selMode+';',
template = profile.box.getTemplate(hash);
properties.$UIvalue = properties.value;
// set template dynamic
if(!template){
template = _.clone(profile.box.getTemplate());
if(properties.selMode=='multi'){
template.$dynamic.items.OUTER.ITEM.OPTION.MARK2={$order:1,className:'{_optclass}'};
delete template.$dynamic.items.OUTER.ITEM.OPTION.MARK;
}
// set template
profile.box.setTemplate(template, hash);
}
profile.template = template;
},
_prepareData:function(profile){
var data=arguments.callee.upper.call(this, profile),
p=profile.properties
if(p.editable)
data._cls = profile.getClass('EDIT');
data.titleDisplay=p.noTitle?'display:none':'';
var cmds = p.cmds, o;
if(cmds && cmds.length){
var sid=linb.UI.$tag_subId,a;
a=data.cmds=[];
for(var i=0,t=cmds,l=t.length;i<l;i++){
o=linb.UI.adjustData(profile,t[i]);
o.tagName = o.tagName||'button';
a.push(o);
o._tabindex=p.tabindex;
o[sid]=o.id;
}
}
return data;
},
_prepareItem:function(profile, item){
var p = profile.properties, f=profile.CF;
item._tabindex = p.tabindex;
if(typeof f.formatCaption == 'function')
item.caption = f.formatCaption(item.caption);
item._body= item._body || 'Loading...'
if(item.id!='$custom'){
item._togdisplay=((p.toggle && item.toggle!==false) || item.toggle)?'':'display:none;';
item._display='';
item.percent = parseFloat(item.percent)||0;
if(item.percent<0)item.percent=0;
if(item.percent>1)item.percent=1;
item._per = 150*(1-item.percent);
}else{
item._optclass=profile.getClass('MARK3');
item._togdisplay=item._display='display:none;';
item._per = 0;
item._itemcls=profile.getClass('EDITS');
}
item.removeText=p.removeText;
item._del='display:none;';
if((('editable' in item) && item.editable)||p.editable){
item._itemcls=profile.getClass('EDIT');
item._del = '';
}
},
_buildBody:function(profile,item){
return item.text?'<pre>'+item.text.replace(/</g,"<")+'</pre>':'';
}
}
});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -