/** * Copyright 2006-2008 Mipang.com. * All Rights Reserved. * * Author: RuanChunping * Email: ruanchunping@gmail.com * Blog: http://nukq.malmam.com **/ /** * Meta_Blog Class */ function Meta_Blog(initparams){ this.initialized=false; this.EXT = {}; this.instance = this; this.callback=null; this.init(initparams); } Meta_Blog.prototype.init=function(params) { this.initialized = true; var EXT = this.EXT; EXT.blog_id = params.id; EXT.Tip = new Tip(); EXT.Dialog = new Dialog(); }; Meta_Blog.prototype.Remove=function() { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var cb = function(n){ if(n!=0) return true; _this.do_remove(); return true; }; EXT.Dialog.Show(cb ,'<b>删除确认</b>' ,'<p style="padding:10px 50px 0 50px;">你确定要删除这篇文章吗?</p>' ,['<button>&nbsp;确&nbsp;定&nbsp;</button>','<button>&nbsp;取&nbsp;消&nbsp;</button>'] ); }; Meta_Blog.prototype.do_remove=function() { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在删除文章<b>...</b>'); var params = { id:EXT.blog_id }; var AJ = {EXT:EXT}; AJ.Blog_Remove_onLoad = function(success,rsXML,rsText,params,CBParams) { this.EXT.Tip.Hide(); /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ top.location.reload(); }; MyAPI.callMethod('Blog.Remove',params,AJ,null); }; Meta_Blog.prototype.UnRemove=function() { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在恢复文章<b>...</b>'); var params = { id:EXT.blog_id, reltype:'Personal', relid:0 }; var AJ = {EXT:EXT}; AJ.Blog_SetReltype_onLoad = function(success,rsXML,rsText,params,CBParams) { this.EXT.Tip.Hide(); /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ top.location.reload(); }; MyAPI.callMethod('Blog.SetReltype',params,AJ,null); }; Meta_Blog.prototype.ChangeReltype=function() { if(!this.initialized) return; var _this = this; var EXT = this.EXT; var Dialog = EXT.Dialog; EXT.change_reltype_uid = this.handle_str+(new Date()).getTime(); EXT.change_reltype_load = 2; /** show dialog box */ var cb=function(n){ if(n<2){ return _this.SetReltype(n); } return true; }; var h=['']; h.push('<table cols="2"><tbody>'); h.push('<tr><td colspan="2" style="text-align:center;vertical-align:middle;"><span id="'+EXT.change_reltype_uid+'_loading" style="display:inline;"><img src="/images/spinner.gif" style="border:0;" alt="" />正在加载数据...</span></td></tr>'); h.push('<tr><td style="vertical-align:top;">'); h.push('<table cellpadding="0" cellspacing="0" border="0" cols="2"><tbody>'); h.push('<tr><td colspan="2" style="padding:0 10px;">本文关于以下地方（请输入地名）<div id="'+EXT.change_reltype_uid+'_error" style="display:none;width:220px;border:2px solid #ff5028;padding:2px;"></div></td></tr>'); h.push('<tr><td style="padding:0 10px 10px 10px;vertical-align:middle;border-bottom:1px solid #444;"><input type="text" id="'+EXT.change_reltype_uid+'_place_name" value="" class="fieldinput text" style="width:120px;margin:3px 0;" disabled /><input type="hidden" id="'+EXT.change_reltype_uid+'_place_id" value="0"/></td><td style="padding:0 20px 10px 10px;vertical-align:middle;border-bottom:1px solid #444;"><span onclick="javascript:window.'+Dialog.handle_str+'._CloseDialog.call(window.'+Dialog.handle_str+',0);return false;"><button id="'+EXT.change_reltype_uid+'_btn_ok_1" disabled><span style="font:bold 14px Arial;">&nbsp;修&nbsp;改&nbsp;</span></button></span></td></tr>'); h.push('<tr><td style="padding:10px;vertical-align:middle;border-bottom:1px solid #444;">本文跟地方无关</td><td style="padding:10px 20px 10px 10px;vertical-align:middle;border-bottom:1px solid #444;"><span onclick="javascript:window.'+Dialog.handle_str+'._CloseDialog.call(window.'+Dialog.handle_str+',1);return false;"><button id="'+EXT.change_reltype_uid+'_btn_ok_2" disabled><span style="font:bold 14px Arial;">&nbsp;修&nbsp;改&nbsp;</span></button></span></td></tr>'); h.push('<tr><td style="padding:10px;vertical-align:middle;">我不想修改</td><td style="padding:10px;vertical-align:middle;"><span onclick="javascript:window.'+Dialog.handle_str+'._CloseDialog.call(window.'+Dialog.handle_str+',2);return false;"><button><span style="font:normal 14px Arial;">&nbsp;返&nbsp;回&nbsp;</span></button></span></td></tr>'); h.push('</tbody></table>'); h.push('</td><td style="vertical-align:top;padding-left:20px;width:200px;"><span style="font:bold 14px Arial;color:#393;">什么是跟地方相关?</span><p>米胖收录了世界各地，也许你的文章讲述的正是某一地方的风土人情，这对他人有很好的参考价值。跟某地相关的文章将同时出现在米胖上该地方页面。</p><p>而跟地方无关的文章只出现在你的米胖Blog页面。</p></td></tr></tbody></table>'); Dialog.Show(cb, '<b>设置文章与地方相关</b>', h.join(''), []); /** load data... */ this.__load_myplaces(); this.__load_info(); }; Meta_Blog.prototype.__load_myplaces=function() { if(!this.initialized) return; var __this = this; var EXT = this.EXT; var params={}; var AJ = {EXT:EXT,_this:this}; AJ.People_Place_GetAll_onLoad=function(success,rsXML,rsText,params,CBParams) { /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ var ps=[]; var doc = rsXML.documentElement; var _ps = doc.getElementsByTagName('item'); if(_ps && _ps.length){ for(var i=0;i<_ps.length;i++){ var p = _ps[i]; ps.push([p.getAttribute('id'),p.getAttribute('name')]); } } window[this._this.handle_str+'sPs'] = new MP_SmartPlaceInput({ textfield:this.EXT.change_reltype_uid+'_place_name', places:ps, onselect:function(id,name,pname){try{_ge(__this.EXT.change_reltype_uid+'_place_id').value=id;_ge(__this.EXT.change_reltype_uid+'_place_name').value=name;if(id!=0){ShowElement(_ge(__this.EXT.change_reltype_uid+'_error'),false);}}catch(e){}} }); /** enable user input */ try{ if(--this.EXT.change_reltype_load<=0){ _ge(this.EXT.change_reltype_uid+'_btn_ok_1').disabled=false; _ge(this.EXT.change_reltype_uid+'_btn_ok_2').disabled=false; _ge(this.EXT.change_reltype_uid+'_place_name').disabled=false; _ge(this.EXT.change_reltype_uid+'_loading').style.display='none'; } }catch(e){} }; MyAPI.callMethod('People.Place.GetAll',params,AJ,null); }; Meta_Blog.prototype.__load_info=function() { if(!this.initialized) return; var EXT = this.EXT; var params = { id:EXT.blog_id }; var AJ={EXT:EXT}; AJ.Blog_Get_onLoad=function(success,rsXML,rsText,params,CBParams) { /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ var doc = rsXML.documentElement; var b = doc.getElementsByTagName('blog'); if(b && b.length){ b = b[0]; var rt = b.getAttribute('reltype'); var rid = b.getAttribute('relid'); var place_name = b.getAttribute('place_name'); if(rt=='Place'){ _ge(this.EXT.change_reltype_uid+'_place_id').value=rid; _ge(this.EXT.change_reltype_uid+'_place_name').value=place_name; AddClass(_ge(this.EXT.change_reltype_uid+'_place_name'),'valid'); } } /** enable user input */ try{ if(--this.EXT.change_reltype_load<=0){ _ge(this.EXT.change_reltype_uid+'_btn_ok_1').disabled=false; _ge(this.EXT.change_reltype_uid+'_btn_ok_2').disabled=false; _ge(this.EXT.change_reltype_uid+'_place_name').disabled=false; _ge(this.EXT.change_reltype_uid+'_loading').style.display='none'; } }catch(e){} }; MyAPI.callMethod('Blog.Get',params,AJ,null); }; Meta_Blog.prototype.SetReltype=function(n) { if(!this.initialized) return; var EXT = this.EXT; var params=null; if(n!=0 && n!=1){ return false; } if(n==0){ /** place */ var place_id = _ge(EXT.change_reltype_uid+'_place_id').value; if(place_id==0){ var err = _ge(EXT.change_reltype_uid+'_error'); err.innerHTML = '请输入一个有效的地方，并确认输入框中出现<img src="/images/check-small.gif" style="border:0;" />标志。关于怎样输入地方，请查看这里的<a href="/help/faq.ue#psi" target="_blank">帮助</a>。'; ShowElement(err,true); return false; }else{ params = { id:EXT.blog_id, reltype:'Place', relid:place_id }; } } if(n==1){ /** personal */ params = { id:EXT.blog_id, reltype:'Personal', relid:0 }; } var AJ={EXT:EXT}; AJ.Blog_SetReltype_onLoad=function(success,rsXML,rsText,params,CBParams) { /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ /** ok, Hide Dialog and Reload the page */ this.EXT.Dialog.Hide(); top.location.reload(); }; MyAPI.callMethod('Blog.SetReltype',params,AJ,null); return false; }; /************************************************************************************/ /** * Meta_Tag Class */ function Meta_Tag(initparams){ this.initialized=false; this.EXT = {}; this.instance = this; this.callback=null; this.init(initparams); } Meta_Tag.prototype.init=function(params) { this.initialized=true; ExportHandle(this,'__Meta_Tag__'); var EXT = this.EXT; EXT.reltype = params.reltype; EXT.relid = params.relid; EXT.list_id = params.list_id; EXT.url_prefix = params.url_prefix || ('/search?t='+EXT.reltype+'&amp;q='); EXT.list_el = _ge(EXT.list_id); EXT.add_el = null; EXT.Tag = new Tag(); EXT.Tip = new Tip(); EXT.Dialog = new Dialog(); this.EV_init(); }; Meta_Tag.prototype.EV_init=function() { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var lis = EXT.list_el.getElementsByTagName('li'); if(lis){ for(var i=0;i<lis.length;i++){ var li = lis[i]; if(li.getAttribute('mp:name')){ li.id = _this.handle_str+'list_id'+i; li.onmouseover = function(e){ _this.ShowDetail(e); }; } } } var as = EXT.list_el.getElementsByTagName('a'); if(as){ for(var i=0;i<as.length;i++){ var a = as[i]; if(a.getAttribute('mp:add-button') == '1'){ EXT.add_el = a; a.onclick=function(e){ _this.ShowAddBox(); return false; }; } } } }; Meta_Tag.prototype.ShowDetail=function(e) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var e = e || window.event; var el = EV_GetEventTarget(e); var loop = 3; var got =0 ; while(el && loop--){ if(el.getAttribute('mp:name')){ got =1; break; } el = el.parentNode; } if(!got) return; if(el.getAttribute('mp:can-remove') != '1') return; var h=['']; /**h.push('<div style="border:1px solid #36c;background:#fff;padding:5px;"></div>');*/ h.push('<div style="background:#000;color:#fff;font-size:12px;padding:2px 10px 3px 5px;"><b>&times;</b> <a href="javascript:void(0);" onclick="javascript:window.'+this.handle_str+'.Remove(\''+StrSafeInline(el.getAttribute('mp:name'))+'\');return false;" style="color:#fff;background:#000;text-decoration:underline;">删除标签</a></div>'); PopShow(el,h.join('')); }; Meta_Tag.prototype.Remove=function(tag) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var cb = function(n){ if(n!=0) return true; _this.do_remove(tag); return true; }; EXT.Dialog.Show( cb ,'<b>删除确认</b>' ,'<p style="text-align:center;margin:0;padding:10px 50px 0 50px;">删除文章标签&quot;'+HtmlEscape(tag)+'&quot;<br/>你确定要删除吗?</p>' ,['<button>&nbsp;确&nbsp;定&nbsp;</button>','<button>&nbsp;取&nbsp;消&nbsp;</button>'] ); }; Meta_Tag.prototype.do_remove=function(tag) { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在删除标签<b>...</b>'); var params = { reltype:EXT.reltype, relid:EXT.relid, tag:tag }; EXT.Tag.Remove(params ,{afterFinish: function(a,b) { b.BC.EXT.Tip.Hide(); /** show current tags */ var doc = a.XML; var tags = []; try{ var tag = doc.getElementsByTagName('tags'); if(!tag || !tag.length) throw 'no <tags>'; tag = tag[0]; var items = tag.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; for(var i=0;i<items.length;i++){ var it = items[i]; var t = { name:getNodeValue(it) }; tags.push(t); } }catch(e){ } b.BC.DrawList(tags); b.BC.EV_init(); } ,CBParams:{BC:this} } ); }; Meta_Tag.prototype.ShowAddBox=function() { if(!this.initialized) return; var EXT = this.EXT; /** show add box */ var div = _ge(this.handle_str+'addbox'); if(!div){ div = document.createElement('div'); div.id=this.handle_str+'addbox'; div.setAttribute('style',''); div.style.width = '420px'; /** div.style.font = 'normal 12px Arial;';*/ ShowElement(div,false); EXT.list_el.parentNode.appendChild(div); EXT.addbox_el = div; } var h=['']; h.push('<div style="padding:5px 0;">'); h.push('<input type="text" id="'+this.handle_str+'input_newtags" style="height:16px;padding:0;width:300px;font:normal 12px Arial;" /> <input type="button" value="添加" style="height:20px;font:normal 12px Arial;" onclick="javascript:window.'+this.handle_str+'.Add(0);return false;" />' +' <input type="button" value="取消" style="height:20px;font:normal 12px Arial;" onclick="javascript:window.'+this.handle_str+'.HideAddBox();return false;" />'); h.push('<div style="font:normal 12px Arial;">用空格分隔多个标签 (例: 杭州 &nbsp;西湖划船 &nbsp;"happy day") 或<a href="javascript:void(0);" onclick="javascript:window.'+this.handle_str+'.load_recent();return false;">选用常用标签</a></div>'); h.push('<div style="display:none;" id="'+this.handle_str+'addbox_recent"></div>'); h.push('</div>'); div.innerHTML = ''; div.innerHTML = h.join(''); ShowElement(div,true); ShowElement(EXT.add_el,false); }; Meta_Tag.prototype.HideAddBox=function() { if(!this.initialized) return; var EXT = this.EXT; ShowElement(EXT.add_el,true); ShowElement(EXT.addbox_el,false); }; Meta_Tag.prototype.load_recent=function() { if(!this.initialized) return; var EXT = this.EXT; var recentbox = _ge(this.handle_str+'addbox_recent'); recentbox.innerHTML = '<p><em>正在获取标签<b>...</b></em></p>'; ShowElement(recentbox,true); var params = { relid:EXT.relid }; var AJ={EXT:EXT,mt:this,box:recentbox}; AJ[EXT.reltype+'_Tag_GetRecent_onLoad']=function(success,rsXML,rsText,params,CBParams) { /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ var doc = rsXML.documentElement; try{ var tag = doc.getElementsByTagName('tags'); if(!tag) throw 'no <tag>'; tag = tag[0]; var items = tag.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; var tags=[]; for(var i=0;i<items.length;i++){ var it = items[i]; var t = { name:getNodeValue(it) }; tags.push(t); } /** show recent tags */ var h=['']; for(var i=0;i<tags.length;i++){ var t=tags[i]; h.push('<label style="white-space:nowrap;" for="'+this.mt.handle_str+'recent_tags_id'+i+'"><input type="checkbox" name="'+this.mt.handle_str+'recent_tags_item" id="'+this.mt.handle_str+'recent_tags_id'+i+'" value="'+HtmlEscape(t.name)+'" />'+HtmlEscape(t.name)+'</label> '); } h.push('&nbsp; <input type="button" value="&nbsp;添&nbsp;加&nbsp;" style="height:20px;font:normal 12px Arial;" onclick="javascript:window.'+this.mt.handle_str+'.Add(1);return false;" />'); this.box.innerHTML = ''; this.box.innerHTML = h.join(''); }catch(e){ ShowElement(this.box,false); return; } }; MyAPI.callMethod(EXT.reltype+'.Tag.GetRecent',params,AJ,null); }; Meta_Tag.prototype.Add=function(f) { if(!this.initialized) return; var EXT = this.EXT; if(f==0){ /** user enter new tags */ var tags = _ge(this.handle_str+'input_newtags').value; if(!tags || Trim(tags)==''){ return; } /**split the tags(Str) => array()*/ var ts = new Array(); var t = tags.replace(/[\r|\n|\t]/g," "); t=t.replace(/(\s|^|[,，、　])\"([^\"]+)\"([,，、　]|\s|$)/g, function(a0,a1,a2,a3){ ts.push(Trim(a2)); return " "; } ); /** t=t.replace(/[\",\u8221\u65282\u65292\u12288]/g," "); t=t.replace(/[\",，“”＂　]/g," "); */ t=t.replace(/[,，、　]/g," "); t=Trim(t.replace(/\s+/g," ")); var ts_ = t.split(" "); for(var i=0;i<ts_.length;i++){ var _t=Trim(ts_[i]); if(_t && _t.length) ts.push(_t); } /** add them.*/ this.do_add(ts); }else if(f==1){ /** choose from recent tags */ var rbox = _ge(this.handle_str+'addbox_recent'); var cs = rbox.getElementsByTagName('input'); if(!cs || !cs.length) return; var ts2=[]; for(var i=0;i<cs.length;i++){ var c = cs[i]; if(c.getAttribute('name') == this.handle_str+'recent_tags_item' && c.checked){ ts2.push(c.value); } } /** add them */ this.do_add(ts2); } }; Meta_Tag.prototype.do_add=function(tags) { if(!this.initialized) return; var EXT = this.EXT; if(!tags || !tags.length) return; var params = { reltype:EXT.reltype, relid:EXT.relid, tags:tags }; EXT.Tip.Show('正在添加标签<b>...</b>'); EXT.Tag.AddMulti(params ,{afterFinish: function(a,b) { b.BC.EXT.Tip.Hide(); /** show current tags */ var doc = a.XML; var tags = []; try{ var tag = doc.getElementsByTagName('tags'); if(!tag || !tag.length) throw 'no <tags>'; tag = tag[0]; var items = tag.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; for(var i=0;i<items.length;i++){ var it = items[i]; var t = { name:getNodeValue(it) }; tags.push(t); } }catch(e){ } b.BC.DrawList(tags); b.BC.EV_init(); } ,CBParams:{BC:this} } ); }; Meta_Tag.prototype.DrawList=function(tags) { if(!this.initialized) return; var EXT = this.EXT; var last = EXT.add_el.parentNode; /** clear curren list */ while(last.previousSibling){ last.parentNode.removeChild(last.previousSibling); } for(var i=0;i<tags.length;i++){ var t = tags[i]; var li = document.createElement('li'); li.innerHTML = '<a href="' + EXT.url_prefix + UrlEncode(t.name)+'">'+HtmlEscape(t.name)+'</a>'; li.className = 'item'; li.setAttribute('mp:name',t.name); li.setAttribute('mp:can-remove',1); last.parentNode.insertBefore(li,last); } }; /****************************************************************************/ /** Meta_Label Class */ function Meta_Label(initparams){ this.initialized=false; this.EXT = {}; this.instance = this; this.callback=null; this.init(initparams); } Meta_Label.prototype.init=function(params) { this.initialized=true; ExportHandle(this,'__Meta_Label__'); var EXT = this.EXT; EXT.reltype = params.reltype; EXT.relid = params.relid; EXT.url_prefix = params.url_prefix; EXT.list_id = params.list_id; EXT.list_el = _ge(EXT.list_id); EXT.add_el = null; EXT.lid_current = new Set(); /** label cache handle */ EXT._lh = '__Meta_Label_MyLabels__'; EXT.Label = new Label(); EXT.Tip = new Tip(); EXT.Dialog = new Dialog(); this.EV_init(); }; Meta_Label.prototype.EV_init=function() { if(!this.initialized) return; var EXT = this.EXT; var _this = this; EXT.lid_current =null; EXT.lid_current = new Set(); var lis = EXT.list_el.getElementsByTagName('li'); if(lis){ for(var i=0;i<lis.length;i++){ var li = lis[i]; if(li.getAttribute('mp:name')){ li.id = _this.handle_str+'list_id'+i; li.onmouseover = function(e){ _this.ShowDetail(e); }; EXT.lid_current.add(li.getAttribute('mp:id')); } } } var as = EXT.list_el.getElementsByTagName('a'); if(as){ for(var i=0;i<as.length;i++){ var a = as[i]; if(a.getAttribute('mp:add-button') == '1'){ EXT.add_el = a; a.onclick=function(e){ _this.ShowAddBox(); return false; }; } } } }; Meta_Label.prototype.ShowDetail=function(e) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var e = e || window.event; var el = EV_GetEventTarget(e); var loop = 3; var got =0 ; while(el && loop--){ if(el.getAttribute('mp:name')){ got =1; break; } el = el.parentNode; } if(!got) return; if(el.getAttribute('mp:can-remove') != '1') return; var h=['']; h.push('<div style="background:#000;color:#fff;font-size:12px;padding:2px 10px 3px 5px;"><b>&times;</b> <a href="javascript:void(0);" onclick="javascript:window.'+this.handle_str+'.Remove('+StrSafeInline(el.getAttribute('mp:id'))+',\''+StrSafeInline(el.getAttribute('mp:name'))+'\');return false;" style="color:#fff;background:#000;text-decoration:underline;">删除分类</a></div>'); PopShow(el,h.join('')); }; Meta_Label.prototype.Remove=function(lid,name) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var cb = function(n){ if(n!=0) return true; _this.do_remove(lid); return true; }; EXT.Dialog.Show( cb ,'<b>删除确认</b>' ,'<p style="text-align:center;margin:0;padding:10px 50px 0 50px;">删除文章分类&quot;'+HtmlEscape(name)+'&quot;<br/>你确定要删除吗?</p>' ,['<button>&nbsp;确&nbsp;定&nbsp;</button>','<button>&nbsp;取&nbsp;消&nbsp;</button>'] ); }; Meta_Label.prototype.do_remove=function(lid) { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在删除分类<b>...</b>'); var params = { reltype:EXT.reltype, relid:EXT.relid, id:lid }; EXT.Label.Remove(params ,{afterFinish: function(a,b) { b.BC.EXT.Tip.Hide(); /** show current tags */ var doc = a.XML; var labels = []; try{ var label = doc.getElementsByTagName('labels'); if(!label || !label.length) throw 'no <labels>'; label = label[0]; var items = label.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; for(var i=0;i<items.length;i++){ var it = items[i]; var l = { id:it.getAttribute('id'), permission:it.getAttribute('permission'), name:getNodeValue(it) }; labels.push(l); } }catch(e){ } b.BC.DrawList(labels); b.BC.EV_init(); b.BC._draw_label_list(1/**redraw*/); } ,CBParams:{BC:this} } ); }; Meta_Label.prototype.ShowAddBox=function() { if(!this.initialized) return; var EXT = this.EXT; /** show add box */ var div = _ge(this.handle_str+'addbox'); if(!div){ div = document.createElement('div'); div.id=this.handle_str+'addbox'; div.setAttribute('style',''); div.style.width = '420px'; /** div.style.font = 'normal 12px Arial;';*/ ShowElement(div,false); EXT.list_el.parentNode.appendChild(div); EXT.addbox_el = div; } var h=['']; h.push('<div style="padding:5px 0;">'); h.push('<span id="'+this.handle_str+'labels_loading">'+(this._get_mylabels()?this._draw_label_list(0):'<em>正在加载分类...</em>')+'</span>'); h.push(' &nbsp; <input type="button" value="取消" style="height:20px;font:normal 12px Arial;" onclick="javascript:window.'+this.handle_str+'.HideAddBox();return false;" />'); h.push('</div>'); div.innerHTML = ''; div.innerHTML = h.join(''); ShowElement(div,true); ShowElement(EXT.add_el,false); if(!this._get_mylabels()){ this._load_mylabels(1/** and draw*/); } }; Meta_Label.prototype.HideAddBox=function() { if(!this.initialized) return; var EXT = this.EXT; ShowElement(EXT.add_el,true); ShowElement(EXT.addbox_el,false); }; Meta_Label.prototype._get_mylabels=function() { if(!this.initialized) return; var EXT = this.EXT; if(window[EXT._lh]){ return window[EXT._lh]; }else return null; }; Meta_Label.prototype._set_mylabels=function(ls) { if(!this.initialized) return; var EXT = this.EXT; window[EXT._lh] = ls; }; Meta_Label.prototype._load_mylabels=function(draw) { if(!this.initialized) return; var EXT = this.EXT; var params={ }; var AJ={mt:this}; AJ[EXT.reltype+'_Label_GetOwned_onLoad']=function(success,rsXML,rsText,params,CBParams) { /**alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ var doc = rsXML.documentElement; var labels = []; try{ var label = doc.getElementsByTagName('labels'); if(!label) throw 'no <labels>'; label=label[0]; var items = label.getElementsByTagName('item'); if(items && items.length){ for(var i=0;i<items.length;i++){ var it = items[i]; var l = { id:it.getAttribute('id'), permission:it.getAttribute('permission'), name:getNodeValue(it) }; labels.push(l); } }else{ /** no label */ } }catch(e){ alert(e); } /** update label cache */ this.mt._set_mylabels(labels); /** draw label list */ this.mt._draw_label_list(draw); }; MyAPI.callMethod(EXT.reltype+'.Label.GetOwned',params,AJ,null); }; Meta_Label.prototype._draw_label_list=function(draw) { if(!this.initialized) return; var EXT = this.EXT; var ls = this._get_mylabels(); var s_div = '<option value="" disabled style="color:#888;">-----------</option>'; var h=['']; h.push('<select id="'+this.handle_str+'labels_select" onchange="javascript:window.'+this.handle_str+'.SL_HandleAction(this);return false;" style="font-size:12px;height:16px;"><option value="">选择一个分类:</option>'+s_div); var n=0; for(var i=0;ls && i<ls.length;i++){ var l = ls[i]; if(EXT.lid_current.contains(l.id)) continue; h.push('<option value="'+l.id+'">'+HtmlEscape(l.name)+'</option>'); n++; } if(n) h.push(s_div); h.push('<option value="NEW" style="color:#090;font-weight:bold;">创建一个新分类&raquo;</option></select>'); if(!draw) return h.join(''); else{ try{ _ge(this.handle_str+'labels_loading').innerHTML = h.join(''); }catch(e){} } }; Meta_Label.prototype.SL_HandleAction=function(sl) { if(!this.initialized) return; var EXT = this.EXT; var v = sl.value; sl.selectedIndex=0; if(!v || v=='') return; if(v.match(/^\d+$/)){ /** Apply it */ this.Apply(v); }else if(v=='NEW'){ /** create a new label and apply it */ var newlabel = window.prompt('请输入新分类的名称:',''); if(!newlabel || Trim(newlabel) =='') return; this.CreateAndApply(newlabel); } }; Meta_Label.prototype.Apply=function(lid) { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在添加分类<b>...</b>'); var params = { reltype:EXT.reltype, relid:EXT.relid, id:lid }; EXT.Label.Apply(params ,{afterFinish: function(a,b) { b.BC.EXT.Tip.Hide(); /** show current labels */ var doc = a.XML; var labels = []; try{ var label = doc.getElementsByTagName('labels'); if(!label || !label.length) throw 'no <labels>'; label = label[0]; var items = label.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; for(var i=0;i<items.length;i++){ var it = items[i]; var l = { id:it.getAttribute('id'), permission:it.getAttribute('permission'), name:getNodeValue(it) }; labels.push(l); } }catch(e){ } b.BC.DrawList(labels); b.BC.EV_init(); b.BC._draw_label_list(1/**redraw*/); } ,CBParams:{BC:this} } ); }; Meta_Label.prototype.CreateAndApply=function(newlabel) { if(!this.initialized) return; var EXT = this.EXT; EXT.Tip.Show('正在添加分类<b>...</b>'); var params = { reltype:EXT.reltype, relid:EXT.relid, label:newlabel }; EXT.Label.CreateAndApply(params ,{afterFinish: function(a,b) { b.BC.EXT.Tip.Hide(); /** show current labels */ var doc = a.XML; var labels = []; try{ var label = doc.getElementsByTagName('labels'); if(!label || !label.length) throw 'no <labels>'; label = label[0]; var items = label.getElementsByTagName('item'); if(!items || !items.length) throw 'no <item>'; for(var i=0;i<items.length;i++){ var it = items[i]; var l = { id:it.getAttribute('id'), permission:it.getAttribute('permission'), name:getNodeValue(it) }; labels.push(l); if(it.getAttribute('new') == '1'){ /** add to label cache */ window[b.BC.EXT._lh].push(l); } } }catch(e){ } b.BC.DrawList(labels); b.BC.EV_init(); b.BC._draw_label_list(1/**redraw*/); } ,CBParams:{BC:this} } ); }; Meta_Label.prototype.DrawList=function(labels) { if(!this.initialized) return; var EXT = this.EXT; var last = EXT.add_el.parentNode; /** clear curren list */ while(last.previousSibling){ last.parentNode.removeChild(last.previousSibling); } for(var i=0;i<labels.length;i++){ var l = labels[i]; var li = document.createElement('li'); li.innerHTML = '<a href="' + EXT.url_prefix + l.id + '@LB/">'+HtmlEscape(l.name)+'</a>'; li.className = 'item'; li.setAttribute('mp:name',l.name); li.setAttribute('mp:id',l.id); li.setAttribute('mp:can-remove',1); last.parentNode.insertBefore(li,last); } }; /**********************************************************************/ /** * Meta_Comment */ function Meta_Comment(initparams){ this.initialized=false; this.EXT = {}; this.instance = this; this.callback=null; this.init(initparams); } Meta_Comment.prototype.init=function(params) { this.initialized = true; var EXT = this.EXT; EXT.reltype = params.reltype; EXT.relid = params.relid; ExportHandle(this,'__Meta_Comment_Class__'); EXT.Tip = new Tip(); EXT.Dialog = new Dialog(); EXT.Comment = new Comment(); EXT.Window = new Window(); }; Meta_Comment.prototype.Delete=function(cid) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; var cb = function(n){ if(n!=0) return true; _this.do_delete(cid); return true; }; EXT.Dialog.Show(cb ,'<b>删除确认</b>' ,'<p style="padding:10px 50px 0 50px;">评论删除后将不可恢复，你确定要删除吗?</p>' ,['<button>&nbsp;确&nbsp;定&nbsp;</button>','<button>&nbsp;取&nbsp;消&nbsp;</button>'] ); }; Meta_Comment.prototype.do_delete=function(cid) { if(!this.initialized) return; var EXT = this.EXT; var params = { relid:EXT.relid, id:cid }; EXT.Comment.Delete(EXT.reltype,params ,{afterFinish: function(a,b) { try{ var cbox = _ge('comment-'+b.cid); cbox.parentNode.removeChild(cbox); }catch(e){} } ,CBParams:{cid:cid} } ); }; Meta_Comment.prototype.Edit=function(id) { if(!this.initialized) return; var EXT = this.EXT; var _this=this; var params={ relid:EXT.relid, id:id }; EXT.Comment.Get(EXT.reltype,params,{afterFinish:function(a,b){_this._edit_core(a,b);},CBParams:{}}); }; Meta_Comment.prototype.EditCancel=function(id) { if(!this.initialized) return; try{ ShowElement(_ge('comment-body-edit-'+id),false); }catch(e){} }; /** * res/params: return from Comment Class */ Meta_Comment.prototype._edit_core=function(res,params) { if(!this.initialized) return; var EXT = this.EXT; var doc=res.XML.documentElement; var c = doc.getElementsByTagName('comment')[0]; var comment = {}; if(c){ comment['id'] = c.getAttribute('id'); comment['msg_type'] = c.getAttribute('msg_type'); comment['message'] = getFirstNodeValue(c,'message'); comment['message_html'] = getFirstNodeValue(c,'message_html'); }else{ return; } if(comment['msg_type'] != 'Textile'){ /** Now, only support Textile format */ alert('Comment format '+comment['msg_type']+' not supported yet!'); return; } var box = _ge('comment-body-edit-'+comment.id); if(!box){ box = document.createElement('div'); box.id = 'comment-body-edit-'+comment.id; box.setAttribute('style',''); ShowElement(box,false); _ge('comment-body-'+comment.id).parentNode.appendChild(box); } /** ok,show inplace edit box */ var prefix = (new Date()).getTime(); var h=['<div>']; h.push('<textarea class="fieldinput_ text_" style="width:99%;font:normal 13px Verdana,Arial;overflow:hidden;" rows="5" cols="30" onfocus="javascript:ResizeTextarea(this,5);/*this.select();*/this.onfocus=function(){ResizeTextarea(this,5);};" onclick="javascript:ResizeTextarea(this,5);" onkeyup="javascript:ResizeTextarea(this,5);" id="'+this.handle_str+prefix+'f_message" tabindex="1">'+HtmlEscape(comment['message'])+'</textarea>'); h.push('<div style="float:right;"><span class="lk" style="color:#888;" onclick="javascript:window.open(\'/help/textile.html\',\'_blank\',\'status=yes,scrollbars=yes,resizable=yes,width=680,height=480\');return false;" onmouseover="this.style.color=\'#36c\';" onmouseout="this.style.color=\'#888\'">如何插图、加链接?</span></div>'); h.push('<div style="text-align:left;padding:5px 0 0 0;"><span style="margin-right:1em;" onclick="javascript:window.'+this.handle_str+'._edit_do('+comment['id']+','+prefix+');return false;"><button><b>&nbsp;保&nbsp;存&nbsp;</b></button></span><span onclick="javascript:window.'+this.handle_str+'.EditCancel('+comment.id+');return false;"><button>&nbsp;取&nbsp;消&nbsp;</button></span></div>'); h.push('</div>'); box.innerHTML = '<div style="width:90%;border-width:0px;border-style:solid;padding:0px;background:#fff;"><div style="background:#fff;padding:0;"><div style="width:100%;"><div style="padding:2px 0 2px 0;font:bold 13px Arial;color:#333;">修改 &nbsp; <span style="font-size:12px;color:#36c;cursor:pointer;text-decoration:underline;" id="cmt_em_btn_'+prefix+'">插入表情</span></div>'+h.join('')+'<div style="height:1px;font:normal 1px/1px Arial;overflow:hidden;background:#fff;"><input style="border:0;font-size:1px;height:1px;width:1px;" id="'+this.handle_str+prefix+'f_focus_first" type="text" /></div></div></div></div>'; ShowElement(box,true); setTimeout('try{_ge(\''+this.handle_str+prefix+'f_focus_first\').focus();}catch(e1){}',30); setTimeout('try{_ge(\''+this.handle_str+prefix+'f_message\').focus();}catch(e){}',100); /** add emotions support **/ var em = new TextEmotion(_ge(this.handle_str+prefix+'f_message'),_ge('cmt_em_btn_'+prefix)); }; Meta_Comment.prototype._edit_do=function(id,prefix) { if(!this.initialized) return; var EXT = this.EXT; var idprefix = this.handle_str+prefix; try{ var params = { relid:EXT.relid, id:id, message:Trim(_ge(idprefix+'f_message').value) }; if(!params.message || !params.message.length){ alert('你还没有写评论内容!'); return; } }catch(e){ alert(e); return; } EXT.Comment.Edit(EXT.reltype,params ,{afterFinish: function(a,b) { try{ var doc = a.XML.documentElement; var msg = doc.getElementsByTagName('message_html')[0]; _ge('comment-body-'+b.cid).innerHTML = getNodeValue(msg); }catch(e){alert(e);} b.BC.EditCancel(b.cid); } ,CBParams:{BC:this,cid:id} } ); }; /** * params:{info:{relid,...},user:{_userInfo_},options:{box:inplace box,init_msg:'init msgs'}} */ Meta_Comment.prototype.Add=function(params) { if(!this.initialized) return; var EXT = this.EXT; var _this = this; if(params && params.options && params.options.newwindow){ this._add_core(params); return; } if(params && params.user){ if(params.user.accid==0) this._add_core(params); else /** use old style */ this._add_core2(params); return; } var Dialog = EXT.Dialog; var _params = { relid:EXT.relid, id:-1/** no comment return,just get user info only*/ }; var AJ={skip:0,Dialog:Dialog,BC:this}; AJ[EXT.reltype+'_Comment_Get_onLoad']=function(success,rsXML,rsText,params,CBParams) { if(this.skip) return; this.Dialog.Hide(); /*** alert(rsText);*/ if(success.code!=0){ alert('发生错误(#'+success.code+'):'+success.desc); return; } /**success.*/ var doc = rsXML.documentElement; var user = {accid:0}; var u = doc.getElementsByTagName('user')[0]; if(u){ user['accid'] = u.getAttribute('accid'); user['ck_nickname'] = u.getAttribute('ck_nickname'); user['ck_email'] = u.getAttribute('ck_email'); user['ck_homepage'] = u.getAttribute('ck_homepage'); user['ck_ui_save'] = u.getAttribute('ck_ui_save'); } this.BC._add_core({user:user}); }; MyAPI.callMethod(EXT.reltype+'.Comment.Get',_params,AJ,null); Dialog.Show( function(b){ if(b==0) AJ.skip=1; return true; } ,'<b>准备留言</b>' ,'<div style="padding:1em 5em 0 5em;">正在加载数据，请稍等片刻<b>...</b></div>' ,['<button>&nbsp;取&nbsp;消&nbsp;</button>'] ); }; /** * params:{info:{relid,...},user:{_userInfo_},options:{box:inplace box,init_msg:'init msgs'}} */ Meta_Comment.prototype._add_core=function(params) { if(!this.initialized) return; var EXT = this.EXT; /** in this mode, we open a Window to accept use input,check if there's an open window already.*/ if(EXT.Window.on){ setTimeout('window.'+this.handle_str+'.EXT.Window.Maxsize()',100); return; } var user = params.user; var prefix = (new Date()).getTime(); var h=['<div style="width:500px;overflow:hidden;color:#000;">']; if(user.accid=='0'){ var _fn_style = 'padding:0 10px 0 0;font-weight:normal;text-align:right;'; var _des_style = 'font-size:12px;color:#888;'; h.push('<div><table cellspacing="2" cellpadding="0" border="0"><tbody>'); h.push('<tr><td style="'+_fn_style+'">名字</td><td style="padding:0;"><input type="text" class="fieldinput text" value="'+HtmlEscape(user['ck_nickname'])+'" id="'+this.handle_str+prefix+'f_ck_nickname" tabindex="1" /><span style="'+_des_style+'">(<span class="Red">必填</span>)</span></td><td rowspan="3" style="vertical-align:top;padding:0 0 0 2em;color:#444;">&nbsp;</td></tr>'); h.push('<tr><td style="'+_fn_style+'">Email</td><td style="padding:0;white-space:nowrap;"><input type="text" class="fieldinput text" value="'+HtmlEscape(user['ck_email'])+'" id="'+this.handle_str+prefix+'f_ck_email" tabindex="1" /><span style="'+_des_style+'">(<span class="Green_">选填,不会在页面中显示</span>)</span></td></tr>'); h.push('<tr><td style="'+_fn_style+'">主页</td><td style="padding:0;"><input type="text" class="fieldinput text" value="'+HtmlEscape(user['ck_homepage'])+'" id="'+this.handle_str+prefix+'f_ck_homepage" tabindex="1" /><span style="'+_des_style+'">(<span class="Green_">选填</span>)</span><span style="font-size:12px;"><input type="checkbox" '+(user['ck_ui_save']=='1'?' checked ':'')+' value="1" id="'+this.handle_str+prefix+'f_ck_ui_save" tabindex="2"/>记住我的信息</span></td></tr>'); h.push('</tbody></table></div>'); } h.push('<textarea class="fieldinput text" style="width:98%;font:normal 13px Verdana,Arial;" rows="10" cols="30" onfocus="javascript:this.select();this.onfocus=function(){};" id="'+this.handle_str+prefix+'f_message" tabindex="1">'+(params.options&&params.options.init_msg?HtmlEscape(params.options.init_msg):'')+'</textarea>'); h.push('<div><span class="lk" style="color:#888;" onclick="javascript:window.open(\'/help/textile.html\',\'_blank\',\'status=yes,scrollbars=yes,resizable=yes,width=680,height=480\');return false;" onmouseover="this.style.color=\'#36c\';" onmouseout="this.style.color=\'#888\'">如何插图、加链接?</span></div>'); h.push('<div style="text-align:center;padding:5px 0 0 0;"><span style="margin-right:3em;" onclick="javascript:window.'+this.handle_str+'.do_add('+prefix+','+(user.accid>0?0:1)+');return false;"><button><b>&nbsp;发&nbsp;布&nbsp;</b></button></span><span style="margin-right:3em;display:none;" onclick="javascript:window.'+this.handle_str+'.PreView('+prefix+');return false;"><button>预 览</button></span><span onclick="javascript:window.'+this.handle_str+'.EXT.Window.Hide();return false;"><button>&nbsp;取&nbsp;消&nbsp;</button></span></div>'); h.push('</div><!--//end edit_box-->'); EXT.Window.Show( function(){return true;} ,'<b>'+(params.options.title?params.options.title:'写评论')+'</b>' ,h.join('') ); setTimeout('try{document.getElementById(\''+this.handle_str+prefix+'f_message\').focus();}catch(e){}',300); }; /** * params:{info:{relid,...},user:{_userInfo_},options:{screen_box:<textarea>,box:in where?,init_msg:'init msgs'}} */ Meta_Comment.prototype._add_core2=function(params) { if(!this.initialized) return; var EXT = this.EXT; var user = params.user; var prefix = (new Date()).getTime(); var h=['<div style="width:100%;overflow:hidden;">']; h.push('<textarea class="fieldinput_ text_" style="width:98%;font:normal 13px Verdana,Arial;overflow:hidden;" rows="8" cols="30" onfocus="javascript:ResizeTextarea(this,8);this.select();this.onfocus=function(){ResizeTextarea(this,8);};" onclick="javascript:ResizeTextarea(this,8);" onkeyup="javascript:ResizeTextarea(this,8);" id="'+this.handle_str+prefix+'f_message" tabindex="1">'+(params.options&&params.options.init_msg?HtmlEscape(params.options.init_msg):'')+'</textarea>'); h.push('<div style="float:right;"><span class="lk" style="color:#888;" onclick="javascript:window.open(\'/help/textile.html\',\'_blank\',\'status=yes,scrollbars=yes,resizable=yes,width=680,height=480\');return false;" onmouseover="this.style.color=\'#36c\';" onmouseout="this.style.color=\'#888\'">如何插图、加链接?</span></div>'); h.push('<div style="text-align:left;padding:5px 0 0 0;"><span style="margin-right:1em;" onclick="javascript:window.'+this.handle_str+'.do_add('+prefix+','+(user.accid>0?0:1)+');return false;"><button><b>&nbsp;发&nbsp;布&nbsp;</b></button></span><span onclick="javascript:window.'+this.handle_str+'.'+this.handle_str+prefix+'inplace_box_hide();return false;"><button>&nbsp;取&nbsp;消&nbsp;</button></span></div>'); h.push('</div><!--//end edit_box-->'); var box = params.options.box; var div = _ge(this.handle_str+'comment-form-box'); if(!div){ div = document.createElement('div'); div.setAttribute('style',''); div.id = this.handle_str+'comment-form-box'; box.appendChild(div); /** clear prev textnode */ try{ if(div.previousSibling && div.previousSibling.nodeType == 3){ div.parentNode.removeChild(div.previousSibling); } }catch(e){} ShowElement(div,false); } div.innerHTML = '<div style="width:99%;border-width:0px;border-style:solid;padding:0px;background:#fff;"><div style="background:#fff;padding:0;"><div style="width:100%;">' +(params.options.notitle?'':'<div style="padding:2px 0 2px 0;font:bold 13px Arial;color:#333;">'+(params.options.title?params.options.title:'写评论')+' &nbsp; <span style="font-size:12px;color:#36c;cursor:pointer;text-decoration:underline;" id="cmt_em_btn_'+prefix+'">插入表情</span></div>') +h.join('')+'<div style="height:1px;font:normal 1px/1px Arial;background:#fff;overflow:hidden;"><input style="border:0;font-size:1px;height:1px;width:1px;" id="'+this.handle_str+prefix+'f_focus_first" type="text" /></div></div></div></div>'; try{ ShowElement(params.options.screen_box,false); ShowElement(div,true); }catch(e){} setTimeout('try{_ge(\''+this.handle_str+prefix+'f_focus_first\').focus();}catch(e1){}',30); setTimeout('try{_ge(\''+this.handle_str+prefix+'f_message\').focus();}catch(e){}',100); this[this.handle_str+prefix+'inplace_box_hide']=function() { div.innerHTML = ''; try{ /** show screen box */ ShowElement(params.options.screen_box,true); /** hide div box */ ShowElement(div,false); }catch(e){} }; /** add emotions support **/ var em = new TextEmotion(_ge(this.handle_str+prefix+'f_message'),_ge('cmt_em_btn_'+prefix)); }; Meta_Comment.prototype.do_add=function(prefix,anonymous) { if(!this.initialized) return; var EXT = this.EXT; var idprefix = this.handle_str+prefix; try{ var params = { relid:EXT.relid, message:Trim(_ge(idprefix+'f_message').value) }; if(!params.message || !params.message.length){ alert('你啥都没写呢!'); return; } if(anonymous==1){ params['ck_nickname']=Trim(_ge(idprefix+'f_ck_nickname').value); params['ck_email']=Trim(_ge(idprefix+'f_ck_email').value); params['ck_homepage']=Trim(_ge(idprefix+'f_ck_homepage').value); params['ck_ui_save']=_ge(idprefix+'f_ck_ui_save').checked ? '1':''; if(!params['ck_nickname'] || !params['ck_nickname'].length){ alert('必须写上你的名字!'); return; } } }catch(e){ alert(e); return; } EXT.Comment.Add(EXT.reltype,params ,{afterFinish: function(a,b) { b.BC.EXT.Window.Hide(); var cid=0; try{ var doc = a.XML.documentElement; var c = doc.getElementsByTagName('comment')[0]; cid = c.getAttribute('id'); }catch(e){alert(e);} top.location.href = U_AppendParam(String(top.location.href).replace(/#.*$/,''),'_u',(new Date()).getTime())+'#comment-'+cid; } ,CBParams:{BC:this} } ); }; /**************************************************************************/ /** PopMenu */ function PopShow(el,html) { var handle_str = '__PopMenu_Space_Meta__'; var pos = GetPageOffset(el); var div = CreateDIV2(window,handle_str); if(!div.style){ div.setAttribute('style',''); } var ds = div.style; ds.position = 'absolute'; ds.zIndex = 10; ds.top = (pos.y + el.offsetHeight - 2) + 'px'; ds.left = (pos.x) + 'px'; /** Event Attach */ var div_ev_handle = function(e){ e = e || window.event; var posX = EV_GetMouseXPos(window,e); var posY = EV_GetMouseYPos(window,e); var elPos = GetPageOffset(el); var divPos = GetPageOffset(div); if((posX >= elPos.x && posX <= elPos.x+el.offsetWidth && posY >= elPos.y && posY <= elPos.y+el.offsetHeight ) || (posX >= divPos.x && posX <= divPos.x+div.offsetWidth && posY >= divPos.y && posY <= divPos.y+div.offsetHeight ) ){ return; } EV_Detach(document,'mousemove',div_ev_handle); ShowElement(div,false); div.style.top = div.style.left = '-10000px'; }; div.innerHTML = html; ShowElement(div,true); EV_Detach(document,'mousemove',div_ev_handle); EV_Attach(document,'mousemove',div_ev_handle); } 
