text: jQuery(document).ready(function($){var t='<span class="saving-icon"><img src="images/wpspin_light.gif"/> saving...</span>',e='<span class="saved-icon"><div class="dashicons dashicons-yes"></div> saved!</span>';$("body, .list-item-content").on("keydown",".add-list-item",function(t){if(13==t.keyCode&&""!=$(this).val()){var e=$(this).closest(".postbox").attr("id"),o='<div class="list-item"><div class="dashicons dashicons-menu wpdn-note-sortable"></div><input type="checkbox"><span class="list-item-content" contenteditable="true">'+$(this).val()+'</span><div class="delete-item dashicons dashicons-no-alt"></div></div>';$("#"+e+" div.wp-dashboard-note").append(o),$(this).val(""),$(this).trigger("note-sortable"),$(this).trigger("wpdn-update",this)}}),$(document.body).on("click",".delete-item",function(){var t=$(this).closest(".postbox").attr("id");$(this).parent(".list-item").remove(),$(document.body).trigger("wpdn-update",["",t])}),$(document.body).on("click",".wpdn-visibility",function(){$(this).toggleClass("dashicons-admin-users dashicons-groups");var t=$(this).parent().attr("data-visibility");"public"==t?($(this).parent(".wpdn-toggle-visibility").attr("data-visibility","private"),$(this).parent(".wpdn-toggle-visibility").attr("title","Visibility: Just me")):($(this).parent(".wpdn-toggle-visibility").attr("data-visibility","public"),$(this).parent(".wpdn-toggle-visibility").attr("title","Visibility: Everyone")),$(this).trigger("wpdn-update",this)}),$(document.body).on("click",".wpdn-note-type",function(){$(this).toggleClass("dashicons-list-view dashicons-welcome-write-blog");var t=$(this).closest("[data-note-type]").attr("data-note-type");"regular"==t?$(this).closest("[data-note-type]").attr("data-note-type","list"):$(this).closest("[data-note-type]").attr("data-note-type","regular");var e={action:"wpdn_toggle_note",post_id:$(this).closest(".postbox").attr("id").replace("note_",""),note_type:"regular"==t?"list":"regular",nonce:wpdn.nonce};$.post(ajaxurl,e,function(t){$("#note_"+e.post_id+" .inside").html(t).trigger("note-sortable")}),$(this).trigger("wpdn-update",this)}),$(document.body).on("wpdn-update",function(o,n,i){if(""!=n&&(i=$(n).closest(".postbox").attr("id")),i){$("#"+i+" .hndle .status").html(t);var a={action:"wpdn_update_note",post_id:i.replace("note_",""),post_content:$("#"+i+" div.wp-dashboard-note").html(),post_title:$("#"+i+" > .hndle .wpdn-title").html(),note_visibility:$("#"+i+" [data-visibility]").attr("data-visibility"),note_color_text:$("#"+i+" [data-color-text]").attr("data-color-text"),note_color:$("#"+i+" [data-note-color]").attr("data-note-color"),note_type:$("#"+i+" [data-note-type]").attr("data-note-type"),nonce:wpdn.nonce};$.post(ajaxurl,a,function(t){$("#"+i+" .hndle .status").html(e),$("#"+i+" .hndle .status *").fadeOut(1e3,function(){$(this).html("")})})}}),$(document.body).on("click",".wpdn-delete-note",function(){var t=$(this).closest(".postbox").attr("id");$("#"+t).slideUp(500,function(){$(this).remove()});var e={action:"wpdn_delete_note",post_id:t.replace("note_",""),nonce:wpdn.nonce};$.post(ajaxurl,e)}),$(document.body).on("click",".wpdn-add-note, #wp-admin-bar-wpdn-add-note a",function(t){var e={action:"wpdn_add_note",nonce:wpdn.nonce};$.post(ajaxurl,e,function(t){t=jQuery.parseJSON(t),jQuery("#postbox-container-1 #normal-sortables").append(t.note),jQuery("body, html").animate({scrollTop:$("#note_"+t.post_id).offset().top-50},750),jQuery("#note_"+t.post_id+" .add-list-item").focus()}),$("html, body").bind("scroll mousedown DOMMouseScroll mousewheel keyup",function(t){(t.which>0||"mousedown"===t.type||"mousewheel"===t.type)&&$("html, body").stop().unbind("scroll mousedown DOMMouseScroll mousewheel keyup")}),t.preventDefault()}),$(document.body).on("click",".color",function(){var t=$(this).attr("data-select-color"),e=$(this).attr("data-select-color-text");$(this).closest(".postbox").css("background-color",t),$(this).closest(".wp-dashboard-note-wrap").attr("data-color-text",e),$(this).closest("[data-note-color]").attr("data-note-color",t),$(this).closest("[data-color-text]").attr("data-color-text",e),$(this).trigger("wpdn-update",this)}),$(document.body).on("blur",".list-item-content, [contenteditable=true]",function(){$(this).trigger("wpdn-update",this)}),$(document.body).on("keydown","[data-note-type=list], .wpdn-title, .list-item-content",function(t){return 13==t.keyCode?($(this).trigger("wpdn-update",this),$(this).blur(),!1):void 0}),$(document.body).on("keydown","[data-note-type=regular] .wp-dashboard-note",function(t){return 13==t.keyCode&&(t.ctrlKey||t.metaKey)?($(this).trigger("wpdn-update",this),$(this).blur(),!1):void 0}),$("body, .postbox .hndle").on("click",".wpdn-edit-title",function(t){$(this).prev().focus(),document.execCommand("selectAll",!1,null),t.stopPropagation()}),$("input[type=checkbox]").change(function(){this.checked?$(this).attr("checked","checked"):$(this).removeAttr("checked"),$(this).trigger("wpdn-update",this)}),$(document.body).on("note-sortable",function(){$(".wp-dashboard-note").sortable({handle:".wpdn-note-sortable",update:function(t,e){$(this).trigger("wpdn-update",this)},connectWith:[".wp-dashboard-note"],axis:"y"})}).trigger("note-sortable"),$(".wp-dashboard-note-wrap a").hover(function(){$(this).append('<span class="link-hover" contenteditable="false"><a href="'+$(this).attr("href")+'" target="_blank" contenteditable="false">Open link</a></span>')},function(){$(".link-hover").remove()}),$(document.body).on("paste","[contenteditable]",function(t){t.preventDefault();var e=(t.originalEvent||t).clipboardData.getData("text/plain");document.execCommand("insertText",!1,e)})});