Index: trunk/wp-includes/js/quicktags.js
===================================================================
--- trunk/wp-includes/js/quicktags.js	(revision 18628)
+++ trunk/wp-includes/js/quicktags.js	(revision 18725)
@@ -1,1 +1,1 @@
-var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,d,a,"",-1)}var edAddTag=function(){},edCheckOpenTags=function(){},edCloseAllTags=function(){},edInsertImage=function(){},edInsertLink=function(){},edInsertTag=function(){},edLink=function(){},edQuickLink=function(){},edRemoveTag=function(){},edShowButton=function(){},edShowLinks=function(){},edSpell=function(){},edToolbar=function(){};(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f<g.funcs.length;f++){g.funcs[f]()}}};if(g.isReady){h()}else{g.funcs.push(h)}if(!g.eventAttached){if(document.addEventListener){e=function(){document.removeEventListener("DOMContentLoaded",e,false);g.ready()};document.addEventListener("DOMContentLoaded",e,false);window.addEventListener("load",g.ready,false)}else{if(document.attachEvent){e=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",e);g.ready()}};document.attachEvent("onreadystatechange",e);window.attachEvent("onload",g.ready);(function(){try{document.documentElement.doScroll("left")}catch(i){setTimeout(arguments.callee,50);return}g.ready()})()}}g.eventAttached=true}}},a=(function(){var e=new Date(),f;f=function(g){var h=g.toString();if(h.length<2){h="0"+h}return h};return e.getUTCFullYear()+"-"+f(e.getUTCMonth()+1)+"-"+f(e.getUTCDate())+"T"+f(e.getUTCHours())+":"+f(e.getUTCMinutes())+":"+f(e.getUTCSeconds())+"+00:00"})(),b={},d;d=QTags=function(k){if(typeof(k)=="string"){k={id:k}}else{if(typeof(k)!="object"){return false}}var j=this,l=k.id,i=document.getElementById(l),h="qt_"+l,e,g,f;if(!l||!i){return false}j.name=h;j.id=l;j.canvas=i;j.settings=k;if(l=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){edCanvas=i;f="ed_toolbar"}else{f=h+"_toolbar"}e=document.createElement("div");e.id=f;e.className="quicktags-toolbar";i.parentNode.insertBefore(e,i);j.toolbar=e;g=function(o){o=o||window.event;var n=o.target||o.srcElement,m;if(/\s+ed_button\s+/.test(" "+n.className+" ")){j.canvas=i=document.getElementById(l);m=n.id.replace(h+"_","");if(j.theButtons[m]){j.theButtons[m].callback.call(j.theButtons[m],n,i,j)}}};if(e.addEventListener){e.addEventListener("click",g,false)}else{if(e.attachEvent){e.attachEvent("onclick",g)}}j.getButton=function(m){return j.theButtons[m]};j.getButtonElement=function(m){return document.getElementById(h+"_"+m)};d.instances[l]=j;if(!d.instances[0]){d.instances[0]=d.instances[l];c(function(){d._buttonsInit()})}};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d._buttonsInit=function(){var q=this,p,h,e,j,o,n,m,f,l,k,g;for(f in q.instances){if(f==0){continue}p=q.instances[f];h=p.canvas;e=p.name;j=p.settings;m="";o={};n={};for(l in edButtons){if(!edButtons[l]){continue}o[edButtons[l].id]=edButtons[l]}if(f=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){o.fullscreen=new d.FullscreenButton()}for(l in q._customButtons){if(!o[l]){o[l]=new q._customButtons[l]()}}if(j.buttons){k=j.buttons.split(",");for(l in k){g=k[l];if(o[g]){n[g]=o[g]}}}else{n=o}if(j.disabled_buttons){k=j.disabled_buttons.split(",");for(l in k){g=k[l];if(n[g]){delete (n[g])}}}for(l in n){if(!n[l]||!n[l].html){continue}m+=n[l].html(e+"_")}p.toolbar.innerHTML=m;p.theButtons=n}q.buttonsInitDone=true};d.addButton=function(e,k,j,i,h,g,l,m){var f;if(!e||!k){return}m=m||0;if(typeof(j)=="function"){f=new d.Button(e,k,g,l);f.callback=j}else{if(j&&i&&typeof(j)=="string"){f=new d.TagButton(e,k,j,i,g,h,l)}else{return}}if(m==-1){return f}if(m>0){while(typeof(edButtons[m])!="undefined"){m++}edButtons[m]=f}else{edButtons[edButtons.length]=f}if(this.buttonsInitDone){this._buttonsInit()}};d.insertContent=function(h){var i,g,f,j,k,e=document.getElementById(wpActiveEditor);if(!e){return false}if(document.selection){e.focus();i=document.selection.createRange();i.text=h;e.focus()}else{if(e.selectionStart||e.selectionStart=="0"){k=e.value;g=e.selectionStart;f=e.selectionEnd;j=e.scrollTop;e.value=k.substring(0,g)+h+k.substring(f,k.length);e.focus();e.selectionStart=g+h.length;e.selectionEnd=g+h.length;e.scrollTop=j}else{e.value+=h;e.focus()}}return true};d.Button=function(i,g,e,h){var f=this;f.id=i;f.display=g;f.access=e;f.title=h||""};d.Button.prototype.html=function(f){var e=this.access?' accesskey="'+this.access+'"':"";return'<input type="button" id="'+f+this.id+'"'+e+' class="ed_button" title="'+this.title+'" value="'+this.display+'" />'};d.Button.prototype.callback=function(){};d.TagButton=function(l,j,g,f,e,h,k){var i=this;d.Button.call(i,l,j,e,k);i.tagStart=g;i.tagEnd=f;i.open=h};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g<e.openTags.length){f=e.openTags[g]==h.id?g:false;g++}}else{f=false}return f};d.TagButton.prototype.callback=function(p,j,q){var w=this,s,f,n,h,u=j.value,k,e,o,g,m=u?w.tagEnd:"";if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){g.text=w.tagStart+g.text+m}else{if(w.isOpen(q)===false||w.tagEnd===""){g.text=w.tagStart;w.openTag(p,q)}else{g.text=m;w.closeTag(p,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){s=j.selectionStart;f=j.selectionEnd;n=f;h=j.scrollTop;k=u.substring(0,s);e=u.substring(f,u.length);o=u.substring(s,f);if(s!=f){j.value=k+w.tagStart+o+m+e;if(m===""){n=s}n+=w.tagStart.length+m.length}else{if(w.isOpen(q)===false||w.tagEnd===""){j.value=k+w.tagStart+e;w.openTag(p,q);n=s+w.tagStart.length}else{j.value=k+m+e;n=s+m.length;w.closeTag(p,q)}}j.focus();j.selectionStart=n;j.selectionEnd=n;j.scrollTop=h}else{if(w.isOpen(q)!==false||w.tagEnd===""){j.value+=w.tagStart;w.openTag(p,q)}else{j.value+=m;w.closeTag(p,q)}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(i,h,e){var k="",j,g,f;if(document.selection){h.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(h.selectionStart||h.selectionStart=="0"){g=h.selectionStart;f=h.selectionEnd;if(g!=f){k=h.value.substring(g,f)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}};d.closeAllTags=function(g){var e=this.getInstance(g),f=e.getButton("close");f.callback.call(f,"",e.canvas,e)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","</a>","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='<a href="'+f+'">';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart='<img src="'+j+'" alt="'+h+'" />';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","<strong>","</strong>","b");edButtons[20]=new d.TagButton("em","i","<em>","</em>","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q"),edButtons[50]=new d.TagButton("del","del",'<del datetime="'+a+'">',"</del>","d"),edButtons[60]=new d.TagButton("ins","ins",'<ins datetime="'+a+'">',"</ins>","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","<ul>\n","</ul>\n\n","u"),edButtons[90]=new d.TagButton("ol","ol","<ol>\n","</ol>\n\n","o"),edButtons[100]=new d.TagButton("li","li","\t<li>","</li>\n","l"),edButtons[110]=new d.TagButton("code","code","<code>","</code>","c"),edButtons[120]=new d.TagButton("more","more","<!--more-->","","t",-1),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})();
+var QTags,edButtons=[],edCanvas;function quicktags(a){return new QTags(a)}function edInsertContent(b,a){return QTags.insertContent(a)}function edButton(f,e,c,b,a,d){return QTags.addButton(f,e,c,b,a,"",-1)}var edAddTag=function(){},edCheckOpenTags=function(){},edCloseAllTags=function(){},edInsertImage=function(){},edInsertLink=function(){},edInsertTag=function(){},edLink=function(){},edQuickLink=function(){},edRemoveTag=function(){},edShowButton=function(){},edShowLinks=function(){},edSpell=function(){},edToolbar=function(){};(function(){var c=function(h){var g,f,e;if(typeof jQuery!="undefined"){jQuery(document).ready(h)}else{g=c;g.funcs=[];g.ready=function(){if(!g.isReady){g.isReady=true;for(f=0;f<g.funcs.length;f++){g.funcs[f]()}}};if(g.isReady){h()}else{g.funcs.push(h)}if(!g.eventAttached){if(document.addEventListener){e=function(){document.removeEventListener("DOMContentLoaded",e,false);g.ready()};document.addEventListener("DOMContentLoaded",e,false);window.addEventListener("load",g.ready,false)}else{if(document.attachEvent){e=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",e);g.ready()}};document.attachEvent("onreadystatechange",e);window.attachEvent("onload",g.ready);(function(){try{document.documentElement.doScroll("left")}catch(i){setTimeout(arguments.callee,50);return}g.ready()})()}}g.eventAttached=true}}},a=(function(){var e=new Date(),f;f=function(g){var h=g.toString();if(h.length<2){h="0"+h}return h};return e.getUTCFullYear()+"-"+f(e.getUTCMonth()+1)+"-"+f(e.getUTCDate())+"T"+f(e.getUTCHours())+":"+f(e.getUTCMinutes())+":"+f(e.getUTCSeconds())+"+00:00"})(),b={},d;d=QTags=function(k){if(typeof(k)=="string"){k={id:k}}else{if(typeof(k)!="object"){return false}}var j=this,l=k.id,i=document.getElementById(l),h="qt_"+l,e,g,f;if(!l||!i){return false}j.name=h;j.id=l;j.canvas=i;j.settings=k;if(l=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){edCanvas=i;f="ed_toolbar"}else{f=h+"_toolbar"}e=document.createElement("div");e.id=f;e.className="quicktags-toolbar";i.parentNode.insertBefore(e,i);j.toolbar=e;g=function(o){o=o||window.event;var n=o.target||o.srcElement,m;if(/\s+ed_button\s+/.test(" "+n.className+" ")){j.canvas=i=document.getElementById(l);m=n.id.replace(h+"_","");if(j.theButtons[m]){j.theButtons[m].callback.call(j.theButtons[m],n,i,j)}}};if(e.addEventListener){e.addEventListener("click",g,false)}else{if(e.attachEvent){e.attachEvent("onclick",g)}}j.getButton=function(m){return j.theButtons[m]};j.getButtonElement=function(m){return document.getElementById(h+"_"+m)};d.instances[l]=j;if(!d.instances[0]){d.instances[0]=d.instances[l];c(function(){d._buttonsInit()})}};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d._buttonsInit=function(){var q=this,p,h,e,j,o,n,m,f,l,k,g;for(f in q.instances){if(f==0){continue}p=q.instances[f];h=p.canvas;e=p.name;j=p.settings;m="";o={};n={};for(l in edButtons){if(!edButtons[l]){continue}o[edButtons[l].id]=edButtons[l]}if(f=="content"&&typeof(adminpage)=="string"&&(adminpage=="post-new-php"||adminpage=="post-php")){o.fullscreen=new d.FullscreenButton()}for(l in q._customButtons){if(!o[l]){o[l]=new q._customButtons[l]()}}if(j.buttons){k=j.buttons.split(",");for(l in k){g=k[l];if(o[g]){n[g]=o[g]}}}else{n=o}if(j.disabled_buttons){k=j.disabled_buttons.split(",");for(l in k){g=k[l];if(n[g]){delete (n[g])}}}for(l in n){if(!n[l]||!n[l].html){continue}m+=n[l].html(e+"_")}p.toolbar.innerHTML=m;p.theButtons=n}q.buttonsInitDone=true};d.addButton=function(l,j,f,e,i,k,h){var g;if(!l||!j){return}h=h||0;e=e||"";if(typeof(f)==="function"){g=new d.Button(l,j,i,k);g.callback=f}else{if(typeof(f)==="string"){g=new d.TagButton(l,j,f,e,i,k)}else{return}}if(h==-1){return g}if(h>0){while(typeof(edButtons[h])!="undefined"){h++}edButtons[h]=g}else{edButtons[edButtons.length]=g}if(this.buttonsInitDone){this._buttonsInit()}};d.insertContent=function(h){var i,g,f,j,k,e=document.getElementById(wpActiveEditor);if(!e){return false}if(document.selection){e.focus();i=document.selection.createRange();i.text=h;e.focus()}else{if(e.selectionStart||e.selectionStart=="0"){k=e.value;g=e.selectionStart;f=e.selectionEnd;j=e.scrollTop;e.value=k.substring(0,g)+h+k.substring(f,k.length);e.focus();e.selectionStart=g+h.length;e.selectionEnd=g+h.length;e.scrollTop=j}else{e.value+=h;e.focus()}}return true};d.Button=function(i,g,e,h){var f=this;f.id=i;f.display=g;f.access=e;f.title=h||""};d.Button.prototype.html=function(f){var e=this.access?' accesskey="'+this.access+'"':"";return'<input type="button" id="'+f+this.id+'"'+e+' class="ed_button" title="'+this.title+'" value="'+this.display+'" />'};d.Button.prototype.callback=function(){};d.TagButton=function(k,i,g,f,e,j){var h=this;d.Button.call(h,k,i,e,j);h.tagStart=g;h.tagEnd=f};d.TagButton.prototype=new d.Button();d.TagButton.prototype.openTag=function(h,f){var g=this;if(!f.openTags){f.openTags=[]}if(g.tagEnd){f.openTags.push(g.id);h.value="/"+h.value}};d.TagButton.prototype.closeTag=function(j,f){var h=this,g=h.isOpen(f);if(g!==false){f.openTags.splice(g,1)}j.value=h.display};d.TagButton.prototype.isOpen=function(e){var h=this,g=0,f=false;if(e.openTags){while(f===false&&g<e.openTags.length){f=e.openTags[g]==h.id?g:false;g++}}else{f=false}return f};d.TagButton.prototype.callback=function(p,j,q){var w=this,s,f,n,h,u=j.value,k,e,o,g,m=u?w.tagEnd:"";if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){if(!m){g.text=g.text+w.tagStart}else{g.text=w.tagStart+g.text+m}}else{if(!m){g.text=w.tagStart}else{if(w.isOpen(q)===false){g.text=w.tagStart;w.openTag(p,q)}else{g.text=m;w.closeTag(p,q)}}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){s=j.selectionStart;f=j.selectionEnd;n=f;h=j.scrollTop;k=u.substring(0,s);e=u.substring(f,u.length);o=u.substring(s,f);if(s!=f){if(!m){j.value=k+o+w.tagStart+e;n+=w.tagStart.length}else{j.value=k+w.tagStart+o+m+e;n+=w.tagStart.length+m.length}}else{if(!m){j.value=k+w.tagStart+e;n=s+w.tagStart.length}else{if(w.isOpen(q)===false){j.value=k+w.tagStart+e;w.openTag(p,q);n=s+w.tagStart.length}else{j.value=k+m+e;n=s+m.length;w.closeTag(p,q)}}}j.focus();j.selectionStart=n;j.selectionEnd=n;j.scrollTop=h}else{if(!m){j.value+=w.tagStart}else{if(w.isOpen(q)!==false){j.value+=w.tagStart;w.openTag(p,q)}else{j.value+=m;w.closeTag(p,q)}}j.focus()}}};d.SpellButton=function(){d.Button.call(this,"spell",quicktagsL10n.lookup,"",quicktagsL10n.dictionaryLookup)};d.SpellButton.prototype=new d.Button();d.SpellButton.prototype.callback=function(i,h,e){var k="",j,g,f;if(document.selection){h.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(h.selectionStart||h.selectionStart=="0"){g=h.selectionStart;f=h.selectionEnd;if(g!=f){k=h.value.substring(g,f)}}}if(k===""){k=prompt(quicktagsL10n.wordLookup,"")}if(k!==null&&/^\w[\w ]*$/.test(k)){window.open("http://www.answers.com/"+encodeURIComponent(k))}};d.CloseButton=function(){d.Button.call(this,"close",quicktagsL10n.closeTags,"",quicktagsL10n.closeAllOpenTags)};d.CloseButton.prototype=new d.Button();d.CloseButton.prototype.callback=function(j,k,f){var h,g,i=f.openTags;if(i){while(i.length>0){h=f.getButton(i[i.length-1]);g=document.getElementById(f.name+"_"+h.id);h.callback.call(h,g,k,f)}}else{f.canvas.focus()}};d.closeAllTags=function(g){var e=this.getInstance(g),f=e.getButton("close");f.callback.call(f,"",e.canvas,e)};d.LinkButton=function(){d.TagButton.call(this,"link","link","","</a>","a")};d.LinkButton.prototype=new d.TagButton();d.LinkButton.prototype.callback=function(j,k,h,g){var f,i=this;if(typeof(wpLink)!="undefined"){wpLink.open();return}if(!g){g="http://"}if(i.isOpen(h)===false){f=prompt(quicktagsL10n.enterURL,g);if(f){i.tagStart='<a href="'+f+'">';d.TagButton.prototype.callback.call(i,j,k,h)}}else{d.TagButton.prototype.callback.call(i,j,k,h)}};d.ImgButton=function(){d.TagButton.call(this,"img","img","","","m",-1)};d.ImgButton.prototype=new d.TagButton();d.ImgButton.prototype.callback=function(i,k,g,f){if(!f){f="http://"}var j=prompt(quicktagsL10n.enterImageURL,f),h;if(j){h=prompt(quicktagsL10n.enterImageDescription,"");this.tagStart='<img src="'+j+'" alt="'+h+'" />';d.TagButton.prototype.callback.call(this,i,k,g)}};d.FullscreenButton=function(){d.Button.call(this,"fullscreen",quicktagsL10n.fullscreen,"f",quicktagsL10n.toggleFullscreen)};d.FullscreenButton.prototype=new d.Button();d.FullscreenButton.prototype.callback=function(f,g){if(g.id!="content"||typeof(fullscreen)=="undefined"){return}fullscreen.on()};edButtons[10]=new d.TagButton("strong","b","<strong>","</strong>","b");edButtons[20]=new d.TagButton("em","i","<em>","</em>","i"),edButtons[30]=new d.LinkButton(),edButtons[40]=new d.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q"),edButtons[50]=new d.TagButton("del","del",'<del datetime="'+a+'">',"</del>","d"),edButtons[60]=new d.TagButton("ins","ins",'<ins datetime="'+a+'">',"</ins>","s"),edButtons[70]=new d.ImgButton(),edButtons[80]=new d.TagButton("ul","ul","<ul>\n","</ul>\n\n","u"),edButtons[90]=new d.TagButton("ol","ol","<ol>\n","</ol>\n\n","o"),edButtons[100]=new d.TagButton("li","li","\t<li>","</li>\n","l"),edButtons[110]=new d.TagButton("code","code","<code>","</code>","c"),edButtons[120]=new d.TagButton("more","more","<!--more-->","","t",-1),edButtons[130]=new d.SpellButton(),edButtons[140]=new d.CloseButton()})();
