2009-01-02 16:08:58 +01:00
|
|
|
(function(a){inlineEditPost={init:function(){var c=this,d=a("#inline-edit"),b=a("#bulk-edit");c.type=a("table.widefat").hasClass("page")?"page":"post";c.what="#"+c.type+"-";c.rows=a("tr.iedit");d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a("a.cancel",d).click(function(){return inlineEditPost.revert()});a("a.save",d).click(function(){return inlineEditPost.save(this)});a("input, select",d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a("a.cancel",b).click(function(){return inlineEditPost.revert()});a("#inline-edit .inline-edit-private input[value=private]").click(function(){var e=a("input.inline-edit-password-input");if(a(this).attr("checked")){e.val("").attr("disabled","disabled")}else{e.attr("disabled","")}});c.addEvents(c.rows);a("#bulk-title-div").parents("fieldset").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone());a("span.catshow").click(function(){a(".inline-editor ul.cat-checklist").addClass("cat-hover");a(".inline-editor span.cathide").show();a(this).hide()});a("span.cathide").click(function(){a(".inline-editor ul.cat-checklist").removeClass("cat-hover");a(".inline-editor span.catshow").show();a(this).hide()});a('select[name="_status"] option[value="future"]',b).remove();a("#doaction, #doaction2").click(function(f){var g=a(this).attr("id").substr(2);if(a('select[name="'+g+'"]').val()=="edit"){f.preventDefault();c.setBulk()}else{if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}}});a("#post-query-submit").click(function(f){if(a("form#posts-filter tr.inline-editor").length>0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},addEvents:function(b){b.each(function(){var c=a(this);a("a.editinline",c).click(function(){inlineEditPost.edit(this);return false})})},setBulk:function(){var c="",b=this.type;this.revert();a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length);a("table.widefat tbody").prepend(a("#bulk-edit"));a("#bulk-edit").addClass("inline-editor").show();a('tbody th.check-column input[type="checkbox"]').each(function(e){if(a(this).attr("checked")){var f=a(this).val(),d;d=a("#inline_"+f+" .post_title").text()||inlineEditL10n.notitle;c+='<div id="ttle'+f+'"><a id="_'+f+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+d+"</div>"}});a("#bulk-titles").html(c);a("#bulk-titles a").click(function(){var d=a(this).attr("id").substr(1);a('table.widefat input[value="'+d+'"]').attr("checked","");a("#ttle"+d).remove()});if(b=="post"){a('tr.inline-editor textarea[name="tags_input"]').suggest("admin-ajax.php?action=ajax-tag-search",{delay:500,minchars:2,multiple:true,multipleSep:", "})}},edit:function(b){var n=this,i,d,e,m,h,g,j;n.revert();if(typeof(b)=="object"){b=n.getId(b)}i=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password"];if(n.type=="page"){i.push("post_parent","menu_order","page_template")}if(n.type=="post"){i.push("tags_input")}d=a("#inline-edit").clone(true);a("td",d).attr("colspan",a(".widefat:first thead th:visible").length);if(a(n.what+b).hasClass("alternate")){a(d).addClass("alternate")}a(n.what+b).hide().after(d);e=a("#inline_"+b);for(j=0;j<i.length;j++){a(':input[name="'+i[j]+'"]',d).val(a("."+i[j],e).text())}if(a(".comment_status",e).text()=="open"){a('input[name="comment_status"]',d).attr("checked","checked")}if(a(".ping_status",e).text()=="open"){a('input[name="ping_status"]',d).attr("checked","checked")}if(a(".sticky",e).text()=="sticky"){a('input[name="sticky"]',d).attr("checked","checked")}if(m=a(".post_category",e).text()){a("ul.cat-checklist :checkbox",d).val(m.split(","))}h=a("._status",e).text();if(h!="future"){a('select[name="_status"] option[value="future"]',d).remove()}if(h=="private"){a('input[name="keep_private"]',d).attr("checked","checked");a("input.inline-edit-password-input").val("").attr("disabled","disabled")}
|