Current oav website
This commit is contained in:
35
dotclear._no/admin/js/jsToolBar/jsToolBar.dotclear.js
Executable file
35
dotclear._no/admin/js/jsToolBar/jsToolBar.dotclear.js
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
jsToolBar.prototype.elements.link.data={};jsToolBar.prototype.elements.link.fncall={};jsToolBar.prototype.elements.link.open_url='popup_link.php';jsToolBar.prototype.elements.link.popup=function(args){window.the_toolbar=this;args=args||'';this.elements.link.data={};var url=this.elements.link.open_url+args;var p_win=window.open(url,'dc_popup','alwaysRaised=yes,dependent=yes,toolbar=yes,height=420,width=520,'+'menubar=no,resizable=yes,scrollbars=yes,status=no');};jsToolBar.prototype.elements.link.fn.wiki=function(){this.elements.link.popup.call(this,'?hreflang='+this.elements.link.default_hreflang);};jsToolBar.prototype.elements.link.fncall.wiki=function(){var data=this.elements.link.data;if(data.href==''){return;}
|
||||
var etag='|'+data.href;if(data.hreflang){etag+='|'+data.hreflang;}
|
||||
if(data.title){if(!data.hreflang){etag+='|';}
|
||||
etag+='|'+data.title;}
|
||||
if(data.content){this.encloseSelection('['+data.content,etag+']');}else{this.encloseSelection('[',etag+']');}};jsToolBar.prototype.elements.link.fn.xhtml=function(){this.elements.link.popup.call(this,'?hreflang='+this.elements.link.default_hreflang);};jsToolBar.prototype.elements.link.fncall.xhtml=function(){var data=this.elements.link.data;if(data.href==''){return;}
|
||||
var stag='<a href="'+data.href+'"';if(data.hreflang){stag+=' hreflang="'+data.hreflang+'"';}
|
||||
if(data.title){stag+=' title="'+data.title+'"';}
|
||||
stag+='>';var etag='</a>';if(data.content){this.encloseSelection('','',function(){return stag+data.content+etag;});}else{this.encloseSelection(stag,etag);}};jsToolBar.prototype.elements.link.fn.wysiwyg=function(){var href,title,hreflang;href=title=hreflang='';hreflang=this.elements.link.default_hreflang;var a=this.getAncestor();if(a.tagName=='a'){href=a.tag.href||'';title=a.tag.title||'';hreflang=a.tag.hreflang||'';}
|
||||
this.elements.link.popup.call(this,'?href='+href+'&hreflang='+hreflang+'&title='+title);};jsToolBar.prototype.elements.link.fncall.wysiwyg=function(){var data=this.elements.link.data;var a=this.getAncestor();if(a.tagName=='a'){if(data.href==''){this.replaceNodeByContent(a.tag);this.iwin.focus();return;}else{a.tag.href=data.href;if(data.hreflang){a.tag.setAttribute('hreflang',data.hreflang);}else{a.tag.removeAttribute('hreflang');}
|
||||
if(data.title){a.tag.setAttribute('title',data.title);}else{a.tag.removeAttribute('title');}
|
||||
return;}}
|
||||
if(data.content){var n=document.createTextNode(data.content);}else{var n=this.getSelectedNode();}
|
||||
var a=this.iwin.document.createElement('a');a.href=data.href;if(data.hreflang)a.setAttribute('hreflang',data.hreflang);if(data.title)a.setAttribute('title',data.title);a.appendChild(n);this.insertNode(a);};jsToolBar.prototype.getAncestor=function(){var res={};var range,commonAncestorContainer;if(this.iwin.getSelection){var selection=this.iwin.getSelection();range=selection.getRangeAt(0);commonAncestorContainer=range.commonAncestorContainer;while(commonAncestorContainer.nodeType!=1){commonAncestorContainer=commonAncestorContainer.parentNode;}}else{range=this.iwin.document.selection.createRange();commonAncestorContainer=range.parentElement();}
|
||||
var ancestorTagName=commonAncestorContainer.tagName.toLowerCase();while(ancestorTagName!='a'&&ancestorTagName!='body'){commonAncestorContainer=commonAncestorContainer.parentNode;ancestorTagName=commonAncestorContainer.tagName.toLowerCase();}
|
||||
res.tag=commonAncestorContainer;res.tagName=ancestorTagName;return res;};jsToolBar.prototype.elements.img_select={type:'button',title:'Image chooser',fn:{},fncall:{},open_url:'media.php?popup=1',data:{},popup:function(){window.the_toolbar=this;this.elements.img_select.data={};var p_win=window.open(this.elements.img_select.open_url,'dc_popup','alwaysRaised=yes,dependent=yes,toolbar=yes,height=500,width=760,'+'menubar=no,resizable=yes,scrollbars=yes,status=no');}};jsToolBar.prototype.elements.img_select.fn.wiki=function(){this.elements.img_select.popup.call(this);};jsToolBar.prototype.elements.img_select.fncall.wiki=function(){var d=this.elements.img_select.data;if(d.src==undefined){return;}
|
||||
this.encloseSelection('','',function(str){var alt=(str)?str:d.title;var res='(('+d.src+'|'+alt;if(d.alignment=='left'){res+='|L';}else if(d.alignment=='right'){res+='|R';}else if(d.alignment=='center'){res+='|C';}else if(d.description){res+='|';}
|
||||
if(d.description){res+='|'+d.description;}
|
||||
res+='))';if(d.link){var ltitle=(alt)?'||'+alt:'';res='['+res+'|'+d.url+ltitle+']';}
|
||||
return res;});};jsToolBar.prototype.elements.img_select.fn.xhtml=function(){this.elements.img_select.popup.call(this);};jsToolBar.prototype.elements.img_select.fncall.xhtml=function(){var d=this.elements.img_select.data;if(d.src==undefined){return;}
|
||||
this.encloseSelection('','',function(str){var alt=(str)?str:d.title;var res='<img src="'+d.src+'" alt="'+alt.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"';if(d.alignment=='left'){res+=' style="float: left; margin: 0 1em 1em 0;"';}else if(d.alignment=='right'){res+=' style="float: right; margin: 0 0 1em 1em;"';}else if(d.alignment=='center'){res+=' style="margin: 0 auto; display: block;"';}
|
||||
if(d.description){res+=' title="'+d.description.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"';}
|
||||
res+=' />';if(d.link){var ltitle=(alt)?' title="'+alt.replace('&','&').replace('>','>').replace('<','<').replace('"','"')+'"':'';res='<a href="'+d.url+'"'+ltitle+'>'+res+'</a>';}
|
||||
return res;});};jsToolBar.prototype.elements.img.fn.wysiwyg=function(){var src=this.elements.img.prompt.call(this);if(!src){return;}
|
||||
var img=this.iwin.document.createElement('img');img.src=src;img.setAttribute('alt',this.getSelectedText());this.insertNode(img);};jsToolBar.prototype.elements.img_select.fn.wysiwyg=function(){this.elements.img_select.popup.call(this);};jsToolBar.prototype.elements.img_select.fncall.wysiwyg=function(){var d=this.elements.img_select.data;var alt=(this.getSelectedText())?this.getSelectedText():d.title;if(d.src==undefined){return;}
|
||||
var img=this.iwin.document.createElement('img');img.src=d.src;img.setAttribute('alt',alt);if(d.alignment=='left'){if(img.style.styleFloat!=undefined){img.style.styleFloat='left';}else{img.style.cssFloat='left';}
|
||||
img.style.marginTop=0;img.style.marginRight='1em';img.style.marginBottom='1em';img.style.marginLeft=0;}else if(d.alignment=='right'){if(img.style.styleFloat!=undefined){img.style.styleFloat='right';}else{img.style.cssFloat='right';}
|
||||
img.style.marginTop=0;img.style.marginRight=0;img.style.marginBottom='1em';img.style.marginLeft='1em';}else if(d.alignment=='center'){img.style.marginTop=0;img.style.marginRight='auto';img.style.marginBottom=0;img.style.marginLeft='auto';img.style.display='block';}
|
||||
if(d.description){img.setAttribute('title',d.description);}
|
||||
if(d.link){var a=this.iwin.document.createElement('a');a.href=d.url;if(alt){a.setAttribute('title',alt);}
|
||||
a.appendChild(img);this.insertNode(a);}else{this.insertNode(img);}};jsToolBar.prototype.elements.mp3_insert={fncall:{},data:{}};jsToolBar.prototype.elements.mp3_insert.fncall.wiki=function(){var d=this.elements.mp3_insert.data;if(d.player==undefined){return;}
|
||||
this.encloseSelection('','',function(str){return'\n///html\n'+d.player+'///\n';});};jsToolBar.prototype.elements.mp3_insert.fncall.xhtml=function(){var d=this.elements.mp3_insert.data;if(d.player==undefined){return;}
|
||||
this.encloseSelection('','',function(str){return'\n'+d.player+'\n';});};jsToolBar.prototype.elements.mp3_insert.fncall.wysiwyg=function(){return;};jsToolBar.prototype.elements.flv_insert={fncall:{},data:{}};jsToolBar.prototype.elements.flv_insert.fncall.wiki=function(){var d=this.elements.flv_insert.data;if(d.player==undefined){return;}
|
||||
this.encloseSelection('','',function(str){return'\n///html\n'+d.player+'///\n';});};jsToolBar.prototype.elements.flv_insert.fncall.xhtml=function(){var d=this.elements.flv_insert.data;if(d.player==undefined){return;}
|
||||
this.encloseSelection('','',function(str){return'\n'+d.player+'\n';});};jsToolBar.prototype.elements.flv_insert.fncall.wysiwyg=function(){return;};jsToolBar.prototype.elements.post_link={type:'button',title:'Link to an entry',fn:{},open_url:'popup_posts.php',data:{},popup:function(){window.the_toolbar=this;this.elements.img_select.data={};var p_win=window.open(this.elements.post_link.open_url,'dc_popup','alwaysRaised=yes,dependent=yes,toolbar=yes,height=500,width=760,'+'menubar=no,resizable=yes,scrollbars=yes,status=no');}};jsToolBar.prototype.elements.post_link.fn.wiki=function(){this.elements.post_link.popup.call(this);};jsToolBar.prototype.elements.post_link.fn.xhtml=function(){this.elements.post_link.popup.call(this);};jsToolBar.prototype.elements.post_link.fn.wysiwyg=function(){this.elements.post_link.popup.call(this);};jsToolBar.prototype.elements.space3={type:'space',format:{wysiwyg:true,wiki:true,xhtml:true}};
|
||||
29
dotclear._no/admin/js/jsToolBar/jsToolBar.js
Executable file
29
dotclear._no/admin/js/jsToolBar/jsToolBar.js
Executable file
@ -0,0 +1,29 @@
|
||||
|
||||
function jsToolBar(textarea){if(!document.createElement){return;}
|
||||
if(!textarea){return;}
|
||||
if((typeof(document["selection"])=="undefined")&&(typeof(textarea["setSelectionRange"])=="undefined")){return;}
|
||||
this.textarea=textarea;this.editor=document.createElement('div');this.editor.className='jstEditor';this.textarea.parentNode.insertBefore(this.editor,this.textarea);this.editor.appendChild(this.textarea);this.toolbar=document.createElement("div");this.toolbar.className='jstElements';this.editor.parentNode.insertBefore(this.toolbar,this.editor);if(navigator.appName=='Microsoft Internet Explorer')
|
||||
{if(this.editor.addEventListener)
|
||||
{this.handle=document.createElement('div');this.handle.className='jstHandle';var dragStart=this.resizeDragStart;var This=this;this.handle.addEventListener('mousedown',function(event){dragStart.call(This,event);},false);this.editor.parentNode.insertBefore(this.handle,this.editor.nextSibling);}}
|
||||
this.context=null;this.toolNodes={};};function jsButton(title,fn,scope,className){this.title=title||null;this.fn=fn||function(){};this.scope=scope||null;this.className=className||null;};jsButton.prototype.draw=function(){if(!this.scope)return null;var button=document.createElement('button');button.setAttribute('type','button');if(this.className)button.className=this.className;button.title=this.title;var span=document.createElement('span');span.appendChild(document.createTextNode(this.title));button.appendChild(span);if(this.icon!=undefined){button.style.backgroundImage='url('+this.icon+')';}
|
||||
if(typeof(this.fn)=='function'){var This=this;button.onclick=function(){try{This.fn.apply(This.scope,arguments)}catch(e){}return false;};}
|
||||
return button;};function jsSpace(id){this.id=id||null;this.width=null;};jsSpace.prototype.draw=function(){var span=document.createElement('span');if(this.id)span.id=this.id;span.appendChild(document.createTextNode(String.fromCharCode(160)));span.className='jstSpacer';if(this.width)span.style.marginRight=this.width+'px';return span;};function jsCombo(title,options,scope,fn,className){this.title=title||null;this.options=options||null;this.scope=scope||null;this.fn=fn||function(){};this.className=className||null;};jsCombo.prototype.draw=function(){if(!this.scope||!this.options)return null;var select=document.createElement('select');if(this.className)select.className=className;select.title=this.title;for(var o in this.options){var option=document.createElement('option');option.value=o;option.appendChild(document.createTextNode(this.options[o]));select.appendChild(option);}
|
||||
var This=this;select.onchange=function(){try{This.fn.call(This.scope,this.value);}catch(e){alert(e);}
|
||||
return false;};return select;};jsToolBar.prototype={base_url:'',mode:'xhtml',elements:{},getMode:function(){return this.mode;},setMode:function(mode){this.mode=mode||'xhtml';},switchMode:function(mode){mode=mode||'xhtml';this.draw(mode);},button:function(toolName){var tool=this.elements[toolName];if(typeof tool.fn[this.mode]!='function')return null;var b=new jsButton(tool.title,tool.fn[this.mode],this,'jstb_'+toolName);if(tool.icon!=undefined){b.icon=tool.icon;}
|
||||
return b;},space:function(toolName){var tool=new jsSpace(toolName);if(this.elements[toolName].format!=undefined&&!this.elements[toolName].format[this.mode])return null;if(this.elements[toolName].width!==undefined){tool.width=this.elements[toolName].width;}
|
||||
return tool;},combo:function(toolName){var tool=this.elements[toolName];if(tool[this.mode]!=undefined){var length=tool[this.mode].list.length;if(typeof tool[this.mode].fn!='function'||length==0){return null;}else{var options={};for(var i=0;i<length;i++){var opt=tool[this.mode].list[i];options[opt]=tool.options[opt];}
|
||||
return new jsCombo(tool.title,options,this,tool[this.mode].fn);}}},draw:function(mode){this.setMode(mode);while(this.toolbar.hasChildNodes()){this.toolbar.removeChild(this.toolbar.firstChild)}
|
||||
this.toolNodes={};var b,tool,newTool;for(var i in this.elements){b=this.elements[i];var disabled=b.type==undefined||b.type==''||(b.disabled!=undefined&&b.disabled)||(b.context!=undefined&&b.context!=null&&b.context!=this.context);if(!disabled&&typeof this[b.type]=='function'){tool=this[b.type](i);if(tool)newTool=tool.draw();if(newTool){this.toolNodes[i]=newTool;this.toolbar.appendChild(newTool);}}}},singleTag:function(stag,etag){stag=stag||null;etag=etag||stag;if(!stag||!etag){return;}
|
||||
this.encloseSelection(stag,etag);},encloseSelection:function(prefix,suffix,fn){this.textarea.focus();prefix=prefix||'';suffix=suffix||'';var start,end,sel,scrollPos,subst,res;if(typeof(document["selection"])!="undefined"){sel=document.selection.createRange().text;}else if(typeof(this.textarea["setSelectionRange"])!="undefined"){start=this.textarea.selectionStart;end=this.textarea.selectionEnd;scrollPos=this.textarea.scrollTop;sel=this.textarea.value.substring(start,end);}
|
||||
if(sel.match(/ $/)){sel=sel.substring(0,sel.length-1);suffix=suffix+" ";}
|
||||
if(typeof(fn)=='function'){res=(sel)?fn.call(this,sel):fn('');}else{res=(sel)?sel:'';}
|
||||
subst=prefix+res+suffix;if(typeof(document["selection"])!="undefined"){var range=document.selection.createRange().text=subst;this.textarea.caretPos-=suffix.length;}else if(typeof(this.textarea["setSelectionRange"])!="undefined"){this.textarea.value=this.textarea.value.substring(0,start)+subst+
|
||||
this.textarea.value.substring(end);if(sel){this.textarea.setSelectionRange(start+subst.length,start+subst.length);}else{this.textarea.setSelectionRange(start+prefix.length,start+prefix.length);}
|
||||
this.textarea.scrollTop=scrollPos;}},stripBaseURL:function(url){if(this.base_url!=''){var pos=url.indexOf(this.base_url);if(pos==0){url=url.substr(this.base_url.length);}}
|
||||
return url;}};jsToolBar.prototype.resizeSetStartH=function(){this.dragStartH=this.textarea.offsetHeight+0;};jsToolBar.prototype.resizeDragStart=function(event){var This=this;this.dragStartY=event.clientY;this.resizeSetStartH();document.addEventListener('mousemove',this.dragMoveHdlr=function(event){This.resizeDragMove(event);},false);document.addEventListener('mouseup',this.dragStopHdlr=function(event){This.resizeDragStop(event);},false);};jsToolBar.prototype.resizeDragMove=function(event){this.textarea.style.height=(this.dragStartH+event.clientY-this.dragStartY)+'px';};jsToolBar.prototype.resizeDragStop=function(event){document.removeEventListener('mousemove',this.dragMoveHdlr,false);document.removeEventListener('mouseup',this.dragStopHdlr,false);};jsToolBar.prototype.elements.blocks={type:'combo',title:'block format',options:{none:'-- none --',nonebis:'- block format -',p:'Paragraph',h1:'Header 1',h2:'Header 2',h3:'Header 3',h4:'Header 4',h5:'Header 5',h6:'Header 6'},xhtml:{list:['nonebis','p','h1','h2','h3','h4','h5','h6'],fn:function(opt){if(opt=='nonebis')
|
||||
this.textarea.focus();else
|
||||
try{this.singleTag('<'+opt+'>','</'+opt+'>');}catch(e){};this.toolNodes.blocks.value='nonebis';}},wiki:{list:['nonebis','h3','h4','h5'],fn:function(opt){switch(opt){case'nonebis':this.textarea.focus();break;case'h3':this.encloseSelection('!!!');break;case'h4':this.encloseSelection('!!');break;case'h5':this.encloseSelection('!');break;}
|
||||
this.toolNodes.blocks.value='nonebis';}}};jsToolBar.prototype.elements.space0={type:'space',format:{wysiwyg:true,wiki:true,xhtml:true}};jsToolBar.prototype.elements.strong={type:'button',title:'Strong emphasis',fn:{wiki:function(){this.singleTag('__')},xhtml:function(){this.singleTag('<strong>','</strong>')}}};jsToolBar.prototype.elements.em={type:'button',title:'Emphasis',fn:{wiki:function(){this.singleTag("''")},xhtml:function(){this.singleTag('<em>','</em>')}}};jsToolBar.prototype.elements.ins={type:'button',title:'Inserted',fn:{wiki:function(){this.singleTag('++')},xhtml:function(){this.singleTag('<ins>','</ins>')}}};jsToolBar.prototype.elements.del={type:'button',title:'Deleted',fn:{wiki:function(){this.singleTag('--')},xhtml:function(){this.singleTag('<del>','</del>')}}};jsToolBar.prototype.elements.quote={type:'button',title:'Inline quote',fn:{wiki:function(){this.singleTag('{{','}}')},xhtml:function(){this.singleTag('<q>','</q>')}}};jsToolBar.prototype.elements.code={type:'button',title:'Code',fn:{wiki:function(){this.singleTag('@@')},xhtml:function(){this.singleTag('<code>','</code>')}}};jsToolBar.prototype.elements.space1={type:'space',format:{wysiwyg:true,wiki:true,xhtml:true}};jsToolBar.prototype.elements.br={type:'button',title:'Line break',fn:{wiki:function(){this.encloseSelection("%%%\n",'')},xhtml:function(){this.encloseSelection("<br />\n",'')}}};jsToolBar.prototype.elements.space2={type:'space',format:{wysiwyg:true,wiki:true,xhtml:true}};jsToolBar.prototype.elements.blockquote={type:'button',title:'Blockquote',fn:{xhtml:function(){this.singleTag('<blockquote>','</blockquote>')},wiki:function(){this.encloseSelection("\n",'',function(str){str=str.replace(/\r/g,'');return'> '+str.replace(/\n/g,"\n> ");});}}};jsToolBar.prototype.elements.pre={type:'button',title:'Preformated text',fn:{wiki:function(){this.singleTag("///\n","\n///")},xhtml:function(){this.singleTag('<pre>','</pre>')}}};jsToolBar.prototype.elements.ul={type:'button',title:'Unordered list',fn:{wiki:function(){this.encloseSelection('','',function(str){str=str.replace(/\r/g,'');return'* '+str.replace(/\n/g,"\n* ");});},xhtml:function(){this.encloseSelection('','',function(str){str=str.replace(/\r/g,'');str=str.replace(/\n/g,"</li>\n <li>");return"<ul>\n <li>"+str+"</li>\n</ul>";});}}};jsToolBar.prototype.elements.ol={type:'button',title:'Ordered list',fn:{wiki:function(){this.encloseSelection('','',function(str){str=str.replace(/\r/g,'');return'# '+str.replace(/\n/g,"\n# ");});},xhtml:function(){this.encloseSelection('','',function(str){str=str.replace(/\r/g,'');str=str.replace(/\n/g,"</li>\n <li>");return"<ol>\n <li>"+str+"</li>\n</ol>";});}}};jsToolBar.prototype.elements.space3={type:'space',format:{wysiwyg:true,wiki:true,xhtml:true}};jsToolBar.prototype.elements.link={type:'button',title:'Link',fn:{},href_prompt:'Please give page URL:',hreflang_prompt:'Language of this page:',default_hreflang:'',prompt:function(href,hreflang){href=href||'';hreflang=hreflang||this.elements.link.default_hreflang;href=window.prompt(this.elements.link.href_prompt,href);if(!href){return false;}
|
||||
hreflang=window.prompt(this.elements.link.hreflang_prompt,hreflang);return{href:this.stripBaseURL(href),hreflang:hreflang};}};jsToolBar.prototype.elements.link.fn.xhtml=function(){var link=this.elements.link.prompt.call(this);if(link){var stag='<a href="'+link.href+'"';if(link.hreflang){stag=stag+' hreflang="'+link.hreflang+'"';}
|
||||
stag=stag+'>';var etag='</a>';this.encloseSelection(stag,etag);}};jsToolBar.prototype.elements.link.fn.wiki=function(){var link=this.elements.link.prompt.call(this);if(link){var stag='[';var etag='|'+link.href;if(link.hreflang){etag=etag+'|'+link.hreflang;}
|
||||
etag=etag+']';this.encloseSelection(stag,etag);}};jsToolBar.prototype.elements.img={type:'button',title:'External image',src_prompt:'Please give image URL:',fn:{},prompt:function(src){src=src||'';return this.stripBaseURL(window.prompt(this.elements.img.src_prompt,src));}};jsToolBar.prototype.elements.img.fn.xhtml=function(){var src=this.elements.img.prompt.call(this);if(src){this.encloseSelection('','',function(str){if(str){return'<img src="'+src+'" alt="'+str+'" />';}else{return'<img src="'+src+'" alt="" />';}});}};jsToolBar.prototype.elements.img.fn.wiki=function(){var src=this.elements.img.prompt.call(this);if(src){this.encloseSelection('','',function(str){if(str){return'(('+src+'|'+str+'))';}else{return'(('+src+'))';}});}};
|
||||
48
dotclear._no/admin/js/jsToolBar/jsToolBar.wysiwyg.js
Executable file
48
dotclear._no/admin/js/jsToolBar/jsToolBar.wysiwyg.js
Executable file
@ -0,0 +1,48 @@
|
||||
|
||||
jsToolBar.prototype.can_wwg=(document.designMode!=undefined);jsToolBar.prototype.iframe=null;jsToolBar.prototype.iwin=null;jsToolBar.prototype.ibody=null;jsToolBar.prototype.iframe_css=null;jsToolBar.prototype.drawToolBar=jsToolBar.prototype.draw;jsToolBar.prototype.draw=function(mode){mode=mode||'xhtml';if(this.can_wwg){this.mode='wysiwyg';this.drawToolBar('wysiwyg');this.initWindow();}else{this.drawToolBar(mode);}};jsToolBar.prototype.switchMode=function(mode){mode=mode||'xhtml';if(mode=='xhtml'){this.wwg_mode=true;this.draw(mode);}else{if(this.wwg_mode){this.syncContents('iframe');}
|
||||
this.wwg_mode=false;this.removeEditor();this.textarea.style.display='';this.drawToolBar(mode);}};jsToolBar.prototype.syncContents=function(from){from=from||'textarea';var This=this;if(from=='textarea'){initContent();}else{this.validBlockquote();var html=this.applyHtmlFilters(this.ibody.innerHTML);if(html=='<br />'){html='<p></p>';}
|
||||
this.textarea.value=html;}
|
||||
function initContent(){if(!This.iframe.contentWindow.document||!This.iframe.contentWindow.document.body){setTimeout(initContent,1);return;}
|
||||
This.ibody=This.iframe.contentWindow.document.body;if(This.textarea.value!=''&&This.textarea.value!='<p></p>'){This.ibody.innerHTML=This.applyWysiwygFilters(This.textarea.value);if(This.ibody.createTextRange){var IErange=This.ibody.createTextRange();IErange.execCommand("SelectAll");IErange.collapse();IErange.select();}}else{var idoc=This.iwin.document;var para=idoc.createElement('p');para.appendChild(idoc.createElement('br'));while(idoc.body.hasChildNodes()){idoc.body.removeChild(idoc.body.lastChild);}
|
||||
idoc.body.appendChild(para);}}};jsToolBar.prototype.htmlFilters={tagsoup:function(str){return this.tagsoup2xhtml(str);}};jsToolBar.prototype.applyHtmlFilters=function(str){for(var fn in this.htmlFilters){str=this.htmlFilters[fn].call(this,str);}
|
||||
return str;};jsToolBar.prototype.wysiwygFilters={};jsToolBar.prototype.applyWysiwygFilters=function(str){for(var fn in this.wysiwygFilters){str=this.wysiwygFilters[fn].call(this,str);}
|
||||
return str;};jsToolBar.prototype.switchEdit=function(){if(this.wwg_mode){this.textarea.style.display='';this.iframe.style.display='none';this.syncContents('iframe');this.drawToolBar('xhtml');this.wwg_mode=false;this.focusEditor();}else{this.iframe.style.display='';this.textarea.style.display='none';this.syncContents('textarea');this.drawToolBar('wysiwyg');this.wwg_mode=true;this.focusEditor();}
|
||||
this.setSwitcher();};jsToolBar.prototype.initWindow=function(){var This=this;this.iframe=document.createElement('iframe');this.textarea.parentNode.insertBefore(this.iframe,this.textarea.nextSibling);this.switcher=document.createElement('ul');this.switcher.className='jstSwitcher';this.editor.appendChild(this.switcher);this.iframe.height=this.textarea.offsetHeight+0;this.iframe.width=this.textarea.offsetWidth+0;if(this.textarea.tabIndex!=undefined){this.iframe.tabIndex=this.textarea.tabIndex;}
|
||||
function initIframe(){var doc=This.iframe.contentWindow.document;if(!doc){setTimeout(initIframe,1);return false;}
|
||||
doc.open();var html='<html>\n'+'<head>\n'+'<style type="text/css">'+This.iframe_css+'</style>\n'+
|
||||
(This.base_url!=''?'<base href="'+This.base_url+'" />':'')+'</head>\n'+'<body>\n'+'</body>\n'+'</html>';doc.write(html);doc.close();if(document.all){doc.designMode='on';}
|
||||
This.iwin=This.iframe.contentWindow;This.syncContents('textarea');if(This.wwg_mode==undefined){This.wwg_mode=true;}
|
||||
if(This.wwg_mode){This.textarea.style.display='none';}else{This.iframe.style.display='none';}
|
||||
if(This.textarea.form){chainHandler(This.textarea.form,'onsubmit',function(){if(This.wwg_mode){This.syncContents('iframe');}});}
|
||||
for(var evt in This.iwinEvents){var event=This.iwinEvents[evt];This.addIwinEvent(This.iframe.contentWindow.document,event.type,event.fn,This);}
|
||||
This.setSwitcher();try{This.iwin.document.designMode='on';}catch(e){};return true;}
|
||||
initIframe();};jsToolBar.prototype.addIwinEvent=function(target,type,fn,scope){var myFn=function(e){fn.call(scope,e)};addEvent(target,type,myFn,true);addEvent(scope.iwin,'unload',function(){removeEvent(target,type,myFn,true);},true);};jsToolBar.prototype.iwinEvents={block1:{type:'mouseup',fn:function(){this.adjustBlockLevelCombo()}},block2:{type:'keyup',fn:function(){this.adjustBlockLevelCombo()}}};jsToolBar.prototype.switcher_visual_title='visual';jsToolBar.prototype.switcher_source_title='source';jsToolBar.prototype.setSwitcher=function(){while(this.switcher.hasChildNodes()){this.switcher.removeChild(this.switcher.firstChild);}
|
||||
var This=this;function setLink(title,link){var li=document.createElement('li');if(link){var a=document.createElement('a');a.href='#';a.editor=This;a.onclick=function(){this.editor.switchEdit();return false;};a.appendChild(document.createTextNode(title));}else{li.className='jstSwitcherCurrent';a=document.createTextNode(title);}
|
||||
li.appendChild(a);This.switcher.appendChild(li);}
|
||||
setLink(this.switcher_visual_title,!this.wwg_mode);setLink(this.switcher_source_title,this.wwg_mode);};jsToolBar.prototype.removeEditor=function(){if(this.iframe!=null){this.iframe.parentNode.removeChild(this.iframe);this.iframe=null;}
|
||||
if(this.switcher!=undefined&&this.switcher.parentNode!=undefined){this.switcher.parentNode.removeChild(this.switcher);}};jsToolBar.prototype.focusEditor=function(){if(this.wwg_mode){try{this.iwin.document.designMode='on';}catch(e){};var This=this;setTimeout(function(){This.iframe.contentWindow.focus()},1);}else{this.textarea.focus();}};jsToolBar.prototype.resizeSetStartH=function(){if(this.wwg_mode&&this.iframe!=undefined){this.dragStartH=this.iframe.offsetHeight;return;}
|
||||
this.dragStartH=this.textarea.offsetHeight+0;};jsToolBar.prototype.resizeDragMove=function(event){var new_height=(this.dragStartH+event.clientY-this.dragStartY)+'px';if(this.iframe!=undefined){this.iframe.style.height=new_height;}
|
||||
this.textarea.style.height=new_height;};jsToolBar.prototype.insertNode=function(node){var range;if(this.iwin.getSelection){var sel=this.iwin.getSelection();range=sel.getRangeAt(0);sel.removeAllRanges();range.deleteContents();range.insertNode(node);range.selectNodeContents(node);range.setEndAfter(node);if(range.endContainer.childNodes.length>range.endOffset&&range.endContainer.nodeType!=Node.TEXT_NODE){range.setEnd(range.endContainer.childNodes[range.endOffset],0);}else{range.setEnd(range.endContainer.childNodes[0]);}
|
||||
sel.addRange(range);sel.collapseToEnd();}else{var p=this.iwin.document.createElement('div');p.appendChild(node);range=this.iwin.document.selection.createRange();range.execCommand('delete');range.pasteHTML(p.innerHTML);range.collapse(false);range.select();}
|
||||
this.iwin.focus();};jsToolBar.prototype.getSelectedNode=function(){if(this.iwin.getSelection){var sel=this.iwin.getSelection();var range=sel.getRangeAt(0);var content=range.cloneContents();}else{var sel=this.iwin.document.selection;var d=this.iwin.document.createElement('div');d.innerHTML=sel.createRange().htmlText;var content=this.iwin.document.createDocumentFragment();for(var i=0;i<d.childNodes.length;i++){content.appendChild(d.childNodes[i].cloneNode(true));}}
|
||||
return content;};jsToolBar.prototype.getSelectedText=function(){if(this.iwin.getSelection){return this.iwin.getSelection().toString();}else{var range=this.iwin.document.selection.createRange();return range.text;}};jsToolBar.prototype.replaceNodeByContent=function(node){var content=this.iwin.document.createDocumentFragment();for(var i=0;i<node.childNodes.length;i++){content.appendChild(node.childNodes[i].cloneNode(true));}
|
||||
node.parentNode.replaceChild(content,node);};jsToolBar.prototype.getBlockLevel=function(){var blockElts=['p','h1','h2','h3','h4','h5','h6'];var range,commonAncestorContainer;if(this.iwin.getSelection){var selection=this.iwin.getSelection();range=selection.getRangeAt(0);commonAncestorContainer=range.commonAncestorContainer;while(commonAncestorContainer.nodeType!=1){commonAncestorContainer=commonAncestorContainer.parentNode;}}else{range=this.iwin.document.selection.createRange();commonAncestorContainer=range.parentElement();}
|
||||
var ancestorTagName=commonAncestorContainer.tagName.toLowerCase();while(arrayIndexOf(blockElts,ancestorTagName)==-1&&ancestorTagName!='body'){commonAncestorContainer=commonAncestorContainer.parentNode;ancestorTagName=commonAncestorContainer.tagName.toLowerCase();}
|
||||
if(ancestorTagName=='body')return null;else return commonAncestorContainer;};jsToolBar.prototype.adjustBlockLevelCombo=function(){var blockLevel=this.getBlockLevel();if(blockLevel!==null)
|
||||
this.toolNodes.blocks.value=blockLevel.tagName.toLowerCase();else{if(this.mode=='wysiwyg')this.toolNodes.blocks.value='none';if(this.mode=='xhtml')this.toolNodes.blocks.value='nonebis';}};jsToolBar.prototype.simpleCleanRegex=new Array([/<meta[\w\W]*?>/gim,''],[/<style[\w\W]*?>[\w\W]*?<\/style>/gim,''],[/<\/?font[\w\W]*?>/gim,''],[/<(\/?)(B|b|STRONG)([\s>\/])/g,"<$1strong$3"],[/<(\/?)(I|i|EM)([\s>\/])/g,"<$1em$3"],[/<IMG ([^>]*?[^\/])>/gi,"<img $1 />"],[/<INPUT ([^>]*?[^\/])>/gi,"<input $1 />"],[/<COL ([^>]*?[^\/])>/gi,"<col $1 />"],[/<AREA ([^>]*?[^\/])>/gi,"<area $1 />"],[/<PARAM ([^>]*?[^\/])>/gi,"<param $1 />"],[/<HR ([^>]*?[^\/])>/gi,"<hr $1/>"],[/<BR ([^>]*?[^\/])>/gi,"<br $1/>"],[/<(\/?)U([\s>\/])/gi,"<$1ins$2"],[/<(\/?)STRIKE([\s>\/])/gi,"<$1del$2"],[/<span style="font-weight: normal;">([\w\W]*?)<\/span>/gm,"$1"],[/<span style="font-weight: bold;">([\w\W]*?)<\/span>/gm,"<strong>$1</strong>"],[/<span style="font-style: italic;">([\w\W]*?)<\/span>/gm,"<em>$1</em>"],[/<span style="text-decoration: underline;">([\w\W]*?)<\/span>/gm,"<ins>$1</ins>"],[/<span style="text-decoration: line-through;">([\w\W]*?)<\/span>/gm,"<del>$1</del>"],[/<span style="text-decoration: underline line-through;">([\w\W]*?)<\/span>/gm,"<del><ins>$1</ins></del>"],[/<span style="(font-weight: bold; ?|font-style: italic; ?){2}">([\w\W]*?)<\/span>/gm,"<strong><em>$2</em></strong>"],[/<span style="(font-weight: bold; ?|text-decoration: underline; ?){2}">([\w\W]*?)<\/span>/gm,"<ins><strong>$2</strong></ins>"],[/<span style="(font-weight: italic; ?|text-decoration: underline; ?){2}">([\w\W]*?)<\/span>/gm,"<ins><em>$2</em></ins>"],[/<span style="(font-weight: bold; ?|text-decoration: line-through; ?){2}">([\w\W]*?)<\/span>/gm,"<del><strong>$2</strong></del>"],[/<span style="(font-weight: italic; ?|text-decoration: line-through; ?){2}">([\w\W]*?)<\/span>/gm,"<del><em>$2</em></del>"],[/<span style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: underline; ?){3}">([\w\W]*?)<\/span>/gm,"<ins><strong><em>$2</em></strong></ins>"],[/<span style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: line-through; ?){3}">([\w\W]*?)<\/span>/gm,"<del><strong><em>$2</em></strong></del>"],[/<span style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: underline line-through; ?){3}">([\w\W]*?)<\/span>/gm,"<del><ins><strong><em>$2</em></strong></ins></del>"],[/<strong style="font-weight: normal;">([\w\W]*?)<\/strong>/gm,"$1"],[/<([a-z]+) style="font-weight: normal;">([\w\W]*?)<\/\1>/gm,"<$1>$2</$1>"],[/<([a-z]+) style="font-weight: bold;">([\w\W]*?)<\/\1>/gm,"<$1><strong>$2</strong></$1>"],[/<([a-z]+) style="font-style: italic;">([\w\W]*?)<\/\1>/gm,"<$1><em>$2</em></$1>"],[/<([a-z]+) style="text-decoration: underline;">([\w\W]*?)<\/\1>/gm,"<ins><$1>$2</$1></ins>"],[/<([a-z]+) style="text-decoration: line-through;">([\w\W]*?)<\/\1>/gm,"<del><$1>$2</$1></del>"],[/<([a-z]+) style="text-decoration: underline line-through;">([\w\W]*?)<\/\1>/gm,"<del><ins><$1>$2</$1></ins></del>"],[/<([a-z]+) style="(font-weight: bold; ?|font-style: italic; ?){2}">([\w\W]*?)<\/\1>/gm,"<$1><strong><em>$3</em></strong></$1>"],[/<([a-z]+) style="(font-weight: bold; ?|text-decoration: underline; ?){2}">([\w\W]*?)<\/\1>/gm,"<ins><$1><strong>$3</strong></$1></ins>"],[/<([a-z]+) style="(font-weight: italic; ?|text-decoration: underline; ?){2}">([\w\W]*?)<\/\1>/gm,"<ins><$1><em>$3</em></$1></ins>"],[/<([a-z]+) style="(font-weight: bold; ?|text-decoration: line-through; ?){2}">([\w\W]*?)<\/\1>/gm,"<del><$1><strong>$3</strong></$1></del>"],[/<([a-z]+) style="(font-weight: italic; ?|text-decoration: line-through; ?){2}">([\w\W]*?)<\/\1>/gm,"<del><$1><em>$3</em></$1></del>"],[/<([a-z]+) style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: underline; ?){3}">([\w\W]*?)<\/\1>/gm,"<ins><$1><strong><em>$3</em></strong></$1></ins>"],[/<([a-z]+) style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: line-through; ?){3}">([\w\W]*?)<\/\1>/gm,"<del><$1><strong><em>$3</em></strong></$1></del>"],[/<([a-z]+) style="(font-weight: bold; ?|font-style: italic; ?|text-decoration: underline line-through; ?){3}">([\w\W]*?)<\/\1>/gm,"<del><ins><$1><strong><em>$3</em></strong></$1></ins></del>"],[/<p><blockquote>(.*)(\n)+<\/blockquote><\/p>/i,"<blockquote>$1</blockquote>\n"],[/<\/(strong|em|ins|del|q|code)>(\s*?)<\1>/gim,"$2"],[/<(br|BR)>/g,"<br />"],[/<(hr|HR)>/g,"<hr />"],[/([^\s])\/>/g,"$1 />"],[/<br \/>\s*<\/(h1|h2|h3|h4|h5|h6|ul|ol|li|p|blockquote|div)/gi,"</$1"],[/<\/(h1|h2|h3|h4|h5|h6|ul|ol|li|p|blockquote)>([^\n\u000B\r\f])/gi,"</$1>\n$2"],[/<hr style="width: 100%; height: 2px;" \/>/g,"<hr />"]);jsToolBar.prototype.tagsoup2xhtml=function(html){for(var reg in this.simpleCleanRegex){html=html.replace(this.simpleCleanRegex[reg][0],this.simpleCleanRegex[reg][1]);}
|
||||
while(/(<[^\/!]>|<[^\/!][^>]*[^\/]>)\s*<\/[^>]*[^-]>/.test(html)){html=html.replace(/(<[^\/!]>|<[^\/!][^>]*[^\/]>)\s*<\/[^>]*[^-]>/g,"");}
|
||||
html=html.replace(/<(\/?)([A-Z0-9]+)/g,function(match0,match1,match2){return"<"+match1+match2.toLowerCase();});var myRegexp=/<[^>]+((\s+\w+\s*=\s*)([^"'][\w~@+$,%\/:.#?=&;!*()-]*))[^>]*?>/;while(myRegexp.test(html)){html=html.replace(myRegexp,function(str,val1,val2,val3){var tamponRegex=new RegExp(regexpEscape(val1));return str.replace(tamponRegex,val2+'"'+val3+'"');})}
|
||||
while(/(<[^>]+style=(["'])[^>]+[\s:]+)0(pt|px)(\2|\s|;)/.test(html)){html=html.replace(/(<[^>]+style=(["'])[^>]+[\s:]+)0(pt|px)(\2|\s|;)/gi,"$1"+"0$4");}
|
||||
html=html.replace(/\r\n/g,"\n");pattern_pre=/<pre>[\s\S]*<\/pre>/gi;if(!pattern_pre.test(html)){html=html.replace(/^\s+/gm,'');html=html.replace(/\s+$/gm,'');}
|
||||
return html;};jsToolBar.prototype.validBlockquote=function(){var blockElts=['address','blockquote','dl','div','fieldset','form','h1','h2','h3','h4','h5','h6','hr','ol','p','pre','table','ul'];var BQs=this.iwin.document.getElementsByTagName('blockquote');var bqChilds;for(var bq=0;bq<BQs.length;bq++){bqChilds=BQs[bq].childNodes;var frag=this.iwin.document.createDocumentFragment();for(var i=(bqChilds.length-1);i>=0;i--){if(bqChilds[i].nodeType==1&&arrayIndexOf(blockElts,bqChilds[i].tagName.toLowerCase())>=0)
|
||||
{if(frag.childNodes.length>0){var p=this.iwin.document.createElement('p');p.appendChild(frag);BQs[bq].replaceChild(p,bqChilds[i+1]);frag=this.iwin.document.createDocumentFragment();}}else{if(frag.childNodes.length>0)BQs[bq].removeChild(bqChilds[i+1]);frag.insertBefore(bqChilds[i].cloneNode(true),frag.firstChild);}}
|
||||
if(frag.childNodes.length>0){var p=this.iwin.document.createElement('p');p.appendChild(frag);BQs[bq].replaceChild(p,bqChilds[0]);}}};jsToolBar.prototype.removeFormatRegexp=new Array([/(<[a-z][^>]*)margin\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)margin-bottom\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)margin-left\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)margin-right\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)margin-top\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)padding\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)padding-bottom\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)padding-left\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)padding-right\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)padding-top\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font-family\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font-size\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font-style\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font-variant\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)font-weight\s*:[^;]*;/mg,"$1"],[/(<[a-z][^>]*)color\s*:[^;]*;/mg,"$1"]);jsToolBar.prototype.removeTextFormating=function(html){for(var reg in this.removeFormatRegexp){html=html.replace(this.removeFormatRegexp[reg][0],this.removeFormatRegexp[reg][1]);}
|
||||
html=this.tagsoup2xhtml(html);html=html.replace(/style="\s*?"/mgi,'');return html;};jsToolBar.prototype.elements.blocks.wysiwyg={list:['none','p','h1','h2','h3','h4','h5','h6'],fn:function(opt){if(opt=='none'){var blockLevel=this.getBlockLevel();if(blockLevel!==null){this.replaceNodeByContent(blockLevel);}
|
||||
this.iwin.focus();}else{try{this.iwin.document.execCommand('formatblock',false,'<'+opt+'>');}catch(e){};this.iwin.focus();}}};jsToolBar.prototype.elements.strong.fn.wysiwyg=function(){this.iwin.document.execCommand('bold',false,null);this.iwin.focus();};jsToolBar.prototype.elements.em.fn.wysiwyg=function(){this.iwin.document.execCommand('italic',false,null);this.iwin.focus();};jsToolBar.prototype.elements.ins.fn.wysiwyg=function(){this.iwin.document.execCommand('underline',false,null);this.iwin.focus();};jsToolBar.prototype.elements.del.fn.wysiwyg=function(){this.iwin.document.execCommand('strikethrough',false,null);this.iwin.focus();};jsToolBar.prototype.elements.quote.fn.wysiwyg=function(){var n=this.getSelectedNode();var q=this.iwin.document.createElement('q');q.appendChild(n);this.insertNode(q);};jsToolBar.prototype.elements.code.fn.wysiwyg=function(){var n=this.getSelectedNode();var code=this.iwin.document.createElement('code');code.appendChild(n);this.insertNode(code);};jsToolBar.prototype.elements.br.fn.wysiwyg=function(){var n=this.iwin.document.createElement('br');this.insertNode(n);};jsToolBar.prototype.elements.blockquote.fn.wysiwyg=function(){var n=this.getSelectedNode();var q=this.iwin.document.createElement('blockquote');q.appendChild(n);this.insertNode(q);};jsToolBar.prototype.elements.pre.fn.wysiwyg=function(){this.iwin.document.execCommand('formatblock',false,'<pre>');this.iwin.focus();};jsToolBar.prototype.elements.ul.fn.wysiwyg=function(){this.iwin.document.execCommand('insertunorderedlist',false,null);this.iwin.focus();};jsToolBar.prototype.elements.ol.fn.wysiwyg=function(){this.iwin.document.execCommand('insertorderedlist',false,null);this.iwin.focus();};jsToolBar.prototype.elements.link.fn.wysiwyg=function(){var href,hreflang;var range,commonAncestorContainer;if(this.iwin.getSelection){var selection=this.iwin.getSelection();range=selection.getRangeAt(0);commonAncestorContainer=range.commonAncestorContainer;while(commonAncestorContainer.nodeType!=1){commonAncestorContainer=commonAncestorContainer.parentNode;}}else{range=this.iwin.document.selection.createRange();commonAncestorContainer=range.parentElement();}
|
||||
var ancestorTagName=commonAncestorContainer.tagName.toLowerCase();while(ancestorTagName!='a'&&ancestorTagName!='body'){commonAncestorContainer=commonAncestorContainer.parentNode;ancestorTagName=commonAncestorContainer.tagName.toLowerCase();}
|
||||
if(ancestorTagName=='a'){href=commonAncestorContainer.href||'';hreflang=commonAncestorContainer.hreflang||'';}
|
||||
href=window.prompt(this.elements.link.href_prompt,href);if(ancestorTagName=='a'&&href==''){this.replaceNodeByContent(commonAncestorContainer);}
|
||||
if(!href)return;hreflang=window.prompt(this.elements.link.hreflang_prompt,hreflang);if(ancestorTagName=='a'&&href){commonAncestorContainer.setAttribute('href',href);if(hreflang){commonAncestorContainer.setAttribute('hreflang',hreflang);}else{commonAncestorContainer.removeAttribute('hreflang');}
|
||||
return;}
|
||||
var n=this.getSelectedNode();var a=this.iwin.document.createElement('a');a.href=href;if(hreflang)a.setAttribute('hreflang',hreflang);a.appendChild(n);this.insertNode(a);};jsToolBar.prototype.elements.removeFormat={type:'button',title:'Remove text formating',fn:{}};jsToolBar.prototype.elements.removeFormat.disabled=!jsToolBar.prototype.can_wwg;jsToolBar.prototype.elements.removeFormat.fn.xhtml=function(){var html=this.textarea.value;html=this.removeTextFormating(html);this.textarea.value=html;};jsToolBar.prototype.elements.removeFormat.fn.wysiwyg=function(){var html=this.iwin.document.body.innerHTML;html=this.removeTextFormating(html);this.iwin.document.body.innerHTML=html;};function arrayIndexOf(aArray,aValue){if(typeof Array.indexOf=='function'){return aArray.indexOf(aValue);}else{var index=-1;var l=aArray.length;for(var i=0;i<l;i++){if(aArray[i]===aValue){index=i;break;}}
|
||||
return index;}};function addEvent(obj,evType,fn,useCapture){if(obj.addEventListener){obj.addEventListener(evType,fn,useCapture);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}};function removeEvent(obj,evType,fn,useCapture){if(obj.removeEventListener){obj.removeEventListener(evType,fn,useCapture);return true;}else if(obj.detachEvent){var r=obj.detachEvent("on"+evType,fn);return r;}else{return false;}};function regexpEscape(s){return s.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1")};
|
||||
3
dotclear._no/admin/js/jsToolBar/popup_link.js
Executable file
3
dotclear._no/admin/js/jsToolBar/popup_link.js
Executable file
@ -0,0 +1,3 @@
|
||||
|
||||
$(function(){$('#link-insert-cancel').click(function(){window.close();});$('#link-insert-ok').click(function(){sendClose();window.close();});function sendClose(){var insert_form=$('#link-insert-form').get(0);if(insert_form==undefined){return;}
|
||||
var tb=window.opener.the_toolbar;var data=tb.elements.link.data;data.href=tb.stripBaseURL(insert_form.elements.href.value);data.title=insert_form.elements.title.value;data.hreflang=insert_form.elements.hreflang.value;tb.elements.link.fncall[tb.mode].call(tb);};});
|
||||
13
dotclear._no/admin/js/jsToolBar/popup_media.js
Normal file
13
dotclear._no/admin/js/jsToolBar/popup_media.js
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
$(function(){var toolBar=window.opener.the_toolbar.textarea;$('#media-insert').onetabload(function(){$('#media-insert-cancel').click(function(){window.close();});$('#media-insert-ok').click(function(){sendClose();window.close();});});function sendClose(){var insert_form=$('#media-insert-form').get(0);if(insert_form==undefined){return;}
|
||||
var tb=window.opener.the_toolbar;var type=insert_form.elements.type.value;var media_align_grid={left:'float: left; margin: 0 1em 1em 0;',right:'float: right; margin: 0 0 1em 1em;',center:'text-align: center;'};if(type=='image')
|
||||
{tb.elements.img_select.data.src=tb.stripBaseURL($('input[name="src"]:checked',insert_form).val());tb.elements.img_select.data.alignment=$('input[name="alignment"]:checked',insert_form).val();tb.elements.img_select.data.link=$('input[name="insertion"]:checked',insert_form).val()=='link';tb.elements.img_select.data.title=insert_form.elements.title.value;tb.elements.img_select.data.description=$('input[name="description"]',insert_form).val();tb.elements.img_select.data.url=tb.stripBaseURL(insert_form.elements.url.value);tb.elements.img_select.fncall[tb.mode].call(tb);}
|
||||
else if(type=='mp3')
|
||||
{var player=$('#public_player').val();var align=$('input[name="alignment"]:checked',insert_form).val();if(align!=undefined&&align!='none'){player='<div style="'+media_align_grid[align]+'">'+player+'</div>';}
|
||||
tb.elements.mp3_insert.data.player=player.replace(/>/g,'>\n');tb.elements.mp3_insert.fncall[tb.mode].call(tb);}
|
||||
else if(type=='flv')
|
||||
{var oplayer=$('<div>'+$('#public_player').val()+'</div>');var flashvars=$("[name=FlashVars]",oplayer).val();var align=$('input[name="alignment"]:checked',insert_form).val();var title=insert_form.elements.title.value;if(title){flashvars='title='+encodeURI(title)+'&'+flashvars;}
|
||||
$('object',oplayer).attr('width',$('#video_w').val());$('object',oplayer).attr('height',$('#video_h').val());flashvars=flashvars.replace(/(width=\d*)/,'width='+$('#video_w').val());flashvars=flashvars.replace(/(height=\d*)/,'height='+$('#video_h').val());$("[name=FlashVars]",oplayer).val(flashvars);var player=oplayer.html();if(align!=undefined&&align!='none'){player='<div style="'+media_align_grid[align]+'">'+player+'</div>';}
|
||||
tb.elements.flv_insert.data.player=player.replace(/>/g,'>\n');tb.elements.flv_insert.fncall[tb.mode].call(tb);}
|
||||
else
|
||||
{tb.elements.link.data.href=tb.stripBaseURL(insert_form.elements.url.value);tb.elements.link.data.content=insert_form.elements.title.value;tb.elements.link.fncall[tb.mode].call(tb);}};function playerFormat(s){s=s.replace(/</g,'<');s=s.replace(/>/g,'>\n');s=s.replace(/&/g,'&');return s;};});
|
||||
2
dotclear._no/admin/js/jsToolBar/popup_posts.js
Normal file
2
dotclear._no/admin/js/jsToolBar/popup_posts.js
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
$(function(){$('#link-insert-cancel').click(function(){window.close();});$('#form-entries tr>td.maximal>a').click(function(){var tb=window.opener.the_toolbar;var data=tb.elements.link.data;data.href=tb.stripBaseURL($(this).attr('title'));tb.elements.link.fncall[tb.mode].call(tb);window.close();});});
|
||||
Reference in New Issue
Block a user