Make WordPress Core

Changeset 18511


Ignore:
Timestamp:
08/05/2011 04:09:22 AM (15 years ago)
Author:
azaozz
Message:

Fix back-compat for quicktags, introduce QTags.addButton(), see #16695

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/edit-comments.dev.js

    r18499 r18511  
    550550
    551551        if ( typeof QTags != 'undefined' )
    552                 quicktags({quicktags_id: 'replycontent', quicktags_buttons: 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close'});
     552                quicktags({id: 'replycontent', buttons: 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close'});
    553553
    554554        if ( typeof $.table_hotkeys != 'undefined' ) {
  • trunk/wp-admin/js/edit-comments.js

    r18499 r18511  
    1 var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a('<tr id="undo-'+k+'" class="undo un'+p+'" style="display:none;"><td colspan="'+m+'">'+note+"</td></tr>")}else{q=a(".comment-author",l).text();r=a('<div id="undo-'+k+'" style="display:none;" class="undo un'+p+'">'+note+"</div>")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l<j){return}if(m){j=l}c.val(k.toString());a("span.total-type-count").each(function(){updateCount(a(this),k)})};dashboardTotals=function(q){var p=a("#dashboard_right_now"),l,o,m,k;q=q||0;if(isNaN(q)||!p.length){return}l=a("span.total-count",p);o=a("span.approved-count",p);m=getCount(l);m=m+q;k=m-getCount(a("span.pending-count",p))-getCount(a("span.spam-count",p));updateCount(l,m);updateCount(o,k)};getCount=function(k){var l=parseInt(k.html().replace(/[^0-9]+/g,""),10);if(isNaN(l)){return 0}return l};updateCount=function(l,m){var k="";if(isNaN(m)){return}m=m<1?"0":m.toString();if(m.length>3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&j<n.parsed.responses[0].supplemental.time){total_items_i18n=n.parsed.responses[0].supplemental.total_items_i18n||"";if(total_items_i18n){a(".displaying-num").text(total_items_i18n);a(".total-pages").text(n.parsed.responses[0].supplemental.total_pages_i18n);a(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",n.parsed.responses[0].supplemental.total_pages==a(".current-page").val())}d(q,n.parsed.responses[0].supplemental.time,true)}else{d(q,k,false)}}if(!theExtraList||theExtraList.size()==0||theExtraList.children().size()==0||u||m){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());b()};b=function(n){var l=a.query.get(),k=a(".total-pages").text(),m=a('input[name="_per_page"]',"#comments-form").val();if(!l.paged){l.paged=1}if(l.paged>k){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20<h){window.scroll(0,h-c+35)}else{if(o-20<p){window.scroll(0,o-35)}}a("#replycontent").focus().keyup(function(q){if(q.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .error").hide();a("#replysubmit .waiting").show();a("#replyrow input").not(":button").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;b.p=a('[name="p"]').val();if(a("#comment-"+a("#comment_ID").val()).hasClass("unapproved")){b.approve_parent=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(d){var f=this,g,i,h,e,b;f.revert();if(typeof(d)=="string"){f.error({responseText:d});return false}g=wpAjax.parseAjaxResponse(d);if(g.errors){f.error({responseText:wpAjax.broken});return false}g=g.responses[0];i=g.data;h="#comment-"+g.id;if("edit-comment"==f.act){a(h).remove()}if(g.supplemental.parent_approved){b=a("#comment-"+g.supplemental.parent_approved);updatePending(getCount(a("span.pending-count").eq(0))-1);if(this.comments_listing=="moderated"){b.animate({backgroundColor:"#CCEEBB"},400,function(){b.fadeOut()});return}}a(i).hide();a("#replyrow").after(i);h=a(h);f.addEvents(h);e=h.hasClass("unapproved")?"#FFFFE0":h.closest(".widefat").css("backgroundColor");h.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300,function(){if(b&&b.length){b.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}})},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({quicktags_id:"replycontent",quicktags_buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
     1var theList,theExtraList,toggleWithKeyboard=false,getCount,updateCount,updatePending,dashboardTotals;(function(a){setCommentsList=function(){var c,e,g,j=0,f,h,d,i,b;c=a('input[name="_total"]',"#comments-form");e=a('input[name="_per_page"]',"#comments-form");g=a('input[name="_page"]',"#comments-form");f=function(n,l){var p=a("#"+l.element),k,o,m;k=a("#replyrow");o=a("#comment_ID",k).val();m=a("#replybtn",k);if(p.is(".unapproved")){if(l.data.id==o){m.text(adminCommentsL10n.replyApprove)}p.find("div.comment_status").html("0")}else{if(l.data.id==o){m.text(adminCommentsL10n.reply)}p.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var q=a(this),s,r;s=q.html().replace(/[^0-9]+/g,"");s=parseInt(s,10);if(isNaN(s)){return}r=a("#"+l.element).is("."+l.dimClass)?1:-1;s=s+r;if(s<0){s=0}q.closest(".awaiting-mod")[0==s?"addClass":"removeClass"]("count-0");updateCount(q,s);dashboardTotals()})};h=function(o,s){var u=a(o.target).attr("class"),k,l,m,r,t,q,p=false;o.data._total=c.val()||0;o.data._per_page=e.val()||0;o.data._page=g.val()||0;o.data._url=document.location.href;o.data.comment_status=a('input[name="comment_status"]',"#comments-form").val();if(u.indexOf(":trash=1")!=-1){p="trash"}else{if(u.indexOf(":spam=1")!=-1){p="spam"}}if(p){k=u.replace(/.*?comment-([0-9]+).*/,"$1");l=a("#comment-"+k);note=a("#"+p+"-undo-holder").html();l.find(".check-column :checkbox").prop("checked",false);if(l.siblings("#replyrow").length&&commentReply.cid==k){commentReply.close()}if(l.is("tr")){m=l.children(":visible").length;q=a(".author strong",l).text();r=a('<tr id="undo-'+k+'" class="undo un'+p+'" style="display:none;"><td colspan="'+m+'">'+note+"</td></tr>")}else{q=a(".comment-author",l).text();r=a('<div id="undo-'+k+'" style="display:none;" class="undo un'+p+'">'+note+"</div>")}l.before(r);a("strong","#undo-"+k).text(q+" ");t=a(".undo a","#undo-"+k);t.attr("href","comment.php?action=un"+p+"comment&c="+k+"&_wpnonce="+o.data._ajax_nonce);t.attr("class","delete:the-comment-list:comment-"+k+"::un"+p+"=1 vim-z vim-destructive");a(".avatar",l).clone().prependTo("#undo-"+k+" ."+p+"-undo-inside");t.click(function(){s.wpList.del(this);a("#undo-"+k).css({backgroundColor:"#ceb"}).fadeOut(350,function(){a(this).remove();a("#comment-"+k).css("backgroundColor","").fadeIn(300,function(){a(this).show()})});return false})}return o};d=function(k,l,m){if(l<j){return}if(m){j=l}c.val(k.toString());a("span.total-type-count").each(function(){updateCount(a(this),k)})};dashboardTotals=function(q){var p=a("#dashboard_right_now"),l,o,m,k;q=q||0;if(isNaN(q)||!p.length){return}l=a("span.total-count",p);o=a("span.approved-count",p);m=getCount(l);m=m+q;k=m-getCount(a("span.pending-count",p))-getCount(a("span.spam-count",p));updateCount(l,m);updateCount(o,k)};getCount=function(k){var l=parseInt(k.html().replace(/[^0-9]+/g,""),10);if(isNaN(l)){return 0}return l};updateCount=function(l,m){var k="";if(isNaN(m)){return}m=m<1?"0":m.toString();if(m.length>3){while(m.length>3){k=thousandsSeparator+m.substr(m.length-3)+k;m=m.substr(0,m.length-3)}m=m+k}l.html(m)};updatePending=function(k){a("span.pending-count").each(function(){var l=a(this);if(k<0){k=0}l.closest(".awaiting-mod")[0==k?"addClass":"removeClass"]("count-0");updateCount(l,k);dashboardTotals()})};i=function(k,n){var q,o,u=a(n.target).parent().is("span.untrash"),m=a(n.target).parent().is("span.unspam"),t,s,l,p=a("#"+n.element).is(".unapproved");function v(r){if(a(n.target).parent().is("span."+r)){return 1}else{if(a("#"+n.element).is("."+r)){return -1}}return 0}t=v("spam");s=v("trash");if(u){s=-1}if(m){t=-1}l=getCount(a("span.pending-count").eq(0));if(a(n.target).parent().is("span.unapprove")||((u||m)&&p)){l=l+1}else{if(p){l=l-1}}updatePending(l);a("span.spam-count").each(function(){var r=a(this),w=getCount(r)+t;updateCount(r,w)});a("span.trash-count").each(function(){var r=a(this),w=getCount(r)+s;updateCount(r,w)});if(a("#dashboard_right_now").length){o=s?-1*s:0;dashboardTotals(o)}else{q=c.val()?parseInt(c.val(),10):0;q=q-t-s;if(q<0){q=0}if(("object"==typeof k)&&j<n.parsed.responses[0].supplemental.time){total_items_i18n=n.parsed.responses[0].supplemental.total_items_i18n||"";if(total_items_i18n){a(".displaying-num").text(total_items_i18n);a(".total-pages").text(n.parsed.responses[0].supplemental.total_pages_i18n);a(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",n.parsed.responses[0].supplemental.total_pages==a(".current-page").val())}d(q,n.parsed.responses[0].supplemental.time,true)}else{d(q,k,false)}}if(!theExtraList||theExtraList.size()==0||theExtraList.children().size()==0||u||m){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());b()};b=function(n){var l=a.query.get(),k=a(".total-pages").text(),m=a('input[name="_per_page"]',"#comments-form").val();if(!l.paged){l.paged=1}if(l.paged>k){return}if(n){theExtraList.empty();l.number=Math.min(8,m)}else{l.number=1;l.offset=Math.min(8,m)-1}l.no_placeholder=true;l.paged++;if(true===l.comment_type){l.comment_type=""}l=a.extend(l,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:a("#_ajax_fetch_list_nonce").val()});a.ajax({url:ajaxurl,global:false,dataType:"json",data:l,success:function(o){theExtraList.get(0).wpList.add(o.rows)}})};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:h,dimAfter:f,delAfter:i,addColor:"none"}).bind("wpListDelEnd",function(l,k){var m=k.element.replace(/[^0-9]+/g,"");if(k.target.className.indexOf(":trash=1")!=-1||k.target.className.indexOf(":spam=1")!=-1){a("#undo-"+m).fadeIn(300,function(){a(this).show()})}})};commentReply={cid:"",act:"",init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){var b;if(this.cid){b=a("#comment-"+this.cid);if(this.act=="edit-comment"){b.fadeIn(300,function(){b.show()}).css("backgroundColor","")}a("#replyrow").hide();a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("input","#edithead").val("");a(".error","#replysubmit").html("").hide();a(".waiting","#replysubmit").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}this.cid=""}},open:function(b,d,k){var m=this,e,f,i,g,j=a("#comment-"+b),l;m.close();m.cid=b;e=a("#replyrow");f=a("#inline-"+b);i=m.act=(k=="edit")?"edit-comment":"replyto-comment";a("#action",e).val(i);a("#comment_post_ID",e).val(d);a("#comment_ID",e).val(b);if(k=="edit"){a("#author",e).val(a("div.author",f).text());a("#author-email",e).val(a("div.author-email",f).text());a("#author-url",e).val(a("div.author-url",f).text());a("#status",e).val(a("div.comment_status",f).text());a("#replycontent",e).val(a("textarea.comment",f).val());a("#edithead, #savebtn",e).show();a("#replyhead, #replybtn",e).hide();g=j.height();if(g>220){if(a.browser.msie){a("#replycontainer, #replycontent",e).height(g-105)}else{a("#replycontainer",e).height(g-105)}}j.after(e).fadeOut("fast",function(){a("#replyrow").fadeIn(300,function(){a(this).show()})})}else{l=a("#replybtn",e);a("#edithead, #savebtn",e).hide();a("#replyhead, #replybtn",e).show();j.after(e);if(j.hasClass("unapproved")){l.text(adminCommentsL10n.replyApprove)}else{l.text(adminCommentsL10n.reply)}a("#replyrow").fadeIn(300,function(){a(this).show()})}setTimeout(function(){var o,h,p,c,n;o=a("#replyrow").offset().top;h=o+a("#replyrow").height();p=window.pageYOffset||document.documentElement.scrollTop;c=document.documentElement.clientHeight||self.innerHeight||0;n=p+c;if(n-20<h){window.scroll(0,h-c+35)}else{if(o-20<p){window.scroll(0,o-35)}}a("#replycontent").focus().keyup(function(q){if(q.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .error").hide();a("#replysubmit .waiting").show();a("#replyrow input").not(":button").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;b.p=a('[name="p"]').val();if(a("#comment-"+a("#comment_ID").val()).hasClass("unapproved")){b.approve_parent=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(d){var f=this,g,i,h,e,b;f.revert();if(typeof(d)=="string"){f.error({responseText:d});return false}g=wpAjax.parseAjaxResponse(d);if(g.errors){f.error({responseText:wpAjax.broken});return false}g=g.responses[0];i=g.data;h="#comment-"+g.id;if("edit-comment"==f.act){a(h).remove()}if(g.supplemental.parent_approved){b=a("#comment-"+g.supplemental.parent_approved);updatePending(getCount(a("span.pending-count").eq(0))-1);if(this.comments_listing=="moderated"){b.animate({backgroundColor:"#CCEEBB"},400,function(){b.fadeOut()});return}}a(i).hide();a("#replyrow").after(i);h=a(h);f.addEvents(h);e=h.hasClass("unapproved")?"#FFFFE0":h.closest(".widefat").css("backgroundColor");h.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300,function(){if(b&&b.length){b.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:e},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}})},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a(document).delegate("span.delete a.delete","click",function(){return false});if(typeof QTags!="undefined"){quicktags({id:"replycontent",buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close"})}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a(".tablenav-pages ."+f+"-page:not(.disabled)");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("input:checkbox","#cb").click().prop("checked",false);toggleWithKeyboard=false};d=function(f){return function(){var g=a('select[name="action"]');a('option[value="'+f+'"]',g).prop("selected",true);a("#doaction").click()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q","z",["e",b],["shift+x",c],["shift+a",d("approve")],["shift+s",d("spam")],["shift+d",d("delete")],["shift+t",d("trash")],["shift+z",d("untrash")],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
  • trunk/wp-includes/class-wp-editor.php

    r18498 r18511  
    2323        var $default_editor;
    2424        var $first_init;
    25         var $tinymce = false;
    26         var $quicktags = false;
     25        var $this_tinymce = false;
     26        var $this_quicktags = false;
    2727
    2828        function __construct() {
    … …  
    3030                $this->default_editor = $this->wp_default_editor();
    3131        }
    32        
     32
    3333        /**
    3434         * Outputs the HTML and enqueues the JavaScript for a single instance of the editor.
    35          *       
    36          * $param $content The initial content of the editor.
    37          * $param $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
    38          * $param $settings See below for description.
     35         *
     36         * @param $content The initial content of the editor.
     37         * @param $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
     38         * @param $settings See below for description.
    3939         */
    4040        function editor( $content, $editor_id, $settings = array() ) {
    … …  
    5353                ) );
    5454
    55                 $this->tinymce = !empty($set['tinymce']) && $this->can_richedit;
    56                 $this->quicktags = !empty($set['quicktags']);
     55                $this->this_tinymce = !empty($set['tinymce']) && $this->can_richedit;
     56                $this->this_quicktags = !empty($set['quicktags']);
    5757                $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
    5858                $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
    … …  
    6464                        $set['media_buttons'] = false;
    6565
    66                 if ( $this->can_richedit && $this->quicktags && $this->tinymce ) {
     66                if ( $this->can_richedit && $this->this_quicktags && $this->this_tinymce ) {
    6767                        $switch_class = 'html-active';
    6868
    … …  
    7777                        $buttons .= '<a id="' . $editor_id . '-tmce" class="hide-if-no-js wp-switch-editor switch-tmce" onclick="switchEditors.go(this);return false;">' . __('Visual') . "</a>\n";
    7878                }
    79                
     79
    8080                echo '<div id="wp-' . $editor_id . '-wrap" class="wp-editor-wrap ' . $switch_class . '">';
    8181
    … …  
    9090                                if ( !function_exists('media_buttons') )
    9191                                        include(ABSPATH . 'wp-admin/includes/media.php');
    92                                
     92
    9393                                echo '<div id="wp-' . $editor_id . '-media-buttons" class="hide-if-no-js wp-media-buttons">';
    9494                                do_action('media_buttons', $editor_id);
    … …  
    118118                $first_run = false;
    119119
    120                 if ( $this->quicktags ) {
     120                if ( $this->this_quicktags ) {
    121121                        $qtbuttons = apply_filters( 'quicktags_buttons', array(), $editor_id );
    122122                        $qtbuttons_disabled = apply_filters( 'quicktags_disabled_buttons', array(), $editor_id );
    123123
    124124                        $qtInit = array(
    125                                 'quicktags_id' => $editor_id,
    126                                 'quicktags_buttons' => implode($qtbuttons, ','),
    127                                 'quicktags_disabled_buttons' => implode($qtbuttons_disabled, ',')
     125                                'id' => $editor_id,
     126                                'buttons' => implode($qtbuttons, ','),
     127                                'disabled_buttons' => implode($qtbuttons_disabled, ',')
    128128                        );
    129129
    … …  
    133133                        $this->qt_settings[$editor_id] = $qtInit;
    134134                }
    135                        
    136                 if ( $this->tinymce ) {
     135
     136                if ( $this->this_tinymce ) {
    137137
    138138                        if ( empty($this->first_init) ) {
    … …  
    155155                                        */
    156156                                        $mce_external_plugins = apply_filters('mce_external_plugins', array());
    157                        
     157
    158158                                        $ext_plugins = '';
    159159                                        if ( ! empty($mce_external_plugins) ) {
    160                        
     160
    161161                                                /*
    162162                                                The following filter loads external language files for TinyMCE plugins.
    … …  
    169169                                                */
    170170                                                $mce_external_languages = apply_filters('mce_external_languages', array());
    171                        
     171
    172172                                                $loaded_langs = array();
    173173                                                $strings = '';
    174                        
     174
    175175                                                if ( ! empty($mce_external_languages) ) {
    176176                                                        foreach ( $mce_external_languages as $name => $path ) {
    … …  
    182182                                                        }
    183183                                                }
    184                        
     184
    185185                                                foreach ( $mce_external_plugins as $name => $url ) {
    186                        
     186
    187187                                                        if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
    188                        
     188
    189189                                                        $plugins[] = '-' . $name;
    190                        
     190
    191191                                                        $plugurl = dirname($url);
    192192                                                        $strings = $str1 = $str2 = '';
    … …  
    194194                                                                $path = str_replace( WP_CONTENT_URL, '', $plugurl );
    195195                                                                $path = WP_CONTENT_DIR . $path . '/langs/';
    196                        
     196
    197197                                                                if ( function_exists('realpath') )
    198198                                                                        $path = trailingslashit( realpath($path) );
    199                        
     199
    200200                                                                if ( @is_file($path . $mce_locale . '.js') )
    201201                                                                        $strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";
    202                        
     202
    203203                                                                if ( @is_file($path . $mce_locale . '_dlg.js') )
    204204                                                                        $strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";
    205                        
     205
    206206                                                                if ( 'en' != $mce_locale && empty($strings) ) {
    207207                                                                        if ( @is_file($path . 'en.js') ) {
    … …  
    209209                                                                                $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
    210210                                                                        }
    211                        
     211
    212212                                                                        if ( @is_file($path . 'en_dlg.js') ) {
    213213                                                                                $str2 = @file_get_contents($path . 'en_dlg.js');
    … …  
    215215                                                                        }
    216216                                                                }
    217                        
     217
    218218                                                                if ( ! empty($strings) )
    219219                                                                        $ext_plugins .= "\n" . $strings . "\n";
    220220                                                        }
    221                        
     221
    222222                                                        $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
    223223                                                        $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
    224        
     224
    225225                                                        $this->ext_plugins .= $ext_plugins;
    226226                                                }
    227227                                        }
    228                                        
     228
    229229                                        $plugins = array_unique( apply_filters('tiny_mce_plugins', $plugins) );
    230230
    … …  
    233233
    234234                                        $this->plugins = $plugins;
    235                                        
     235
    236236                                        /*
    237237                                        The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
    … …  
    289289                                                'plugins' => implode( ',', $plugins )
    290290                                        );
    291                                
     291
    292292                                        // load editor_style.css if the current theme supports it
    293293                                        if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
    … …  
    312312                                                $mce_css = '';
    313313                                        }
    314        
     314
    315315                                        $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
    316                                
     316
    317317                                        if ( ! empty($mce_css) )
    318318                                                $this->first_init['content_css'] = $mce_css;
    … …  
    352352                                'theme_advanced_buttons4' => implode($mce_buttons_4, ',')
    353353                        );
    354                        
     354
    355355                        if ( $first_run )
    356356                                $mceInit = array_merge($this->first_init, $mceInit);
    … …  
    368368                                $mceInit = apply_filters('tiny_mce_before_init', $mceInit, $editor_id);
    369369                        }
    370                
     370
    371371                        if ( empty($mceInit['theme_advanced_buttons3']) && !empty($mceInit['theme_advanced_buttons4']) ) {
    372372                                $mceInit['theme_advanced_buttons3'] = $mceInit['theme_advanced_buttons4'];
    … …  
    376376                        $this->mce_settings[$editor_id] = $mceInit;
    377377                        $first_run = false;
    378                 } // end if $this->tinymce
    379         }
    380        
     378                } // end if $this->this_tinymce
     379        }
     380
    381381        function _parse_init($init) {
    382382                $options = '';
    … …  
    396396                return '{' . trim( $options, ' ,' ) . '}';
    397397        }
    398        
     398
    399399        /**
    400400         * Find out which editor should be displayed by default.
    … …  
    420420                wp_enqueue_script('word-count');
    421421                wp_enqueue_script('wplink');
     422                wp_enqueue_script('editor');
    422423                wp_enqueue_style('editor-buttons');
    423                
     424
    424425                wp_enqueue_script('wpdialogs-popup');
    425426                wp_enqueue_style('wp-jquery-ui-dialog');
    426427
    427                 if ( $this->tinymce )
    428                         wp_enqueue_script('editor');
    429                 else
    430                         wp_enqueue_script('utils');
    431                
    432428                if ( in_array('wpfullscreen', $this->plugins, true) )
    433429                        wp_enqueue_script('wp-fullscreen');
    434430
    435                 if ( !is_admin() )
    436                         add_thickbox();
     431                add_thickbox();
    437432        }
    438433
    … …  
    448443                 */
    449444                $version = 'ver=' . $tinymce_version;
     445                $tmce_on = !empty($this->mce_settings);
    450446
    451447                if ( ! isset($concatenate_scripts) )
    … …  
    455451                        && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
    456452
    457                 if ( $this->tinymce && 'en' != $this->mce_locale )
     453                if ( $tmce_on && 'en' != $this->mce_locale )
    458454                        include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
    459455
    460456                $mceInit = $qtInit = '';
    461                 if ( !empty($this->mce_settings) ) {
     457                if ( $tmce_on ) {
    462458                        foreach ( $this->mce_settings as $editor_id => $init ) {
    463459                                $options = $this->_parse_init( $init );
    … …  
    504500<?php
    505501
    506                 if ( $this->tinymce ) {
     502                if ( $tmce_on ) {
    507503                        if ( $compressed )
    508504                                echo "<script type='text/javascript' src='$this->baseurl/wp-tinymce.php?c=1&amp;$version'></script>\n";
    … …  
    571567                                ed.execCommand('mceInsertContent', false, h);
    572568                        } else if ( typeof quicktags != 'undefined' ) {
    573                                 quicktags.insertContent(wpActiveEditor, h);
     569                                QTags.insertContent(wpActiveEditor, h);
    574570                        } else {
    575571                                jQuery('#'+wpActiveEditor).val( jQuery('#'+wpActiveEditor).val() + h );
    … …  
    583579                        echo "$this->ext_plugins\n";
    584580
    585                 if ( ! $compressed && $this->tinymce ) {
     581                if ( ! $compressed && $tmce_on ) {
    586582?>
    587583                (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
    … …  
    606602        function wp_fullscreen_html() {
    607603                global $content_width, $post;
    608        
     604
    609605                $width = isset($content_width) && 800 > $content_width ? $content_width : 800;
    610606                $width = $width + 10; // compensate for the padding
    … …  
    617613                        <div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
    618614                        <div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
    619        
     615
    620616                        <div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes">
    621617                                <a href="#" onclick="fullscreen.switchmode('tinymce');return false;"><?php _e('Visual'); ?></a>
    622618                                <a href="#" onclick="fullscreen.switchmode('html');return false;"><?php _e('HTML'); ?></a>
    623619                        </div></div>
    624        
     620
    625621                        <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
    626622        <?php
    627        
     623
    628624                $media_link_type = 'image';
    629625                if ( is_multisite() && ( ( ! $mu_media_buttons = get_site_option( 'mu_media_buttons' ) ) || empty( $mu_media_buttons['image'] ) ) )
    630626                        $media_link_type = 'media';
    631        
     627
    632628                $buttons = array(
    633629                        // format: title, onclick, show in both editors
    … …  
    646642                        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
    647643                );
    648        
     644
    649645                $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
    650        
     646
    651647                foreach ( $buttons as $button => $args ) {
    652648                        if ( 'separator' == $args ) { ?>
    … …  
    654650        <?php           continue;
    655651                        } ?>
    656        
     652
    657653                        <div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>>
    658654                        <a title="<?php echo $args['title']; ?>" onclick="<?php echo $args['onclick']; ?>return false;" class="mceButton mceButtonEnabled mce_<?php echo $button; ?>" href="#" id="wp_fs_<?php echo $button; ?>" role="button" aria-pressed="false">
    … …  
    662658        <?php
    663659                } ?>
    664        
     660
    665661                        </div></div>
    666        
     662
    667663                        <div id="wp-fullscreen-save">
    668664                                <span><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
    … …  
    670666                                <input type="button" class="button-primary" value="<?php echo $save; ?>" onclick="fullscreen.save();" />
    671667                        </div>
    672        
     668
    673669                        </div>
    674670                </div>
    675671        </div>
    676        
     672
    677673        <div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
    678674                <label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
    679675                <input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
    680        
     676
    681677                <div id="wp-fullscreen-container">
    682678                        <textarea id="wp_mce_fullscreen"></textarea>
    683679                </div>
    684        
     680
    685681                <div id="wp-fullscreen-status">
    686682                        <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
    … …  
    689685        </div>
    690686        </div>
    691        
     687
    692688        <div class="fullscreen-overlay" id="fullscreen-overlay"></div>
    693689        <div class="fullscreen-overlay fullscreen-fader fade-600" id="fullscreen-fader"></div>
    694690        <?php
    695691        }
    696        
     692
    697693        /**
    698694         * Performs post queries for internal linking.
    … …  
    706702                $pts = get_post_types( array( 'public' => true ), 'objects' );
    707703                $pt_names = array_keys( $pts );
    708        
     704
    709705                $query = array(
    710706                        'post_type' => $pt_names,
    … …  
    717713                        'posts_per_page' => 20,
    718714                );
    719        
     715
    720716                $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
    721        
     717
    722718                if ( isset( $args['s'] ) )
    723719                        $query['s'] = $args['s'];
    724        
     720
    725721                $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
    726        
     722
    727723                // Do main query.
    728724                $get_posts = new WP_Query;
    … …  
    731727                if ( ! $get_posts->post_count )
    732728                        return false;
    733        
     729
    734730                // Build results.
    735731                $results = array();
    … …  
    739735                        else
    740736                                $info = $pts[ $post->post_type ]->labels->singular_name;
    741        
     737
    742738                        $results[] = array(
    743739                                'ID' => $post->ID,
    … …  
    747743                        );
    748744                }
    749        
     745
    750746                return $results;
    751747        }
    752        
     748
    753749        /**
    754750         * Dialog for internal linking.
  • trunk/wp-includes/js/quicktags.dev.js

    r18497 r18511  
    77 * Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties:
    88 * settings = {
    9  *   quicktags_id: 'myid', // required
    10  *   buttons: '', // optional
    11  *   disabled_buttons: '' // optional
     9 *   id : 'my_id',          // the HTML ID of the textarea, required
     10 *   buttons: '',           // Comma separated list of the names of the default buttons to show. Optional.
     11 *                          // This overwrites buttons order and any buttons added by plugins.
     12 *                          // Current list of default button names: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close'
     13 *   disabled_buttons : ''  // Comma separated list of the names of the buttons to disable.
    1214 * }
    1315 *
    … …  
    2527// http://www.alexking.org/
    2628
    27 var QTags, edButtons, edButton;
    28 
     29var QTags, edButtons = [], edCanvas;
     30
     31/**
     32 * Initialize new instance of the Quicktags editor
     33 */
    2934function quicktags(settings) {
    3035        return new QTags(settings);
     36}
     37
     38/**
     39 * Inderts content at the caret in the active editor (textarea)
     40 *
     41 * Added for back compatibility
     42 * @see QTags.insertContent()
     43 */
     44function edInsertContent(bah, txt) {
     45        return QTags.insertContent(txt);
     46}
     47
     48/**
     49 * Adds a button to all instances of the editor
     50 *
     51 * Added for back compatibility
     52 * @see QTags.addButton()
     53 */
     54function edButton(id, display, tagStart, tagEnd, access, open) {
     55        return QTags.addButton( id, display, tagStart, tagEnd, open, access ); 
    3156}
    3257
    … …  
    110135        qt = QTags = function(settings) {
    111136                if ( typeof(settings) == 'string' )
    112                         settings = {quicktags_id: settings};
     137                        settings = {id: settings};
    113138                else if ( typeof(settings) != 'object' )
    114139                        return false;
    115140
    116141                var t = this,
    117                         id = settings.quicktags_id,
     142                        id = settings.id,
    118143                        buttons = {},
    119144                        theButtons = {},
    … …  
    121146                        name = 'qt_' + id,
    122147                        html = '',
    123                         i, tb, qb, btn, onclick;
     148                        i, tb, qb, btn, onclick, toolbar_id;
    124149
    125150                if ( !id || !canvas )
    … …  
    131156                // default buttons
    132157                for ( i in edButtons ) {
     158                        if ( !edButtons[i] )
     159                                continue;
     160
    133161                        buttons[edButtons[i].id] = edButtons[i];
    134162                }
    … …  
    142170                }
    143171
    144                 if ( settings.quicktags_buttons ) {
    145                         qb = settings.quicktags_buttons.split(',');
     172                if ( settings.buttons ) {
     173                        qb = settings.buttons.split(',');
    146174
    147175                        for ( i in qb ) {
    … …  
    154182                }
    155183
    156                 if ( settings.quicktags_disabled_buttons ) {
    157                         qb = settings.quicktags_disabled_buttons.split(',');
     184                if ( settings.disabled_buttons ) {
     185                        qb = settings.disabled_buttons.split(',');
    158186
    159187                        for ( i in qb ) {
    … …  
    167195                        html += theButtons[i].html(name + '_');
    168196
     197                if ( id == 'content' && !qt.instances[0] ) { // back compat hack :-(
     198                        edCanvas = canvas;
     199                        toolbar_id = 'ed_toolbar';
     200                } else {
     201                        toolbar_id = name + '_toolbar';
     202                }
     203
    169204                tb = document.createElement('div');
    170                 tb.id = name + '_toolbar';
     205                tb.id = toolbar_id;
    171206                tb.className = 'quicktags-toolbar';
    172207
    … …  
    198233                }
    199234
     235                if ( !qt.instances[0] )
     236                        qt.instances[0] = t;
     237
    200238                qt.instances[id] = t;
    201239        };
    … …  
    210248                return qt.instances[id];
    211249        };
    212 
    213         qt.insertContent = function(editor_id, content) {
    214                 var sel, startPos, endPos, scrollTop, text, ed = document.getElementById(editor_id);
     250       
     251        /**
     252         * Main API function for adding a button to Quicktags
     253         *
     254         * Adds qt.Button or qt.TagButton depending on the args. The first three args are always required.
     255         * For TagButton arg2 is also required. To be able to add button(s) to Quicktags, your script
     256         * should be enqueued as dependant on "quicktags" and outputted in the footer. If you are echoing JS
     257         * directly from PHP, use add_action( 'admin_print_footer_scripts', 'output_my_js', 100 ) or add_action( 'wp_footer', 'output_my_js', 100 )
     258         *
     259         * Minimun required to add a button that calls an external function:
     260         *     QTags.addButton( 'my_id', 'my button', my_callback );
     261         *     function my_callback() { alert('yeah!'); }
     262         *
     263         * Minimun required to add a button that inserts a tag:
     264         *     QTags.addButton( 'my_id', 'my button', '<span>', '</span>' );
     265         *
     266         * @param id string required button HTML ID
     267         * @param display string required button's value="..."
     268         * @param arg1 string || function required either a starting tag to be inserted like "<span>" or a callback that is executed when the button is pressed
     269         * @param arg2 string ending tag like "</span>"
     270         * @param arg3 int set to -1 if the inserted tag is self-closing
     271         * @param access string access key for the button
     272         * @param title string button's title="..."
     273         * @param priority int number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
     274         * @return bool TRUE on success FALSE on failure
     275         */                             
     276        qt.addButton = function( id, display, arg1, arg2, arg3, access, title, priority ) {
     277                var btn;
     278               
     279                if ( !id || !display )
     280                        return false;
     281
     282                if ( typeof(arg1) == 'function' ) {
     283                        btn = new qt.Button(id, display, access, title);
     284                        btn.callback = arg1;
     285                } else if ( typeof(arg1) == 'string' && arg1 && arg2 ) {
     286                        btn = new qt.TagButton(id, display, arg1, arg2, access, arg3, title);
     287                } else {
     288                        return false;
     289                }
     290
     291                if ( priority ) {
     292                        while ( typeof(edButtons[priority]) != 'undefined' ) {
     293                                priority++
     294                        }
     295
     296                        edButtons[priority] = btn;
     297                } else {
     298                        edButtons[edButtons.length] = btn;
     299                }
     300               
     301                return true;
     302        };
     303
     304        qt.insertContent = function(content) {
     305                var sel, startPos, endPos, scrollTop, text, ed = document.getElementById(wpActiveEditor);
     306
     307                if ( !ed )
     308                        return false;
    215309
    216310                if ( document.selection ) { //IE
    … …  
    235329                        ed.focus();
    236330                }
     331                return true;
    237332        };
    238333
    … …  
    469564
    470565        // ensure backward compatibility
    471         edButtons = [
    472                 new qt.TagButton('strong','b','<strong>','</strong>','b'),
    473                 new qt.TagButton('em','i','<em>','</em>','i'),
    474                 new qt.LinkButton(), // special case
    475                 new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q'),
    476                 new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>','d'),
    477                 new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>','s'),
    478                 new qt.ImgButton(), // special case
    479                 new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n','u'),
    480                 new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n','o'),
    481                 new qt.TagButton('li','li','\t<li>','</li>\n','l'),
    482                 new qt.TagButton('code','code','<code>','</code>','c'),
    483                 new qt.TagButton('more','more','<!--more-->','','t',-1),
    484                 new qt.SpellButton(),
    485                 new qt.CloseButton()
    486         ];
    487 
    488         edButton = qt.TagButton;
     566        edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b');
     567        edButtons[20] = new qt.TagButton('em','i','<em>','</em>','i'),
     568        edButtons[30] = new qt.LinkButton(), // special case
     569        edButtons[40] = new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q'),
     570        edButtons[50] = new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>','d'),
     571        edButtons[60] = new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>','s'),
     572        edButtons[70] = new qt.ImgButton(), // special case
     573        edButtons[80] = new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n','u'),
     574        edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n','o'),
     575        edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','l'),
     576        edButtons[110] = new qt.TagButton('code','code','<code>','</code>','c'),
     577        edButtons[120] = new qt.TagButton('more','more','<!--more-->','','t',-1),
     578        edButtons[130] = new qt.SpellButton(),
     579        edButtons[140] = new qt.CloseButton()
     580
    489581})();
  • trunk/wp-includes/js/quicktags.js

    r18497 r18511  
    1 var QTags,edButtons,edButton;function quicktags(a){return new QTags(a)}(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(j){if(typeof(j)=="string"){j={quicktags_id:j}}else{if(typeof(j)!="object"){return false}}var r=this,f=j.quicktags_id,p={},o={},h=document.getElementById(f),e="qt_"+f,n="",m,k,l,g,q;if(!f||!h){return false}r.name=e;r.id=f;for(m in edButtons){p[edButtons[m].id]=edButtons[m]}if(f=="content"&&adminpage&&(adminpage=="post-new-php"||adminpage=="post-php")){p.fullscreen=new d.FullscreenButton()}for(m in r._customButtons){p[m]=new r._customButtons[m]()}if(j.quicktags_buttons){l=j.quicktags_buttons.split(",");for(m in l){g=l[m];if(p[g]){o[g]=p[g]}}}else{o=p}if(j.quicktags_disabled_buttons){l=j.quicktags_disabled_buttons.split(",");for(m in l){g=l[m];if(o[g]){delete (o[g])}}}for(m in o){n+=o[m].html(e+"_")}k=document.createElement("div");k.id=e+"_toolbar";k.className="quicktags-toolbar";h.parentNode.insertBefore(k,h);k.innerHTML=n;r.toolbar=k;q=function(u){u=u||window.event;var t=u.target||u.srcElement,s;if(/\s+ed_button\s+/.test(" "+t.className+" ")){r.canvas=h=document.getElementById(f);s=t.id.replace(e+"_","");if(o[s]){o[s].callback.call(o[s],t,h,r)}}};if(k.addEventListener){k.addEventListener("click",q,false)}else{if(k.attachEvent){k.attachEvent("onclick",q)}}d.instances[f]=r};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d.insertContent=function(l,h){var i,g,f,j,k,e=document.getElementById(l);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()}}};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(e){};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(o,j,q){var u=this,p,f,m,h,s,k,e,n,g;s=j.value;if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){g.text=u.tagStart+g.text+u.tagEnd}else{if(u.isOpen(q)===false||u.tagEnd===""){g.text=u.tagStart;u.openTag(o,q)}else{g.text=u.tagEnd;u.closeTag(o,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){p=j.selectionStart;f=j.selectionEnd;m=f;h=j.scrollTop;k=s.substring(0,p);e=s.substring(f,s.length);n=s.substring(p,f);if(p!=f){j.value=k+u.tagStart+n+u.tagEnd+e;if(u.tagEnd===""){m=p}m+=u.tagStart.length+u.tagEnd.length}else{if(u.isOpen(q)===false||u.tagEnd===""){j.value=k+u.tagStart+e;u.openTag(o,q);m=p+u.tagStart.length}else{j.value=k+u.tagEnd+e;m=p+u.tagEnd.length;u.closeTag(o,q)}}j.focus();j.selectionStart=m;j.selectionEnd=m;j.scrollTop=h}else{if(u.isOpen(q)!==false||u.tagEnd===""){j.value+=u.tagStart;u.openTag(o,q)}else{j.value+=u.tagEnd;u.closeTag(o,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(h,g,i){var k="",j,f,e;if(document.selection){g.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(g.selectionStart||g.selectionStart=="0"){f=g.selectionStart;e=g.selectionEnd;if(f!=e){k=g.value.substring(f,e)}}}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.prototype.closeAllTags=function(){var e=this.getButton("close");e.callback.call(e,"",this.canvas,this.toolbar)};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=[new d.TagButton("strong","b","<strong>","</strong>","b"),new d.TagButton("em","i","<em>","</em>","i"),new d.LinkButton(),new d.TagButton("block","b-quote","\n\n<blockquote>","</blockquote>\n\n","q"),new d.TagButton("del","del",'<del datetime="'+a+'">',"</del>","d"),new d.TagButton("ins","ins",'<ins datetime="'+a+'">',"</ins>","s"),new d.ImgButton(),new d.TagButton("ul","ul","<ul>\n","</ul>\n\n","u"),new d.TagButton("ol","ol","<ol>\n","</ol>\n\n","o"),new d.TagButton("li","li","\t<li>","</li>\n","l"),new d.TagButton("code","code","<code>","</code>","c"),new d.TagButton("more","more","<!--more-->","","t",-1),new d.SpellButton(),new d.CloseButton()];edButton=d.TagButton})();
     1var 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)}(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 s=this,g=k.id,q={},p={},j=document.getElementById(g),e="qt_"+g,o="",n,l,m,h,r,f;if(!g||!j){return false}s.name=e;s.id=g;for(n in edButtons){if(!edButtons[n]){continue}q[edButtons[n].id]=edButtons[n]}if(g=="content"&&adminpage&&(adminpage=="post-new-php"||adminpage=="post-php")){q.fullscreen=new d.FullscreenButton()}for(n in s._customButtons){q[n]=new s._customButtons[n]()}if(k.buttons){m=k.buttons.split(",");for(n in m){h=m[n];if(q[h]){p[h]=q[h]}}}else{p=q}if(k.disabled_buttons){m=k.disabled_buttons.split(",");for(n in m){h=m[n];if(p[h]){delete (p[h])}}}for(n in p){o+=p[n].html(e+"_")}if(g=="content"&&!d.instances[0]){edCanvas=j;f="ed_toolbar"}else{f=e+"_toolbar"}l=document.createElement("div");l.id=f;l.className="quicktags-toolbar";j.parentNode.insertBefore(l,j);l.innerHTML=o;s.toolbar=l;r=function(v){v=v||window.event;var u=v.target||v.srcElement,t;if(/\s+ed_button\s+/.test(" "+u.className+" ")){s.canvas=j=document.getElementById(g);t=u.id.replace(e+"_","");if(p[t]){p[t].callback.call(p[t],u,j,s)}}};if(l.addEventListener){l.addEventListener("click",r,false)}else{if(l.attachEvent){l.attachEvent("onclick",r)}}if(!d.instances[0]){d.instances[0]=s}d.instances[g]=s};d.instances={};d.registerButton=function(f,e){b[f]=e};d.getInstance=function(e){return d.instances[e]};d.addButton=function(e,k,j,i,h,g,l,m){var f;if(!e||!k){return false}if(typeof(j)=="function"){f=new d.Button(e,k,g,l);f.callback=j}else{if(typeof(j)=="string"&&j&&i){f=new d.TagButton(e,k,j,i,g,h,l)}else{return false}}if(m){while(typeof(edButtons[m])!="undefined"){m++}edButtons[m]=f}else{edButtons[edButtons.length]=f}return true};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(e){};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(o,j,q){var u=this,p,f,m,h,s,k,e,n,g;s=j.value;if(document.selection){j.focus();g=document.selection.createRange();if(g.text.length>0){g.text=u.tagStart+g.text+u.tagEnd}else{if(u.isOpen(q)===false||u.tagEnd===""){g.text=u.tagStart;u.openTag(o,q)}else{g.text=u.tagEnd;u.closeTag(o,q)}}j.focus()}else{if(j.selectionStart||j.selectionStart=="0"){p=j.selectionStart;f=j.selectionEnd;m=f;h=j.scrollTop;k=s.substring(0,p);e=s.substring(f,s.length);n=s.substring(p,f);if(p!=f){j.value=k+u.tagStart+n+u.tagEnd+e;if(u.tagEnd===""){m=p}m+=u.tagStart.length+u.tagEnd.length}else{if(u.isOpen(q)===false||u.tagEnd===""){j.value=k+u.tagStart+e;u.openTag(o,q);m=p+u.tagStart.length}else{j.value=k+u.tagEnd+e;m=p+u.tagEnd.length;u.closeTag(o,q)}}j.focus();j.selectionStart=m;j.selectionEnd=m;j.scrollTop=h}else{if(u.isOpen(q)!==false||u.tagEnd===""){j.value+=u.tagStart;u.openTag(o,q)}else{j.value+=u.tagEnd;u.closeTag(o,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(h,g,i){var k="",j,f,e;if(document.selection){g.focus();j=document.selection.createRange();if(j.text.length>0){k=j.text}}else{if(g.selectionStart||g.selectionStart=="0"){f=g.selectionStart;e=g.selectionEnd;if(f!=e){k=g.value.substring(f,e)}}}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.prototype.closeAllTags=function(){var e=this.getButton("close");e.callback.call(e,"",this.canvas,this.toolbar)};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()})();
  • trunk/wp-includes/script-loader.php

    r18498 r18511  
    6969        $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1', 1 );
    7070
    71         $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110802', 1 );
     71        $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110804', 1 );
    7272        $scripts->add_script_data( 'quicktags', 'quicktagsL10n', array(
    7373                'wordLookup' => __('Enter a word to look up:'),
    … …  
    270270                $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429', 1 );
    271271
    272                 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110802', 1 );
     272                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110804', 1 );
    273273                $scripts->add_script_data( 'admin-comments', 'adminCommentsL10n', array(
    274274                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
Note: See TracChangeset for help on using the changeset viewer.