Version Description
Various bugs fixed
Download this release
Release Info
Developer | galdub |
Plugin | Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager |
Version | 2.6.1 |
Comparing to | |
See all releases |
Code changes from version 2.6 to 2.6.1
- assets/js/folders.js +25 -33
- assets/js/folders.min.js +1 -1
- assets/js/page-post-media.js +1 -11
- assets/js/page-post-media.min.js +1 -1
- folders.php +2 -2
- includes/class-affiliate.php +1 -1
- includes/folders.class.php +36 -2
- readme.txt +4 -1
- templates/admin/admin-content.php +6 -6
assets/js/folders.js
CHANGED
@@ -43,6 +43,8 @@
|
|
43 |
n_o_file = parseInt(wcp_settings.folders);
|
44 |
activeRecordID = parseInt(wcp_settings.selected_taxonomy);
|
45 |
|
|
|
|
|
46 |
initJSTree();
|
47 |
|
48 |
setCustomScrollForFolder();
|
@@ -99,10 +101,10 @@
|
|
99 |
$("#wcp-content").addClass("no-transition");
|
100 |
$("#wcp-content").removeClass("hide-folders-area");
|
101 |
if (wcp_settings.isRTL == "1") {
|
102 |
-
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
103 |
$("#wpcontent").css("padding-left", "0px");
|
104 |
} else {
|
105 |
-
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
106 |
}
|
107 |
setTimeout(function(){
|
108 |
$("#wcp-content").removeClass("no-transition");
|
@@ -148,10 +150,10 @@
|
|
148 |
$("#wcp-content").addClass("no-transition");
|
149 |
$("#wcp-content").removeClass("hide-folders-area");
|
150 |
if (wcp_settings.isRTL == "1") {
|
151 |
-
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
152 |
$("#wpcontent").css("padding-left", "0px");
|
153 |
} else {
|
154 |
-
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
155 |
}
|
156 |
setTimeout(function(){
|
157 |
$("#wcp-content").removeClass("no-transition");
|
@@ -287,10 +289,10 @@
|
|
287 |
$("#wcp-content").addClass("no-transition");
|
288 |
$("#wcp-content").removeClass("hide-folders-area");
|
289 |
if(wcp_settings.isRTL == "1") {
|
290 |
-
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
291 |
$("#wpcontent").css("padding-left", "0px");
|
292 |
} else {
|
293 |
-
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
294 |
}
|
295 |
setTimeout(function(){
|
296 |
$("#wcp-content").removeClass("no-transition");
|
@@ -654,17 +656,6 @@
|
|
654 |
if(folderCount > 0) {
|
655 |
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
656 |
}
|
657 |
-
|
658 |
-
var folderProperty = {
|
659 |
-
'folder_id': $(this).attr("id"),
|
660 |
-
'folder_count': folderCount,
|
661 |
-
'is_sticky': $(this).hasClass("is-sticky")?1:0,
|
662 |
-
'is_high': $(this).hasClass("is-high")?1:0,
|
663 |
-
'nonce': $(this).data("nonce"),
|
664 |
-
'slug': $(this).data("slug"),
|
665 |
-
'is_deleted': 0
|
666 |
-
};
|
667 |
-
folderPropertyArray.push(folderProperty);
|
668 |
});
|
669 |
|
670 |
if(activeRecordID != "" && activeRecordID != 0) {
|
@@ -738,21 +729,8 @@
|
|
738 |
$(".header-posts .total-count").text(res.total_items);
|
739 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
740 |
|
741 |
-
|
742 |
-
|
743 |
-
$("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
744 |
-
}
|
745 |
-
$("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
746 |
-
}
|
747 |
-
|
748 |
-
$("span.premio-folder-count").text("");
|
749 |
-
$(".folder-count").text("");
|
750 |
-
for (i = 0; i < res.taxonomies.length; i++) {
|
751 |
-
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
752 |
-
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
753 |
-
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
754 |
-
}
|
755 |
-
}
|
756 |
}
|
757 |
});
|
758 |
$(".folder-loader-ajax").addClass("active");
|
@@ -2017,6 +1995,14 @@
|
|
2017 |
}
|
2018 |
}
|
2019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020 |
if(activeRecordID != "") {
|
2021 |
$("#wcp_folder_"+activeRecordID).addClass("active-item");
|
2022 |
}
|
@@ -2102,12 +2088,15 @@
|
|
2102 |
data: "post_id=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + $(this).val() + "&nonce=" + wcp_settings.nonce +"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
2103 |
method: 'post',
|
2104 |
success: function (res) {
|
|
|
|
|
|
|
2105 |
resetMediaAndPosts();
|
2106 |
ajaxAnimation();
|
2107 |
}
|
2108 |
});
|
2109 |
} else {
|
2110 |
-
nonce =
|
2111 |
$.ajax({
|
2112 |
url: wcp_settings.ajax_url,
|
2113 |
data: "post_ids=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + $(this).val() + "&nonce=" + nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
@@ -2116,6 +2105,9 @@
|
|
2116 |
res = $.parseJSON(res);
|
2117 |
$("#bulk-move-folder").hide();
|
2118 |
if (res.status == "1") {
|
|
|
|
|
|
|
2119 |
resetMediaAndPosts();
|
2120 |
ajaxAnimation();
|
2121 |
} else {
|
43 |
n_o_file = parseInt(wcp_settings.folders);
|
44 |
activeRecordID = parseInt(wcp_settings.selected_taxonomy);
|
45 |
|
46 |
+
folderPropertyArray = wcp_settings.folder_settings;
|
47 |
+
|
48 |
initJSTree();
|
49 |
|
50 |
setCustomScrollForFolder();
|
101 |
$("#wcp-content").addClass("no-transition");
|
102 |
$("#wcp-content").removeClass("hide-folders-area");
|
103 |
if (wcp_settings.isRTL == "1") {
|
104 |
+
$("#wpcontent").css("padding-right", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
105 |
$("#wpcontent").css("padding-left", "0px");
|
106 |
} else {
|
107 |
+
$("#wpcontent").css("padding-left", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
108 |
}
|
109 |
setTimeout(function(){
|
110 |
$("#wcp-content").removeClass("no-transition");
|
150 |
$("#wcp-content").addClass("no-transition");
|
151 |
$("#wcp-content").removeClass("hide-folders-area");
|
152 |
if (wcp_settings.isRTL == "1") {
|
153 |
+
$("#wpcontent").css("padding-right", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
154 |
$("#wpcontent").css("padding-left", "0px");
|
155 |
} else {
|
156 |
+
$("#wpcontent").css("padding-left", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
157 |
}
|
158 |
setTimeout(function(){
|
159 |
$("#wcp-content").removeClass("no-transition");
|
289 |
$("#wcp-content").addClass("no-transition");
|
290 |
$("#wcp-content").removeClass("hide-folders-area");
|
291 |
if(wcp_settings.isRTL == "1") {
|
292 |
+
$("#wpcontent").css("padding-right", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
293 |
$("#wpcontent").css("padding-left", "0px");
|
294 |
} else {
|
295 |
+
$("#wpcontent").css("padding-left", (parseInt(wcp_settings.folder_width) + 20) + "px");
|
296 |
}
|
297 |
setTimeout(function(){
|
298 |
$("#wcp-content").removeClass("no-transition");
|
656 |
if(folderCount > 0) {
|
657 |
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
658 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
});
|
660 |
|
661 |
if(activeRecordID != "" && activeRecordID != 0) {
|
729 |
$(".header-posts .total-count").text(res.total_items);
|
730 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
731 |
|
732 |
+
foldersArray = res.taxonomies;
|
733 |
+
setFolderCountAndDD();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
735 |
});
|
736 |
$(".folder-loader-ajax").addClass("active");
|
1995 |
}
|
1996 |
}
|
1997 |
|
1998 |
+
if($(".media-select-folder").length) {
|
1999 |
+
$(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
2000 |
+
for (i = 0; i < foldersArray.length; i++) {
|
2001 |
+
$(".media-select-folder").append("<option value='" + foldersArray[i].term_id + "'>" + foldersArray[i].name + " (" + foldersArray[i].trash_count + ")</option>");
|
2002 |
+
}
|
2003 |
+
$(".media-select-folder").val("");
|
2004 |
+
}
|
2005 |
+
|
2006 |
if(activeRecordID != "") {
|
2007 |
$("#wcp_folder_"+activeRecordID).addClass("active-item");
|
2008 |
}
|
2088 |
data: "post_id=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + $(this).val() + "&nonce=" + wcp_settings.nonce +"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
2089 |
method: 'post',
|
2090 |
success: function (res) {
|
2091 |
+
if(fileFolderID != 0 && fileFolderID != $(".media-select-folder").val()) {
|
2092 |
+
$("ul.attachments li.selected").remove();
|
2093 |
+
}
|
2094 |
resetMediaAndPosts();
|
2095 |
ajaxAnimation();
|
2096 |
}
|
2097 |
});
|
2098 |
} else {
|
2099 |
+
nonce = getSettingForPost($(this).val(), 'nonce');
|
2100 |
$.ajax({
|
2101 |
url: wcp_settings.ajax_url,
|
2102 |
data: "post_ids=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + $(this).val() + "&nonce=" + nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
2105 |
res = $.parseJSON(res);
|
2106 |
$("#bulk-move-folder").hide();
|
2107 |
if (res.status == "1") {
|
2108 |
+
if(fileFolderID != 0 && fileFolderID != $(".media-select-folder").val()) {
|
2109 |
+
$("ul.attachments li.selected").remove();
|
2110 |
+
}
|
2111 |
resetMediaAndPosts();
|
2112 |
ajaxAnimation();
|
2113 |
} else {
|
assets/js/folders.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module!=="undefined"&&module.exports){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(D,n){var B="#js-tree-menu";var s;var b="";var o=false;var E=false;var h;var A;var x=0;var c=0;var U=0;var w=false;var p="";var v=[];var e=wcp_settings.page_url;var O=[];var r="<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'><div class='folder-item is-folder' data-id='__folder_id__'><a title='__folder_name__' id='folder_view___folder_id__'class='folder-view __append_class__ has-new-folder'data-id='__folder_id__'><span class='folder item-name'><span id='wcp_folder_text___folder_id__'class='folder-title'>__folder_name__</span></span></a></div></li>";D(document).ready(function(){O=wcp_settings.taxonomies;h=parseInt(wcp_settings.is_key_active);A=parseInt(wcp_settings.folders);b=parseInt(wcp_settings.selected_taxonomy);P();I();var V=(wcp_settings.isRTL=="1"||wcp_settings.isRTL==1)?"w":"e";D(".wcp-content").resizable({resizeHeight:false,handles:V,minWidth:100,maxWidth:500,resize:function(Y,X){var W=X.size.width;if(W<=275){D(".plugin-button").addClass("d-block")}else{D(".plugin-button").removeClass("d-block")}if(W<=225){W=225}if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right",(W+20)+"px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left",(W+20)+"px")}newWidth=W-40;cssString="";classString="";for(i=0;i<=15;i++){classString+=" .space > .jstree-node >";currentWidth=newWidth-(13+(20*i));cssString+="#js-tree-menu > "+classString+" .title { width: "+currentWidth+"px !important; } ";cssString+="#js-tree-menu > "+classString+" .dynamic-menu { left: "+(currentWidth-190)+"px !important; } ";L()}D("#wcp-custom-style").html("<style>"+cssString+"</style>");if(X.size.width<=185){folderStatus="hide";D(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active");D(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active");D("#wcp-content").addClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right","20px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left","20px")}}else{if(D("#wcp-content").hasClass("hide-folders-area")){folderStatus="show";D(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active");D(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active");D("#wcp-content").addClass("no-transition");D("#wcp-content").removeClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right",(wcp_settings.folder_width+20)+"px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left",(wcp_settings.folder_width+20)+"px")}setTimeout(function(){D("#wcp-content").removeClass("no-transition")},250)}}},stop:function(Y,X){var W=X.size.width;if(X.size.width<=275){D(".plugin-button").addClass("d-block")}else{D(".plugin-button").removeClass("d-block")}if(W<=225){W=225}if(X.size.width<=185){folderStatus="hide";D(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active");D(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active");D("#wcp-content").addClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right","20px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left","20px")}D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+folderStatus+"&nonce="+s,method:"post",success:function(Z){L()}})}else{if(D("#wcp-content").hasClass("hide-folders-area")){folderStatus="show";D(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active");D(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active");D("#wcp-content").addClass("no-transition");D("#wcp-content").removeClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right",(wcp_settings.folder_width+20)+"px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left",(wcp_settings.folder_width+20)+"px")}setTimeout(function(){D("#wcp-content").removeClass("no-transition")},250)}}s=wcp_settings.nonce;wcp_settings.folder_width=X.size.width;D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_post_width&width="+W+"&nonce="+s,method:"post",success:function(Z){L()}});if(X.size.width<=225){D(".wcp-content").width(225);wcp_settings.folder_width=225}}});D(document).on("contextmenu",".jstree-anchor",function(W){D(this).find("span.folder-inline-edit").trigger("click");return false});D(document).on("click",".folder-actions span.folder-inline-edit",function(W){W.stopImmediatePropagation();W.stopPropagation();if(wcp_settings.can_manage_folder==0){return}isHigh=D(this).closest("li.jstree-node").hasClass("is-high");isSticky=D(this).closest("li.jstree-node").hasClass("is-sticky");isStickyClass=(isSticky)?true:false;D(".dynamic-menu").remove();D(".active-menu").removeClass("active-menu");menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span> Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+((isHigh)?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";hasPosts=parseInt(D(this).closest("a.jstree-anchor").find(".premio-folder-count").text());if(wcp_settings.post_type=="attachment"&&hasPosts){menuHtml+="<li target='_blank' class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"}menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>";D(this).closest("a.jstree-anchor").after(menuHtml);D(this).parents("li.jstree-node").addClass("active-menu");if((D(this).offset().top+D(".dynamic-menu").height())>(D(window).height()-20)){D(".dynamic-menu").addClass("bottom-fix");if(D(".dynamic-menu.bottom-fix").offset().top<D("#custom-scroll-menu").offset().top){D(".dynamic-menu").removeClass("bottom-fix")}}});D(document).on("click",".sticky-folders .sticky-fldr > a",function(X){X.stopPropagation();var W=D(this).closest("li").data("folder-id");if(D(".jstree-node[id='"+W+"']").length){D(".jstree-clicked").removeClass("jstree-clicked");D(".active-item").removeClass("active-item");D("#js-tree-menu").jstree("select_node",b);D(".jstree-node[id='"+W+"'] > a.jstree-anchor").trigger("click");D(".jstree-node[id='"+W+"'] > a.jstree-anchor").addClass("jstree-clicked");D(".sticky-folders .sticky-folder-"+W+" a").addClass("active-item")}});D(document).on("contextmenu",".sticky-folders li .sticky-fldr > a",function(W){D(this).find("span.update-inline-record").trigger("click");return false});D(document).on("click",".update-inline-record",function(W){W.stopImmediatePropagation();W.stopPropagation();if(wcp_settings.can_manage_folder==0){return}isHigh=D(this).closest("li.sticky-fldr").hasClass("is-high");isSticky=D(this).closest("li.sticky-fldr").hasClass("is-sticky");isStickyClass=(isSticky)?true:false;D(".dynamic-menu").remove();D(".active-menu").removeClass("active-menu");menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+((isHigh)?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";hasPosts=parseInt(D(this).closest("li.jstree-node").find("h3.title:first > .total-count").text());if(wcp_settings.post_type=="attachment"&&hasPosts){menuHtml+="<li class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"}menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>";D(this).closest("li").append(menuHtml);if((D(this).offset().top+D(".dynamic-menu").height())>(D(window).height()-20)){D(".dynamic-menu").addClass("bottom-fix");if(D(".dynamic-menu.bottom-fix").offset().top<D("#custom-scroll-menu").offset().top){D(".dynamic-menu").removeClass("bottom-fix")}}});D(document).on("click",".dynamic-menu",function(W){W.stopImmediatePropagation();W.stopPropagation()});D(document).on("click","body, html",function(){D(".dynamic-menu").remove()});D(".wcp-hide-show-buttons .toggle-buttons").click(function(){var W="show";if(D(this).hasClass("hide-folders")){W="hide"}D(".wcp-hide-show-buttons .toggle-buttons").toggleClass("active");s=wcp_settings.nonce;if(W=="show"){D("#wcp-content").addClass("no-transition");D("#wcp-content").removeClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right",(wcp_settings.folder_width+20)+"px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left",(wcp_settings.folder_width+20)+"px")}setTimeout(function(){D("#wcp-content").removeClass("no-transition")},250)}else{D("#wcp-content").addClass("hide-folders-area");if(wcp_settings.isRTL=="1"){D("#wpcontent").css("padding-right","20px");D("#wpcontent").css("padding-left","0px")}else{D("#wpcontent").css("padding-left","20px")}}D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+W+"&nonce="+s,method:"post",success:function(X){L()}})});D(".jstree-anchor").livequery(function(){D(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(W,X){folderID=D(this).closest("li.jstree-node").attr("id");if(X.draggable.hasClass("wcp-move-multiple")){if(D(".wp-list-table input:checked").length){chkStr="";D(".wp-list-table input:checked").each(function(){chkStr+=D(this).val()+","});s=R(folderID,"nonce");D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Y=D.parseJSON(Y);if(Y.status=="1"){Q()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(Y.message);D("#error-folder-popup").show()}}})}}else{if(X.draggable.hasClass("wcp-move-file")){postID=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");chkStr=postID+",";D(".wp-list-table input:checked").each(function(){if(D(this).val()!=postID){chkStr+=D(this).val()+","}});D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Y=D.parseJSON(Y);if(Y.status=="1"){Q()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(Y.message);D("#error-folder-popup").show()}}})}else{if(X.draggable.hasClass("attachment")){chkStr=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");if(D(".attachments-browser li.attachment.selected").length>1){chkStr="";D(".attachments-browser li.attachment.selected").each(function(){chkStr+=D(this).data("id")+","})}p=chkStr;D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q()}})}}}}})});D(".un-categorised-items").livequery(function(){D(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(W,X){folderID=-1;s=wcp_settings.nonce;if(X.draggable.hasClass("wcp-move-multiple")){if(D(".wp-list-table input:checked").length){chkStr="";D(".wp-list-table input:checked").each(function(){chkStr+=D(this).val()+","});D.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q()}})}}else{if(X.draggable.hasClass("wcp-move-file")){postID=X.draggable[0].attributes["data-id"].nodeValue;chkStr=postID+",";D(".wp-list-table input:checked").each(function(){if(postID!=D(this).val()){chkStr+=D(this).val()+","}});D.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q()}})}else{if(X.draggable.hasClass("attachment")){chkStr=X.draggable[0].attributes["data-id"].nodeValue;if(D(".attachments-browser li.attachment.selected").length>1){chkStr="";D(".attachments-browser li.attachment.selected").each(function(){chkStr+=D(this).data("id")+","})}p=chkStr;D.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q()}})}}}}})});D(".attachments-browser li.attachment").livequery(function(){D(this).draggable({revert:"invalid",containment:"document",helper:function(W,X){D(".selected-items").remove();selectedItems=D(".attachments-browser li.attachment.selected").length;selectedItems=(selectedItems==0||selectedItems==1)?"1 Item":selectedItems+" Items";return D("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")},start:function(W,X){D("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(W,X){D(".selected-items").remove();D("body").removeClass("no-hover-css")}})});D(".tree-structure .folder-item").livequery(function(){D(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(W,X){D("body").removeClass("no-hover-css");folderID=D(this).data("id");if(X.draggable.hasClass("wcp-move-multiple")){s=R(folderID,"nonce");if(D(".wp-list-table input:checked").length){chkStr="";D(".wp-list-table input:checked").each(function(){chkStr+=D(this).val()+","});D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q();J()}})}}else{if(X.draggable.hasClass("wcp-move-file")){postID=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");chkStr=postID+",";D(".wp-list-table input:checked").each(function(){if(D(this).val()!=postID){chkStr+=D(this).val()+","}});D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q();J()}})}else{if(X.draggable.hasClass("attachment")){chkStr=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");if(D(".attachments-browser li.attachment.selected").length>1){chkStr="";D(".attachments-browser li.attachment.selected").each(function(){chkStr+=D(this).data("id")+","})}D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q();J()}})}}}}})});D(".sticky-folders li a").livequery(function(){D(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(W,X){folderID=D(this).closest("li").data("folder-id");if(X.draggable.hasClass("wcp-move-multiple")){if(D(".wp-list-table input:checked").length){chkStr="";D(".wp-list-table input:checked").each(function(){chkStr+=D(this).val()+","});s=R(folderID,"nonce");D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Y=D.parseJSON(Y);if(Y.status=="1"){Q();J()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(Y.message);D("#error-folder-popup").show()}}})}}else{if(X.draggable.hasClass("wcp-move-file")){postID=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");chkStr=postID+",";D(".wp-list-table input:checked").each(function(){if(D(this).val()!=postID){chkStr+=D(this).val()+","}});D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Y=D.parseJSON(Y);if(Y.status=="1"){Q();J()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(Y.message);D("#error-folder-popup").show()}}})}else{if(X.draggable.hasClass("attachment")){chkStr=X.draggable[0].attributes["data-id"].nodeValue;s=R(folderID,"nonce");if(D(".attachments-browser li.attachment.selected").length>1){chkStr="";D(".attachments-browser li.attachment.selected").each(function(){chkStr+=D(this).data("id")+","})}p=chkStr;D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(Y){Q();J()}})}}}}})})});function m(){D("#js-tree-menu .jstree-node").each(function(){var W=parseInt(D(this).data("count"));if(W>0){D(".jstree-node[id='"+D(this).attr("id")+"'] > a span.premio-folder-count").text(W)}var V={folder_id:D(this).attr("id"),folder_count:W,is_sticky:D(this).hasClass("is-sticky")?1:0,is_high:D(this).hasClass("is-high")?1:0,nonce:D(this).data("nonce"),slug:D(this).data("slug"),is_deleted:0};v.push(V)});if(b!=""&&b!=0){if(D(".jstree-node[id='"+b+"']").length){D("#js-tree-menu").jstree("select_node",b);if(D(".sticky-folders .sticky-folder-"+b+" a").length){D(".sticky-folders .sticky-folder-"+b+" a").addClass("active-item")}}}D(".ajax-preloader").hide();D(".js-tree-data").show();I();t();if(D(".sticky-folders ul > li").length>0){D(".sticky-folders").addClass("active")}S()}function R(V,W){if(v.length>0){for(i=0;i<v.length;i++){if(parseInt(v[i]["folder_id"])==parseInt(V)){return v[i][W]}}}return""}function q(V){if(v.length>0){for(i=0;i<v.length;i++){if(parseInt(v[i]["folder_id"])==parseInt(V)){return i}}}return null}function Q(){if(D(".media-toolbar").hasClass("media-toolbar-mode-select")){if(D("ul.attachments li.selected").length){D("ul.attachments li.selected").trigger("click");D(".select-mode-toggle-button").trigger("click")}}if(p!=""&&(D("#js-tree-menu a.jstree-clicked").length>0||b=="-1")){if(D("#media-attachment-taxonomy-filter").length){p=p.split(",");for(var V=0;V<p.length;V++){if(p[V]!=""){D(".attachments-browser li[data-id='"+p[V]+"']").remove()}}}p=""}if(D("#media-attachment-taxonomy-filter").length){y(0)}else{D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=get_folders_default_list",method:"post",success:function(W){W=D.parseJSON(W);D(".header-posts .total-count").text(W.total_items);D(".un-categorised-items .total-count").text(W.empty_items);for(V=0;V<W.taxonomies.length;V++){if(!D("#title_"+W.taxonomies[V].term_id+" .total-count").length){D("#title_"+W.taxonomies[V].term_id+" .star-icon").before("<span class='total-count'></span>")}D("#title_"+W.taxonomies[V].term_id+" .total-count").text(parseInt(W.taxonomies[V].trash_count))}D("span.premio-folder-count").text("");D(".folder-count").text("");for(V=0;V<W.taxonomies.length;V++){if(parseInt(W.taxonomies[V].trash_count)!=0){D(".jstree-node[id='"+W.taxonomies[V].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(W.taxonomies[V].trash_count);D(".sticky-folder-"+W.taxonomies[V].term_id+" .premio-folder-count").text(W.taxonomies[V].trash_count)}}}});D(".folder-loader-ajax").addClass("active");if(D("#folder-posts-filter").length){D("#folder-posts-filter").load(e+" #posts-filter",function(){var W={Title:"",Url:e};history.pushState(W,W.Title,W.Url);if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}S();G()})}else{D("#wpbody").load(e+" #wpbody-content",false,function(W){var X={Title:"",Url:e};history.pushState(X,X.Title,X.Url);if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}S()})}}}function G(){S();D(".form-loader-count").css("width","0");if(typeof inlineEditPost=="object"){inlineEditPost.init();D("#the-list").on("click",".editinline",function(){D(this).attr("aria-expanded","true");inlineEditPost.edit(this)});D(document).on("click",".inline-edit-save .save",function(){var V=D(this).closest("tr").attr("id");V=V.replace("edit-","");V=V.replace("post-","");inlineEditPost.save(V)});D(document).on("click",".inline-edit-save .cancel",function(){var V=D(this).closest("tr").attr("id");V=V.replace("edit-","");V=V.replace("post-","");inlineEditPost.revert(V)})}if(wcp_settings.post_type=="attachment"){if(!D(".move-to-folder-top").length){D("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>")}if(!D(".move-to-folder-bottom").length){D("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>")}}}function S(){if(v.length){D("li.jstree-node").each(function(){folderPostId=q(D(this).attr("id"));if(folderPostId!=null){if(v[folderPostId]["is_high"]==1){D(this).addClass("is-high")}else{D(this).removeClass("is-high")}if(v[folderPostId]["is_sticky"]==1){D(this).addClass("is-sticky")}else{D(this).removeClass("is-sticky")}}})}folderId=0;D(".tree-structure ul").html("");folderStatus=true;if(D(".jstree-clicked").length){folderID=D(".jstree-clicked").closest(".jstree-node").attr("id");if(D(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").length){folderStatus=false;D(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").each(function(){fID=D(this).attr("id");fName=D.trim(D("#js-tree-menu").jstree(true).get_node(fID).text);liHtml=r.replace(/__folder_id__/g,fID);liHtml=liHtml.replace(/__folder_name__/g,fName);selectedClass=D(this).hasClass("is-high")?"is-high":"";liHtml=liHtml.replace(/__append_class__/g,selectedClass);D(".tree-structure ul").append(liHtml)})}else{if(!D(".jstree-node[id='"+folderID+"']").closest("ul").hasClass("jstree-container-ul")){folderStatus=false}}}if(folderStatus){D("#js-tree-menu > ul > li.jstree-node").each(function(){fID=D(this).attr("id");fName=D.trim(D("#js-tree-menu").jstree(true).get_node(fID).text);liHtml=r.replace(/__folder_id__/g,fID);liHtml=liHtml.replace(/__folder_name__/g,fName);selectedClass=D(this).hasClass("is-high")?"is-high":"";liHtml=liHtml.replace(/__append_class__/g,selectedClass);D(".tree-structure ul").append(liHtml)})}a();if(wcp_settings.post_type=="attachment"){if(!D(".move-to-folder-top").length){D("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>")}if(!D(".move-to-folder-bottom").length){D("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>")}}D(".sticky-folders .active-item").removeClass("active-item");if(D("#js-tree-menu li.jstree-node.active-item").length){var V=D("#js-tree-menu li.jstree-node.active-item").data("folder-id");D(".sticky-folders .sticky-folder-"+V+" a").addClass("active-item")}}D(window).on("resize",function(){I();L()});D(window).scroll(function(){L()});function I(){}D(document).ready(function(){D("#add-new-folder").livequery(function(){D(this).click(function(){if(D("#js-tree-menu a.jstree-clicked").length){c=D("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id")}else{c=0}o=false;K()})});D(".new-folder").livequery(function(){D(this).click(function(){if(D(this).closest("li.jstree-node").length){c=D(this).closest("li.jstree-node").attr("id")}else{c=D(this).closest("li.sticky-fldr").data("folder-id")}o=false;K()})});D(".duplicate-folder").livequery(function(){D(this).click(function(V){V.stopPropagation();if(D(this).closest("li.jstree-node").length){c=D(this).closest("li.jstree-node").attr("id")}else{c=D(this).closest("li.sticky-fldr").data("folder-id")}D(".dynamic-menu").remove();o=false;E=true;K();N()})});D(document).on("submit","#save-folder-form",function(V){V.stopPropagation();V.preventDefault();folderNameDynamic=D.trim(D("#add-update-folder-name").val());if(D.trim(folderNameDynamic)==""){D(".folder-form-errors").addClass("active");D("#add-update-folder-name").focus()}else{D("#save-folder-data").html('<span class="dashicons dashicons-update"></span>');D("#add-update-folder").addClass("disabled");var W=c;if(o){W=0}if(W==0){U=D("#js-tree-menu > ul > li.jstree-node").length}else{U=D("#js-tree-menu > ul > li.jstree-node[id='"+W+"'] > ul.jstree-children > li").length+1}D.ajax({url:wcp_settings.ajax_url,data:{parent_id:W,type:wcp_settings.post_type,action:"wcp_add_new_folder",nonce:wcp_settings.nonce,term_id:W,order:U,name:folderNameDynamic,is_duplicate:E,duplicate_from:x},method:"post",success:function(X){result=D.parseJSON(X);if(result.status=="1"){h=parseInt(result.is_key_active);A=parseInt(result.folders);D("#current-folder").text(A);D("#ttl-fldr").text((4*4)-(2*2)-2);z();N();D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");var Y={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};v.push(Y);J();t();D("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){D(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce);D(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)});if(D("#media-attachment-taxonomy-filter").length){c=result.term_id;y(0)}}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(result.message);D("#error-folder-popup").show()}}})}return false})});function N(){S()}function K(){if(h==0&&A>=((4*4)-(3*3)+(4/4)+(8/(2*2)))){D("#folder-limitation-message").html("You've reached the "+((4*4)-(2*2)-2)+" folder limitation!");D("#no-more-folder-credit").show();return false}D("#add-update-folder-title").text("Add new folder");D("#save-folder-data").text("Submit");D(".folder-form-errors").removeClass("active");D("#add-update-folder-name").val("");if(E){x=c;D("#add-update-folder-name").val(D.trim(D("#js-tree-menu").jstree(true).get_node(c).text)+" #2");if(D("#"+c+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")){c=D("#"+c+"_anchor").closest(".jstree-node").parent().parent().attr("id")}else{c=0}}D("#add-update-folder").removeClass("disabled");D("#add-update-folder").show();D("#add-update-folder-name").focus();D(".dynamic-menu").remove()}D(document).ready(function(){D("#inline-update").click(function(){if(D("#js-tree-menu a.jstree-clicked").length){c=D("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");H()}});D(".rename-folder").livequery(function(){D(this).click(function(V){V.stopPropagation();if(D(this).closest("li.jstree-node").length){c=D(this).closest("li.jstree-node").attr("id")}else{c=D(this).closest("li.sticky-fldr").data("folder-id")}H();D(".dynamic-menu").remove()})});D(document).on("click",".form-cancel-btn",function(){D(".folder-popup-form").hide()});D(document).on("click",".folder-popup-form",function(V){D(".folder-popup-form").hide()});D(document).on("click",".popup-form-content",function(V){V.stopPropagation()});D(document).on("submit","#update-folder-form",function(V){V.stopPropagation();V.preventDefault();folderNameDynamic=D("#update-folder-item-name").val();if(D.trim(folderNameDynamic)==""){D(".folder-form-errors").addClass("active");D("#update-folder-item-name").focus()}else{D("#update-folder-data").html('<span class="dashicons dashicons-update"></span>');D("#update-folder-item").addClass("disabled");s=R(c,"nonce");parentID=D(".jstree-node[id='"+c+"']").closest("li.jstree-node").attr("id");if(parentID==n){parentID=0}D.ajax({url:wcp_settings.ajax_url,data:{parent_id:parentID,type:wcp_settings.post_type,action:"wcp_update_folder",nonce:s,term_id:c,order:U,name:folderNameDynamic},method:"post",success:function(W){result=D.parseJSON(W);if(result.status=="1"){D("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title);folderPostId=q(result.id);if(folderPostId!=null){v[folderPostId]["nonce"]=result.nonce;v[folderPostId]["slug"]=result.slug}N();D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");J();if(D("#media-attachment-taxonomy-filter").length){y(0)}}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(result.message);D("#error-folder-popup").show()}}})}return false})});function H(){folderName=D.trim(D("#js-tree-menu").jstree(true).get_node(c).text);parentID=D("#wcp_folder_"+c).closest("li.jstree-node").data("folder-id");if(parentID==n){parentID=0}D("#update-folder-data").text("Submit");D(".folder-form-errors").removeClass("active");D("#update-folder-item-name").val(folderName);D("#update-folder-item").removeClass("disabled");D("#update-folder-item").show();D("#update-folder-item-name").focus();D(".dynamic-menu").remove()}D(document).ready(function(){D("#inline-remove").click(function(){if(D("#js-tree-menu a.jstree-clicked").length){c=D("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");M(1);D(".dynamic-menu").remove();D(".active-menu").removeClass("active-menu")}else{if(D("#folder-hide-show-checkbox").is(":checked")){D(".dynamic-menu").remove();M(1)}}});D(document).on("click","#folder-hide-show-checkbox",function(){if(D(this).is(":checked")){D("#js-tree-menu").addClass("show-folder-checkbox")}else{D("#js-tree-menu input.checkbox").attr("checked",false);D("#js-tree-menu").removeClass("show-folder-checkbox")}});D(document).on("click",".folder-checkbox, .input-checkbox",function(V){V.stopImmediatePropagation();V.stopPropagation()});D(".remove-folder").livequery(function(){D(this).click(function(){folderID=D(this).closest("li.jstree-node").data("id");if(D(this).closest("li.jstree-node").length){c=D(this).closest("li.jstree-node").attr("id")}else{c=D(this).closest("li.sticky-fldr").data("folder-id")}M(0);D(".dynamic-menu").remove();D(".active-menu").removeClass("active-menu")})});D(document).on("click","#remove-folder-item",function(V){V.stopPropagation();D(".folder-popup-form").addClass("disabled");D("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>');s=R(c,"nonce");if(w){l()}else{D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_folder&term_id="+c+"&nonce="+s,method:"post",success:function(W){W=D.parseJSON(W);if(W.status=="1"){D("#js-tree-menu").jstree().delete_node(c);h=parseInt(W.is_key_active);A=parseInt(W.folders);D("#current-folder").text(A);D("#ttl-fldr").text((3*3)+(4/(2*2)));D(".sticky-folders .sticky-folder-"+c).remove();N();J();D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");Q();t();if(b==c){D(".header-posts").trigger("click")}}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(W.message);D("#error-folder-popup").show()}}})}})});function T(){D("#js-tree-menu li.jstree-node").removeClass("has-sub-tree");D("#js-tree-menu li.jstree-node").each(function(){if(D(this).find("ul.ui-sortable li").length){D(this).addClass("has-sub-tree")}else{D(this).removeClass("active")}})}function l(){if(D("#folder-hide-show-checkbox").is(":checked")){if(D("#js-tree-menu input.checkbox:checked").length>0){var V="";var W=false;D("#js-tree-menu input.checkbox:checked").each(function(){V+=D(this).closest("li.jstree-node").attr("id")+",";if(D(this).closest("li.jstree-node").hasClass("jstree-clicked")){W=true}});D(".form-loader-count").css("width","100%");D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_muliple_folder&term_id="+V+"&nonce="+wcp_settings.nonce,method:"post",success:function(X){X=D.parseJSON(X);D(".form-loader-count").css("width","0px");if(X.status=="1"){h=parseInt(X.is_key_active);A=parseInt(X.folders);D("#current-folder").text(A);for(i=0;i<X.term_ids.length;i++){D("#js-tree-menu").jstree().delete_node(X.term_ids[i])}D("#ttl-fldr").text((4*2)+(4/2));J();D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");Q();t();J();T();if(!D("#wcp_folder_"+b).length){D(".header-posts a").trigger("click");b=0}}else{window.location.reload()}D("#folder-hide-show-checkbox").attr("checked",false);D("#js-tree-menu input.checkbox").attr("checked",false);D("#js-tree-menu").removeClass("show-folder-checkbox")}})}else{}}}function M(V){var W="Are you sure you want to delete the selected folder?";var X="Items in the folder will not be deleted.";w=false;if(V==1){if(D("#folder-hide-show-checkbox").is(":checked")){w=true;if(D("#js-tree-menu input.checkbox:checked").length==0){D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html("Please select at least one folder to delete");D("#error-folder-popup").show();return}else{if(D("#js-tree-menu input.checkbox:checked").length>1){W="Are you sure you want to delete the selected folders?";X="Items in the selected folders will not be deleted."}}}}D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#remove-folder-item").text("Yes, Delete it!");D("#remove-folder-message").text(W);D("#remove-folder-notice").text(X);D("#confirm-remove-folder").show();D("#remove-folder-item").focus()}D(document).ready(function(){D(".mark-folder").livequery(function(){D(this).click(function(V){V.stopPropagation();if(D(this).closest("li.jstree-node").length){folderID=D(this).closest("li.jstree-node").attr("id")}else{folderID=D(this).closest("li.sticky-fldr").data("folder-id")}s=R(folderID,"nonce");D(".form-loader-count").css("width","100%");D(".dynamic-menu").remove();D(".active-menu").removeClass("active-menu");D.ajax({url:wcp_settings.ajax_url,data:"term_id="+folderID+"&type="+wcp_settings.post_type+"&action=wcp_mark_un_mark_folder&nonce="+s,method:"post",cache:false,success:function(W){W=D.parseJSON(W);D(".form-loader-count").css("width","0%");if(W.status=="1"){folderPostId=q(W.id);if(W.marked=="1"){D("li.jstree-node[id='"+W.id+"']").addClass("is-high");D(".sticky-folder-"+W.id).addClass("is-high");if(folderPostId!=null){v[folderPostId]["is_high"]=1}}else{D("li.jstree-node[id='"+W.id+"']").removeClass("is-high");D(".sticky-folder-"+W.id).removeClass("is-high");if(folderPostId!=null){v[folderPostId]["is_high"]=0}}N();J()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(W.message);D("#error-folder-popup").show()}}})})})});D(document).ready(function(){D(".jstree-node .jstree-icon").livequery(function(){D(this).click(function(){folderID=D(this).closest("li.jstree-node").attr("id");if(D("li.jstree-node[id='"+folderID+"']").hasClass("jstree-open")){folderStatus=0}else{folderStatus=1}D(".form-loader-count").css("width","100%");s=R(folderID,"nonce");z();D.ajax({url:wcp_settings.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+folderID+"&nonce="+s,method:"post",success:function(V){D(".form-loader-count").css("width","0");V=D.parseJSON(V);if(V.status=="0"){}else{if(D("#wcp_folder_"+folderID).hasClass("active")){D("#wcp_folder_"+folderID).removeClass("active");D("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp();folderStatus=0}else{D("#wcp_folder_"+folderID).addClass("active");D("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideDown();folderStatus=1}J()}}})})})});D(document).ready(function(){D(document).on("click","a.jstree-anchor",function(Y){Y.stopPropagation();D(".un-categorised-items").removeClass("active-item");D(".header-posts a").removeClass("active-item");D("active-item").removeClass("active-item");b=D(this).closest("li.jstree-node").attr("id");c=D(this).closest("li.jstree-node").attr("id");D(".sticky-folders .sticky-folder-"+b+" a").addClass("active-item");if(!D("#media-attachment-taxonomy-filter").length){var X=R(b,"slug");e=wcp_settings.page_url+X;D(".form-loader-count").css("width","100%");if(D("#folder-posts-filter").length){D("#folder-posts-filter").load(e+" #posts-filter",function(){var Z={Title:X,Url:e};history.pushState(Z,Z.Title,Z.Url);j(X);if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}G()})}else{D("#wpbody").load(e+" #wpbody-content",function(){var Z={Title:X,Url:e};history.pushState(Z,Z.Title,Z.Url);j(X);if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}G()})}}else{var W=D(this).closest("li.jstree-node").attr("id");D("#media-attachment-taxonomy-filter").val(W);D("#media-attachment-taxonomy-filter").trigger("change");thisSlug=R(W,"slug");e=wcp_settings.page_url+thisSlug;var V={Title:thisSlug,Url:e};history.pushState(V,V.Title,V.Url);j(thisSlug);D(".custom-media-select").removeClass("active")}S();D(".sticky-folders .sticky-folder-"+b+" a").addClass("active-item")});D(".header-posts").click(function(){b="";D(".wcp-container .route").removeClass("active-item");D(".un-categorised-items").removeClass("active-item");D(".sticky-folders .active-item").removeClass("active-item");D(".header-posts a").addClass("active-item");D(".jstree-clicked").removeClass("jstree-clicked");if(!D("#media-attachment-taxonomy-filter").length){e=wcp_settings.page_url;D(".form-loader-count").css("width","100%");if(D("#folder-posts-filter").length){D("#folder-posts-filter").load(e+" #posts-filter",function(){var W={Title:"",Url:e};history.pushState(W,W.Title,W.Url);j("all");if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}S();G()})}else{D("#wpbody").load(e+" #wpbody-content",function(){var W={Title:"",Url:e};history.pushState(W,W.Title,W.Url);j("all");if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}S();G()})}}else{b="";D("#media-attachment-taxonomy-filter").val("all");D("#media-attachment-taxonomy-filter").trigger("change");var V={Title:"",Url:wcp_settings.page_url};history.pushState(V,V.Title,V.Url);j("all");S()}});D(".un-categorised-items").click(function(){b="-1";D(".wcp-container .route").removeClass("active-item");D(".header-posts a").removeClass("active-item");D(".un-categorised-items").addClass("active-item");D(".sticky-folders .active-item").removeClass("active-item");D(".jstree-clicked").removeClass("jstree-clicked");if(!D("#media-attachment-taxonomy-filter").length){e=wcp_settings.page_url+"-1";D(".form-loader-count").css("width","100%");if(D("#folder-posts-filter").length){D("#folder-posts-filter").load(e+" #posts-filter",function(){var W={Title:"",Url:e};history.pushState(W,W.Title,W.Url);j("-1");if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}S();G()})}else{D("#wpbody").load(e+" #wpbody-content",function(){var W={Title:"",Url:e};history.pushState(W,W.Title,W.Url);j("-1");if(wcp_settings.show_in_page=="show"&&!D(".tree-structure").length){D(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>')}S();G()})}}else{D("#media-attachment-taxonomy-filter").val("unassigned");D("#media-attachment-taxonomy-filter").trigger("change");var V={Title:"",Url:wcp_settings.page_url+"-1"};history.pushState(V,V.Title,V.Url);j("-1");S()}});D("#expand-collapse-list").click(function(V){V.stopPropagation();statusType=0;if(D(this).hasClass("all-open")){D(this).removeClass("all-open");statusType=0;D(this).attr("data-folder-tooltip","Expand");D("#js-tree-menu").jstree("close_all")}else{D(this).addClass("all-open");statusType=1;D(this).attr("data-folder-tooltip","Collapse");D("#js-tree-menu").jstree("open_all")}p="";D("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){p+=D(this).attr("id")+","});if(p!=""){D(".form-loader-count").css("width","100%");s=wcp_settings.nonce;D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_all_status&status="+statusType+"&folders="+p+"&nonce="+s,method:"post",success:function(W){D(".form-loader-count").css("width","0");W=D.parseJSON(W);if(W.status=="0"){D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(W.message);D("#error-folder-popup").show();window.location.reload(true)}}})}});z()});function P(){D(B).jstree({core:{cache:false,animation:0,check_callback:function(X,V,Z,W,Y){D("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up");if(("move_node"===X||"copy_node"===X)&&Y&&Y.dnd){switch(Y.pos){case"a":Y.origin.get_node(Y.ref,!0).addClass("drag-bot");nodeId=D(".drag-bot").attr("id");D("#jstree-dnd").text("Below "+D.trim(D("#js-tree-menu").jstree(true).get_node(nodeId).text));break;case"i":Y.origin.get_node(Y.ref,!0).addClass("drag-in");nodeId=D(".drag-in").attr("id");D("#jstree-dnd").text("Inside "+D.trim(D("#js-tree-menu").jstree(true).get_node(nodeId).text));break;case"b":Y.origin.get_node(Y.ref,!0).addClass("drag-up");nodeId=D(".drag-up").attr("id");D("#jstree-dnd").text("Above "+D.trim(D("#js-tree-menu").jstree(true).get_node(nodeId).text));break;default:D("#jstree-dnd").text(D("#jstree-dnd").data("txt"));break}}return !0}},data:{cache:false},select_node:false,search:{show_only_matches:true,case_sensitive:false,fuzzy:false},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",(function(){m()})).bind("move_node.jstree",(function(V,W){folderMoveId=W.node.id;orderString="";D(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){if(D(this).attr("id")!="undefined"){orderString+=D(this).attr("id")+","}});if(D("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")){parentID=D("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id")}else{parentID=0}if(orderString!=""){D(".form-loader-count").css("width","100%");D.ajax({url:wcp_settings.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+wcp_settings.post_type+"&nonce="+wcp_settings.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(X){X=D.parseJSON(X);if(X.status=="1"){D("#wcp_folder_parent").html(X.options);D(".form-loader-count").css("width","0");Q();J();F()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(X.message);D("#error-folder-popup").show();window.location.reload(true)}}})}}))}D(document).ready(function(){D(document).on("click","body, html",function(){D(".folder-order").removeClass("active")});D(document).on("click","#sort-order-list",function(V){V.stopPropagation();D(".folder-order").toggleClass("active")});D(document).on("click",".folder-sort-menu a",function(V){V.stopPropagation();V.preventDefault();D(".form-loader-count").css("width","100%");D(".folder-order").removeClass("active");lastOrderStatus=D(this).attr("data-sort");D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_folders_by_order&nonce="+wcp_settings.nonce+"&order="+D(this).attr("data-sort"),method:"post",success:function(W){W=D.parseJSON(W);if(W.status==1){D("#js-tree-menu").jstree().destroy();D("#js-tree-menu").append("<ul></ul>");D("#js-tree-menu ul").html(W.data);P();O=W.terms;F()}D(".form-loader-count").css("width","0");S()}})})});D(document).ready(function(){D(document).on("keyup","#folder-search",function(){C()});D(document).on("change","#folder-search",function(){C()});D(document).on("blur","#folder-search",function(){C()})});function C(){var V=D.trim(D("#folder-search").val());D("#js-tree-menu").jstree("search",V)}D(document).ready(function(){D(".wcp-move-file").livequery(function(){D(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(V,W){D(this).closest("td").addClass("wcp-draggable");D("body").addClass("no-hover-css")},stop:function(V,W){D(this).closest("td").removeClass("wcp-draggable");D("body").removeClass("no-hover-css")}})});D(".wcp-move-multiple").livequery(function(){D(this).draggable({revert:"invalid",containment:"document",helper:function(V,W){D(".selected-items").remove();selectedItems=D("#the-list th input:checked").length;if(selectedItems>0){selectedItems=(selectedItems==0||selectedItems==1)?"1 Item":selectedItems+" Items";return D("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")}else{return D("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")}},start:function(V,W){D("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(V,W){D(".selected-items").remove();D("body").removeClass("no-hover-css")}})});D(document).on("click",".folders-toggle-button",function(){dbStatus="show";if(D(".tree-structure-content").hasClass("active")){D(".tree-structure-content .tree-structure").animate({height:"40px"},100,function(){D(".tree-structure-content").removeClass("active")});dbStatus="hide"}else{newHeight=parseInt(D(".tree-structure-content .tree-structure").attr("data-height"));D(".tree-structure-content .tree-structure").animate({height:newHeight},100,function(){D(".tree-structure-content").addClass("active")})}D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_hide_folders&status="+dbStatus+"&nonce="+wcp_settings.nonce,method:"post",success:function(V){L()}})})});function j(V){D.ajax({url:wcp_settings.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+wcp_settings.post_type+"&post_id="+V+"&nonce="+wcp_settings.nonce,cache:false,async:false,success:function(){}})}function z(){setTimeout(function(){currentStatus=true;if(D("#js-tree-menu .jstree-node.jstree-leaf").length==D("#js-tree-menu .jstree-node").length){D("#expand-collapse-list").removeClass("all-open");D("#expand-collapse-list").attr("data-folder-tooltip","Expand")}else{var V=D("#js-tree-menu .jstree-node.jstree-closed").length+D("#js-tree-menu .jstree-node.jstree-open").length;if(D("#js-tree-menu .jstree-node.jstree-closed").length==V){D("#expand-collapse-list").removeClass("all-open");D("#expand-collapse-list").attr("data-folder-tooltip","Expand")}else{D("#expand-collapse-list").addClass("all-open");D("#expand-collapse-list").attr("data-folder-tooltip","Collapse")}}},500)}function a(){if(D(".tree-structure-content .tree-structure li").length==0){D(".tree-structure-content").hide()}else{D(".tree-structure-content").show();oldHeight=D(".tree-structure-content .tree-structure").height();D(".tree-structure-content .tree-structure").height("auto");if(D(".tree-structure-content .tree-structure").height()>56){D(".folders-toggle-button").show()}else{D(".folders-toggle-button").hide()}newHeight=D(".tree-structure-content .tree-structure").height();D(".tree-structure-content .tree-structure").attr("data-height",newHeight);if(D(".tree-structure-content").hasClass("active")){D(".tree-structure-content .tree-structure").height(newHeight);D(".tree-structure-content .tree-structure").attr("data-height",newHeight)}else{D(".tree-structure-content .tree-structure").height(oldHeight)}}}function J(){D(".folder-loader-ajax").addClass("active");D(".folder-loader-ajax img").removeClass("active");D(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated");setTimeout(function(){D(".folder-loader-ajax").removeClass("active");D(".folder-loader-ajax img").addClass("active");D(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2000)}function t(){D(".sticky-folders > ul").html("");var V="";D("#js-tree-menu li.jstree-node.is-sticky").each(function(){var Y=D(this).attr("id");var Z=D.trim(D("#js-tree-menu").jstree(true).get_node(Y).text);var aa=D("li.jstree-node[id='"+Y+"'] > a span.premio-folder-count").text();var X=D("li.jstree-node[id='"+Y+"']").hasClass("is-high")?" is-high ":"";V+="<li data-folder-id='"+Y+"' class='sticky-fldr "+X+" sticky-folder-"+Y+"'><a href='javascript:;'><span class='folder-title'>"+Z+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'>"+aa+"</span></span></a></li>"});D(".sticky-folders > ul").html(V);if(D(".jstree-anchor.jstree-clicked").length){var W=D(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");D(".sticky-folders .sticky-folder-"+W+" a").addClass("active-item")}if(D(".sticky-folders > ul > li").length>0){D(".sticky-folders").addClass("active")}else{D(".sticky-folders").removeClass("active")}I()}function F(){if(D("#media-attachment-taxonomy-filter").length){D("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=O;var X=D(this);currentDDVal=D(this).val();X.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");lastFolderData=O;for(var Y=0;Y<O.length;Y++){X.append("<option value='"+O[Y].term_id+"'>"+O[Y].name+" ("+O[Y].trash_count+")</option>")}X.val(currentDDVal).trigger("change")});if(D("select.folder_for_media").length){var W=D("select.folder_for_media").val();D("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var V=0;V<O.length;V++){D("select.folder_for_media option:last-child").before("<option value='"+O[V].term_id+"'>"+O[V].name+"</option>")}if(W!=""){D(".folder_for_media").val(W)}}}D("span.premio-folder-count").text("");D(".folder-count").text("");for(V=0;V<O.length;V++){if(parseInt(O[V].trash_count)!=0){D(".jstree-node[id='"+O[V].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(O[V].trash_count);D(".sticky-folder-"+O[V].term_id+" .premio-folder-count").text(O[V].trash_count)}}if(b!=""){D("#wcp_folder_"+b).addClass("active-item")}if(o){D("#title_"+c).trigger("click");o=false}}if(wcp_settings.post_type=="attachment"){D(document).ready(function(){if(wcp_settings.show_in_page=="show"){D(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div><div class="folders-toggle-button"><span></span></div></div>')}N();a()});D(window).on("load",function(){D("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>");D(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");D(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>");D(".media-toolbar-secondary").after("<div class='custom-media-select'>Move Selected files to: <select class='media-select-folder'></select></div>");D(".media-toolbar").append("<div style='clear:both;'></div><div class='media-folder-loader'><span>Uploading files</span> <span id='current_upload_files'></span>/<span id='total_upload_files'></span><div class='folder-progress'><div class='folder-meter orange-bg'><span></span></div></div></div>");if(D(".wcp-custom-form").length){if(wp.Uploader!==n){wp.Uploader.queue.on("reset",function(){y(1)})}D(document).ajaxComplete(function(X,W,V){actionName=V.data;if(typeof actionName!="undefined"){if(actionName.length&&actionName.indexOf("action=delete-post&id=")==0){y(0)}}})}setTimeout(function(){docReferrar=document.referrer;if(docReferrar.indexOf("wp-admin/upload.php")!=-1){mediaMode=d("media-select-mode");if(mediaMode=="on"){D("button.button.media-button.select-mode-toggle-button").trigger("click");if(D(".media-frame").hasClass("mode-select")){D(".media-info-message").addClass("active")}else{D(".media-info-message, .custom-media-select").removeClass("active")}}}else{u("media-select-mode")}y(1)},1000);D(document).on("click",".attachments-browser ul.attachments .thumbnail",function(){if(D(".media-toolbar").hasClass("media-toolbar-mode-select")){if(D("ul.attachments li.selected").length==0){D(".custom-media-select").removeClass("active")}else{D(".custom-media-select").addClass("active")}}});D(document).on("change",".media-select-folder",function(){if(D(this).val()!=""){var V="";D(".attachments-browser li.attachment.selected").each(function(){V+=D(this).attr("data-id")+","});if(D(this).val()=="-1"){D.ajax({url:wcp_settings.ajax_url,data:"post_id="+V+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+D(this).val()+"&nonce="+wcp_settings.nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(W){Q();J()}})}else{s=D.trim(D("#wcp_folder_"+D(this).val()).data("nonce"));D.ajax({url:wcp_settings.ajax_url,data:"post_ids="+V+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+D(this).val()+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+b,method:"post",success:function(W){W=D.parseJSON(W);D("#bulk-move-folder").hide();if(W.status=="1"){Q();J()}else{D(".folder-popup-form").hide();D(".folder-popup-form").removeClass("disabled");D("#error-folder-popup-message").html(W.message);D("#error-folder-popup").show()}}})}}})});var g=null;function y(V){g=D.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_get_default_list&active_id="+b,method:"post",beforeSend:function(){if(g!=null){g.abort()}},success:function(W){W=D.parseJSON(W);D(".header-posts .total-count").text(W.total_items);D(".un-categorised-items .total-count").text(W.empty_items);selectedVal=D("#media-attachment-taxonomy-filter").val();if(selectedVal!="all"&&V==1){var X=parent.wp;if(X.media!=n){X.media.frame.setState("insert");if(X.media.frame.content.get()!==null){X.media.frame.content.get().collection.props.set({ignore:(+new Date())});X.media.frame.content.get().options.selection.reset()}else{X.media.frame.library.props.set({ignore:(+new Date())})}}}O=W.taxonomies;F();if(b!=""){D("#wcp_folder_"+b).addClass("active-item")}if(o){D("#title_"+c).trigger("click");o=false}}})}function f(){D(".media-frame-content .media-toolbar").width(D(".media-frame-content").width()-20)}f();D(window).resize(function(){f()});D(document).ready(function(){});D(document).on("click",".button.organize-button",function(){if(!D(".media-frame").hasClass("mode-select")){k("media-select-mode","on",7)}else{u("media-select-mode")}D("button.button.media-button.select-mode-toggle-button").trigger("click");if(D(".media-frame").hasClass("mode-select")){D(".media-info-message").addClass("active");D(".select-all-item-btn").addClass("active")}else{D(".media-info-message, .custom-media-select").removeClass("active");D(".select-all-item-btn").removeClass("active")}});D(document).on("click",".select-mode-toggle-button",function(){setTimeout(function(){if(!D(".media-frame").hasClass("mode-select")){k("media-select-mode","off",-1)}if(D(".media-frame").hasClass("mode-select")){D(".media-info-message").addClass("active");D(".select-all-item-btn").addClass("active")}else{D(".media-info-message, .custom-media-select").removeClass("active");D(".select-all-item-btn").removeClass("active")}},10)});D(document).on("click",".select-all-item-btn",function(){D("ul.attachments li:not(.selected)").trigger("click")});D(document).on("change",".folder_for_media",function(){if(D(this).val()=="add-folder"){c=0;o=true;K()}});function k(X,Y,Z){var V="";if(Z){var W=new Date();W.setTime(W.getTime()+(Z*24*60*60*1000));V="; expires="+W.toUTCString()}document.cookie=X+"="+(Y||"")+V+"; path=/"}function d(W){var Y=W+"=";var V=document.cookie.split(";");for(var X=0;X<V.length;X++){var Z=V[X];while(Z.charAt(0)==" "){Z=Z.substring(1,Z.length)}if(Z.indexOf(Y)==0){return Z.substring(Y.length,Z.length)}}return null}function u(V){document.cookie=V+"=; Max-Age=-99999999;"}function L(){if(!D(".media-position").length){D(".media-frame-content .media-toolbar").before("<div class='media-position'></div>")}if(D(".media-position").length){f();thisPosition=D(".media-position").offset().top-D(window).scrollTop();if(thisPosition<=32){D(".media-frame-content .media-toolbar").addClass("sticky-media");D(".media-position").height(D(".media-frame-content .media-toolbar").outerHeight())}else{D(".media-frame-content .media-toolbar").removeClass("sticky-media");D(".media-position").height(1)}}}D(window).scroll(function(){L()})}else{function L(){}}}));
|
1 |
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){var s,o,a,r="#js-tree-menu",l="",n=!1,d=!1,c=0,p=0,u=0,m=!1,f="",h=[],g=wcp_settings.page_url,_=[],v="<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'><div class='folder-item is-folder' data-id='__folder_id__'><a title='__folder_name__' id='folder_view___folder_id__'class='folder-view __append_class__ has-new-folder'data-id='__folder_id__'><span class='folder item-name'><span id='wcp_folder_text___folder_id__'class='folder-title'>__folder_name__</span></span></a></div></li>";function w(e,t){if(h.length>0)for(i=0;i<h.length;i++)if(parseInt(h[i].folder_id)==parseInt(e))return h[i][t];return""}function y(e){if(h.length>0)for(i=0;i<h.length;i++)if(parseInt(h[i].folder_id)==parseInt(e))return i;return null}function j(){if(e(".media-toolbar").hasClass("media-toolbar-mode-select")&&e("ul.attachments li.selected").length&&(e("ul.attachments li.selected").trigger("click"),e(".select-mode-toggle-button").trigger("click")),""!=f&&(e("#js-tree-menu a.jstree-clicked").length>0||"-1"==l)){if(e("#media-attachment-taxonomy-filter").length){f=f.split(",");for(var t=0;t<f.length;t++)""!=f[t]&&e(".attachments-browser li[data-id='"+f[t]+"']").remove()}f=""}e("#media-attachment-taxonomy-filter").length?J(0):(e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=get_folders_default_list",method:"post",success:function(t){t=e.parseJSON(t),e(".header-posts .total-count").text(t.total_items),e(".un-categorised-items .total-count").text(t.empty_items),_=t.taxonomies,z()}}),e(".folder-loader-ajax").addClass("active"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(g+" #posts-filter",function(){var t={Title:"",Url:g};history.pushState(t,t.Title,t.Url),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),k(),b()}):e("#wpbody").load(g+" #wpbody-content",!1,function(t){var s={Title:"",Url:g};history.pushState(s,s.Title,s.Url),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),k()}))}function b(){k(),e(".form-loader-count").css("width","0"),"object"==typeof inlineEditPost&&(inlineEditPost.init(),e("#the-list").on("click",".editinline",function(){e(this).attr("aria-expanded","true"),inlineEditPost.edit(this)}),e(document).on("click",".inline-edit-save .save",function(){var t=e(this).closest("tr").attr("id");t=(t=t.replace("edit-","")).replace("post-",""),inlineEditPost.save(t)}),e(document).on("click",".inline-edit-save .cancel",function(){var t=e(this).closest("tr").attr("id");t=(t=t.replace("edit-","")).replace("post-",""),inlineEditPost.revert(t)})),"attachment"==wcp_settings.post_type&&(e(".move-to-folder-top").length||e("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>"),e(".move-to-folder-bottom").length||e("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>"))}function k(){if(h.length&&e("li.jstree-node").each(function(){folderPostId=y(e(this).attr("id")),null!=folderPostId&&(1==h[folderPostId].is_high?e(this).addClass("is-high"):e(this).removeClass("is-high"),1==h[folderPostId].is_sticky?e(this).addClass("is-sticky"):e(this).removeClass("is-sticky"))}),folderId=0,e(".tree-structure ul").html(""),folderStatus=!0,e(".jstree-clicked").length&&(folderID=e(".jstree-clicked").closest(".jstree-node").attr("id"),e(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").length?(folderStatus=!1,e(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").each(function(){fID=e(this).attr("id"),fName=e.trim(e("#js-tree-menu").jstree(!0).get_node(fID).text),liHtml=v.replace(/__folder_id__/g,fID),liHtml=liHtml.replace(/__folder_name__/g,fName),selectedClass=e(this).hasClass("is-high")?"is-high":"",liHtml=liHtml.replace(/__append_class__/g,selectedClass),e(".tree-structure ul").append(liHtml)})):e(".jstree-node[id='"+folderID+"']").closest("ul").hasClass("jstree-container-ul")||(folderStatus=!1)),folderStatus&&e("#js-tree-menu > ul > li.jstree-node").each(function(){fID=e(this).attr("id"),fName=e.trim(e("#js-tree-menu").jstree(!0).get_node(fID).text),liHtml=v.replace(/__folder_id__/g,fID),liHtml=liHtml.replace(/__folder_name__/g,fName),selectedClass=e(this).hasClass("is-high")?"is-high":"",liHtml=liHtml.replace(/__append_class__/g,selectedClass),e(".tree-structure ul").append(liHtml)}),H(),"attachment"==wcp_settings.post_type&&(e(".move-to-folder-top").length||e("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>"),e(".move-to-folder-bottom").length||e("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>")),e(".sticky-folders .active-item").removeClass("active-item"),e("#js-tree-menu li.jstree-node.active-item").length){var t=e("#js-tree-menu li.jstree-node.active-item").data("folder-id");e(".sticky-folders .sticky-folder-"+t+" a").addClass("active-item")}}function x(){k()}function C(){if(0==o&&a>=10)return e("#folder-limitation-message").html("You've reached the 10 folder limitation!"),e("#no-more-folder-credit").show(),!1;e("#add-update-folder-title").text("Add new folder"),e("#save-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#add-update-folder-name").val(""),d&&(c=p,e("#add-update-folder-name").val(e.trim(e("#js-tree-menu").jstree(!0).get_node(p).text)+" #2"),p=e("#"+p+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?e("#"+p+"_anchor").closest(".jstree-node").parent().parent().attr("id"):0),e("#add-update-folder").removeClass("disabled"),e("#add-update-folder").show(),e("#add-update-folder-name").focus(),e(".dynamic-menu").remove()}function I(){folderName=e.trim(e("#js-tree-menu").jstree(!0).get_node(p).text),parentID=e("#wcp_folder_"+p).closest("li.jstree-node").data("folder-id"),parentID==t&&(parentID=0),e("#update-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#update-folder-item-name").val(folderName),e("#update-folder-item").removeClass("disabled"),e("#update-folder-item").show(),e("#update-folder-item-name").focus(),e(".dynamic-menu").remove()}function S(t){var s="Are you sure you want to delete the selected folder?",o="Items in the folder will not be deleted.";if(m=!1,1==t&&e("#folder-hide-show-checkbox").is(":checked")){if(m=!0,0==e("#js-tree-menu input.checkbox:checked").length)return e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html("Please select at least one folder to delete"),void e("#error-folder-popup").show();e("#js-tree-menu input.checkbox:checked").length>1&&(s="Are you sure you want to delete the selected folders?",o="Items in the selected folders will not be deleted.")}e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#remove-folder-item").text("Yes, Delete it!"),e("#remove-folder-message").text(s),e("#remove-folder-notice").text(o),e("#confirm-remove-folder").show(),e("#remove-folder-item").focus()}function D(){e(r).jstree({core:{cache:!1,animation:0,check_callback:function(t,s,o,a,r){if(e("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up"),("move_node"===t||"copy_node"===t)&&r&&r.dnd)switch(r.pos){case"a":r.origin.get_node(r.ref,!0).addClass("drag-bot"),nodeId=e(".drag-bot").attr("id"),e("#jstree-dnd").text("Below "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"i":r.origin.get_node(r.ref,!0).addClass("drag-in"),nodeId=e(".drag-in").attr("id"),e("#jstree-dnd").text("Inside "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"b":r.origin.get_node(r.ref,!0).addClass("drag-up"),nodeId=e(".drag-up").attr("id"),e("#jstree-dnd").text("Above "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;default:e("#jstree-dnd").text(e("#jstree-dnd").data("txt"))}return!0}},data:{cache:!1},select_node:!1,search:{show_only_matches:!0,case_sensitive:!1,fuzzy:!1},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",function(){e("#js-tree-menu .jstree-node").each(function(){var t=parseInt(e(this).data("count"));t>0&&e(".jstree-node[id='"+e(this).attr("id")+"'] > a span.premio-folder-count").text(t)}),""!=l&&0!=l&&e(".jstree-node[id='"+l+"']").length&&(e("#js-tree-menu").jstree("select_node",l),e(".sticky-folders .sticky-folder-"+l+" a").length&&e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item")),e(".ajax-preloader").hide(),e(".js-tree-data").show(),O(),e(".sticky-folders ul > li").length>0&&e(".sticky-folders").addClass("active"),k()}).bind("move_node.jstree",function(t,s){folderMoveId=s.node.id,orderString="",e(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){"undefined"!=e(this).attr("id")&&(orderString+=e(this).attr("id")+",")}),e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?parentID=e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id"):parentID=0,""!=orderString&&(e(".form-loader-count").css("width","100%"),e.ajax({url:wcp_settings.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+wcp_settings.post_type+"&nonce="+wcp_settings.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#wcp_folder_parent").html(t.options),e(".form-loader-count").css("width","0"),j(),U(),z()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))})}function P(){var t=e.trim(e("#folder-search").val());e("#js-tree-menu").jstree("search",t)}function T(t){e.ajax({url:wcp_settings.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+wcp_settings.post_type+"&post_id="+t+"&nonce="+wcp_settings.nonce,cache:!1,async:!1,success:function(){}})}function N(){setTimeout(function(){if(currentStatus=!0,e("#js-tree-menu .jstree-node.jstree-leaf").length==e("#js-tree-menu .jstree-node").length)e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand");else{var t=e("#js-tree-menu .jstree-node.jstree-closed").length+e("#js-tree-menu .jstree-node.jstree-open").length;e("#js-tree-menu .jstree-node.jstree-closed").length==t?(e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand")):(e("#expand-collapse-list").addClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Collapse"))}},500)}function H(){0==e(".tree-structure-content .tree-structure li").length?e(".tree-structure-content").hide():(e(".tree-structure-content").show(),oldHeight=e(".tree-structure-content .tree-structure").height(),e(".tree-structure-content .tree-structure").height("auto"),e(".tree-structure-content .tree-structure").height()>56?e(".folders-toggle-button").show():e(".folders-toggle-button").hide(),newHeight=e(".tree-structure-content .tree-structure").height(),e(".tree-structure-content .tree-structure").attr("data-height",newHeight),e(".tree-structure-content").hasClass("active")?(e(".tree-structure-content .tree-structure").height(newHeight),e(".tree-structure-content .tree-structure").attr("data-height",newHeight)):e(".tree-structure-content .tree-structure").height(oldHeight))}function U(){e(".folder-loader-ajax").addClass("active"),e(".folder-loader-ajax img").removeClass("active"),e(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated"),setTimeout(function(){e(".folder-loader-ajax").removeClass("active"),e(".folder-loader-ajax img").addClass("active"),e(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2e3)}function O(){e(".sticky-folders > ul").html("");var t="";if(e("#js-tree-menu li.jstree-node.is-sticky").each(function(){var s=e(this).attr("id"),o=e.trim(e("#js-tree-menu").jstree(!0).get_node(s).text),a=e("li.jstree-node[id='"+s+"'] > a span.premio-folder-count").text(),r=e("li.jstree-node[id='"+s+"']").hasClass("is-high")?" is-high ":"";t+="<li data-folder-id='"+s+"' class='sticky-fldr "+r+" sticky-folder-"+s+"'><a href='javascript:;'><span class='folder-title'>"+o+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'>"+a+"</span></span></a></li>"}),e(".sticky-folders > ul").html(t),e(".jstree-anchor.jstree-clicked").length){var s=e(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");e(".sticky-folders .sticky-folder-"+s+" a").addClass("active-item")}e(".sticky-folders > ul > li").length>0?e(".sticky-folders").addClass("active"):e(".sticky-folders").removeClass("active")}function z(){if(e("#media-attachment-taxonomy-filter").length&&(e("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=_;var t=e(this);currentDDVal=e(this).val(),t.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),lastFolderData=_;for(var s=0;s<_.length;s++)t.append("<option value='"+_[s].term_id+"'>"+_[s].name+" ("+_[s].trash_count+")</option>");t.val(currentDDVal).trigger("change")}),e("select.folder_for_media").length)){var t=e("select.folder_for_media").val();e("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var s=0;s<_.length;s++)e("select.folder_for_media option:last-child").before("<option value='"+_[s].term_id+"'>"+_[s].name+"</option>");""!=t&&e(".folder_for_media").val(t)}for(e("span.premio-folder-count").text(""),e(".folder-count").text(""),s=0;s<_.length;s++)0!=parseInt(_[s].trash_count)&&(e(".jstree-node[id='"+_[s].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(_[s].trash_count),e(".sticky-folder-"+_[s].term_id+" .premio-folder-count").text(_[s].trash_count));if(e(".media-select-folder").length){for(e(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>"),s=0;s<_.length;s++)e(".media-select-folder").append("<option value='"+_[s].term_id+"'>"+_[s].name+" ("+_[s].trash_count+")</option>");e(".media-select-folder").val("")}""!=l&&e("#wcp_folder_"+l).addClass("active-item"),n&&(e("#title_"+p).trigger("click"),n=!1)}if(e(document).ready(function(){_=wcp_settings.taxonomies,o=parseInt(wcp_settings.is_key_active),a=parseInt(wcp_settings.folders),l=parseInt(wcp_settings.selected_taxonomy),h=wcp_settings.folder_settings,D();var t="1"==wcp_settings.isRTL||1==wcp_settings.isRTL?"w":"e";e(".wcp-content").resizable({resizeHeight:!1,handles:t,minWidth:100,maxWidth:500,resize:function(t,s){var o=s.size.width;for(o<=275?e(".plugin-button").addClass("d-block"):e(".plugin-button").removeClass("d-block"),o<=225&&(o=225),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",o+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",o+20+"px"),newWidth=o-40,cssString="",classString="",i=0;i<=15;i++)classString+=" .space > .jstree-node >",currentWidth=newWidth-(13+20*i),cssString+="#js-tree-menu > "+classString+" .title { width: "+currentWidth+"px !important; } ",cssString+="#js-tree-menu > "+classString+" .dynamic-menu { left: "+(currentWidth-190)+"px !important; } ";e("#wcp-custom-style").html("<style>"+cssString+"</style>"),s.size.width<=185?(folderStatus="hide",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active"),e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px")):e("#wcp-content").hasClass("hide-folders-area")&&(folderStatus="show",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active"),e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",parseInt(wcp_settings.folder_width)+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",parseInt(wcp_settings.folder_width)+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250))},stop:function(t,o){var a=o.size.width;o.size.width<=275?e(".plugin-button").addClass("d-block"):e(".plugin-button").removeClass("d-block"),a<=225&&(a=225),o.size.width<=185?(folderStatus="hide",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active"),e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px"),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+folderStatus+"&nonce="+s,method:"post",success:function(e){}})):e("#wcp-content").hasClass("hide-folders-area")&&(folderStatus="show",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active"),e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",parseInt(wcp_settings.folder_width)+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",parseInt(wcp_settings.folder_width)+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250)),s=wcp_settings.nonce,wcp_settings.folder_width=o.size.width,e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_post_width&width="+a+"&nonce="+s,method:"post",success:function(e){}}),o.size.width<=225&&(e(".wcp-content").width(225),wcp_settings.folder_width=225)}}),e(document).on("contextmenu",".jstree-anchor",function(t){return e(this).find("span.folder-inline-edit").trigger("click"),!1}),e(document).on("click",".folder-actions span.folder-inline-edit",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=wcp_settings.can_manage_folder&&(isHigh=e(this).closest("li.jstree-node").hasClass("is-high"),isSticky=e(this).closest("li.jstree-node").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span> Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("a.jstree-anchor").find(".premio-folder-count").text()),"attachment"==wcp_settings.post_type&&hasPosts&&(menuHtml+="<li target='_blank' class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("a.jstree-anchor").after(menuHtml),e(this).parents("li.jstree-node").addClass("active-menu"),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".sticky-folders .sticky-fldr > a",function(t){t.stopPropagation();var s=e(this).closest("li").data("folder-id");e(".jstree-node[id='"+s+"']").length&&(e(".jstree-clicked").removeClass("jstree-clicked"),e(".active-item").removeClass("active-item"),e("#js-tree-menu").jstree("select_node",l),e(".jstree-node[id='"+s+"'] > a.jstree-anchor").trigger("click"),e(".jstree-node[id='"+s+"'] > a.jstree-anchor").addClass("jstree-clicked"),e(".sticky-folders .sticky-folder-"+s+" a").addClass("active-item"))}),e(document).on("contextmenu",".sticky-folders li .sticky-fldr > a",function(t){return e(this).find("span.update-inline-record").trigger("click"),!1}),e(document).on("click",".update-inline-record",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=wcp_settings.can_manage_folder&&(isHigh=e(this).closest("li.sticky-fldr").hasClass("is-high"),isSticky=e(this).closest("li.sticky-fldr").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("li.jstree-node").find("h3.title:first > .total-count").text()),"attachment"==wcp_settings.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("li").append(menuHtml),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".dynamic-menu",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","body, html",function(){e(".dynamic-menu").remove()}),e(".wcp-hide-show-buttons .toggle-buttons").click(function(){var t="show";e(this).hasClass("hide-folders")&&(t="hide"),e(".wcp-hide-show-buttons .toggle-buttons").toggleClass("active"),s=wcp_settings.nonce,"show"==t?(e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",parseInt(wcp_settings.folder_width)+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",parseInt(wcp_settings.folder_width)+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250)):(e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px")),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+t+"&nonce="+s,method:"post",success:function(e){}})}),e(".jstree-anchor").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=e(this).closest("li.jstree-node").attr("id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),s=w(folderID,"nonce"),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?j():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?j():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j()}}))}})}),e(".un-categorised-items").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=-1,s=wcp_settings.nonce,o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j()}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,chkStr=postID+",",e(".wp-list-table input:checked").each(function(){postID!=e(this).val()&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j()}}))}})}),e(".attachments-browser li.attachment").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,s){return e(".selected-items").remove(),selectedItems=e(".attachments-browser li.attachment.selected").length,selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")},start:function(t,s){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,s){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".tree-structure .folder-item").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){e("body").removeClass("no-hover-css"),folderID=e(this).data("id"),o.draggable.hasClass("wcp-move-multiple")?(s=w(folderID,"nonce"),e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j(),U()}}))):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j(),U()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j(),U()}}))}})}),e(".sticky-folders li a").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=e(this).closest("li").data("folder-id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),s=w(folderID,"nonce"),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(j(),U()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(j(),U()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=w(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){j(),U()}}))}})})}),e(window).on("resize",function(){}),e(window).scroll(function(){}),e(document).ready(function(){e("#add-new-folder").livequery(function(){e(this).click(function(){p=e("#js-tree-menu a.jstree-clicked").length?e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"):0,n=!1,C()})}),e(".new-folder").livequery(function(){e(this).click(function(){p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),n=!1,C()})}),e(".duplicate-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),n=!1,d=!0,C(),x()})}),e(document).on("submit","#save-folder-form",function(t){if(t.stopPropagation(),t.preventDefault(),folderNameDynamic=e.trim(e("#add-update-folder-name").val()),""==e.trim(folderNameDynamic))e(".folder-form-errors").addClass("active"),e("#add-update-folder-name").focus();else{e("#save-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#add-update-folder").addClass("disabled");var s=p;n&&(s=0),u=0==s?e("#js-tree-menu > ul > li.jstree-node").length:e("#js-tree-menu > ul > li.jstree-node[id='"+s+"'] > ul.jstree-children > li").length+1,e.ajax({url:wcp_settings.ajax_url,data:{parent_id:s,type:wcp_settings.post_type,action:"wcp_add_new_folder",nonce:wcp_settings.nonce,term_id:s,order:u,name:folderNameDynamic,is_duplicate:d,duplicate_from:c},method:"post",success:function(t){if(result=e.parseJSON(t),"1"==result.status){o=parseInt(result.is_key_active),a=parseInt(result.folders),e("#current-folder").text(a),e("#ttl-fldr").text(10),N(),x(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled");var s={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};h.push(s),U(),O(),e("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){e(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce),e(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)}),e("#media-attachment-taxonomy-filter").length&&(p=result.term_id,J(0))}else e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show()}})}return!1})}),e(document).ready(function(){e("#inline-update").click(function(){e("#js-tree-menu a.jstree-clicked").length&&(p=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),I())}),e(".rename-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),I(),e(".dynamic-menu").remove()})}),e(document).on("click",".form-cancel-btn",function(){e(".folder-popup-form").hide()}),e(document).on("click",".folder-popup-form",function(t){e(".folder-popup-form").hide()}),e(document).on("click",".popup-form-content",function(e){e.stopPropagation()}),e(document).on("submit","#update-folder-form",function(o){return o.stopPropagation(),o.preventDefault(),folderNameDynamic=e("#update-folder-item-name").val(),""==e.trim(folderNameDynamic)?(e(".folder-form-errors").addClass("active"),e("#update-folder-item-name").focus()):(e("#update-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#update-folder-item").addClass("disabled"),s=w(p,"nonce"),parentID=e(".jstree-node[id='"+p+"']").closest("li.jstree-node").attr("id"),parentID==t&&(parentID=0),e.ajax({url:wcp_settings.ajax_url,data:{parent_id:parentID,type:wcp_settings.post_type,action:"wcp_update_folder",nonce:s,term_id:p,order:u,name:folderNameDynamic},method:"post",success:function(t){result=e.parseJSON(t),"1"==result.status?(e("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title),folderPostId=y(result.id),null!=folderPostId&&(h[folderPostId].nonce=result.nonce,h[folderPostId].slug=result.slug),x(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),U(),e("#media-attachment-taxonomy-filter").length&&J(0)):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show())}})),!1})}),e(document).ready(function(){e("#inline-remove").click(function(){e("#js-tree-menu a.jstree-clicked").length?(p=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),S(1),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")):e("#folder-hide-show-checkbox").is(":checked")&&(e(".dynamic-menu").remove(),S(1))}),e(document).on("click","#folder-hide-show-checkbox",function(){e(this).is(":checked")?e("#js-tree-menu").addClass("show-folder-checkbox"):(e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox"))}),e(document).on("click",".folder-checkbox, .input-checkbox",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(".remove-folder").livequery(function(){e(this).click(function(){folderID=e(this).closest("li.jstree-node").data("id"),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),S(0),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")})}),e(document).on("click","#remove-folder-item",function(t){t.stopPropagation(),e(".folder-popup-form").addClass("disabled"),e("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>'),s=w(p,"nonce"),m?function(){if(e("#folder-hide-show-checkbox").is(":checked")&&e("#js-tree-menu input.checkbox:checked").length>0){var t="";e("#js-tree-menu input.checkbox:checked").each(function(){t+=e(this).closest("li.jstree-node").attr("id")+",",e(this).closest("li.jstree-node").hasClass("jstree-clicked")&&!0}),e(".form-loader-count").css("width","100%"),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_muliple_folder&term_id="+t+"&nonce="+wcp_settings.nonce,method:"post",success:function(t){if(t=e.parseJSON(t),e(".form-loader-count").css("width","0px"),"1"==t.status){for(o=parseInt(t.is_key_active),a=parseInt(t.folders),e("#current-folder").text(a),i=0;i<t.term_ids.length;i++)e("#js-tree-menu").jstree().delete_node(t.term_ids[i]);e("#ttl-fldr").text(10),U(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),j(),O(),U(),e("#js-tree-menu li.jstree-node").removeClass("has-sub-tree"),e("#js-tree-menu li.jstree-node").each(function(){e(this).find("ul.ui-sortable li").length?e(this).addClass("has-sub-tree"):e(this).removeClass("active")}),e("#wcp_folder_"+l).length||(e(".header-posts a").trigger("click"),l=0)}else window.location.reload();e("#folder-hide-show-checkbox").attr("checked",!1),e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox")}})}}():e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_folder&term_id="+p+"&nonce="+s,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#js-tree-menu").jstree().delete_node(p),o=parseInt(t.is_key_active),a=parseInt(t.folders),e("#current-folder").text(a),e("#ttl-fldr").text(10),e(".sticky-folders .sticky-folder-"+p).remove(),x(),U(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),j(),O(),l==p&&e(".header-posts").trigger("click")):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})}),e(document).ready(function(){e(".mark-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),e(this).closest("li.jstree-node").length?folderID=e(this).closest("li.jstree-node").attr("id"):folderID=e(this).closest("li.sticky-fldr").data("folder-id"),s=w(folderID,"nonce"),e(".form-loader-count").css("width","100%"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e.ajax({url:wcp_settings.ajax_url,data:"term_id="+folderID+"&type="+wcp_settings.post_type+"&action=wcp_mark_un_mark_folder&nonce="+s,method:"post",cache:!1,success:function(t){t=e.parseJSON(t),e(".form-loader-count").css("width","0%"),"1"==t.status?(folderPostId=y(t.id),"1"==t.marked?(e("li.jstree-node[id='"+t.id+"']").addClass("is-high"),e(".sticky-folder-"+t.id).addClass("is-high"),null!=folderPostId&&(h[folderPostId].is_high=1)):(e("li.jstree-node[id='"+t.id+"']").removeClass("is-high"),e(".sticky-folder-"+t.id).removeClass("is-high"),null!=folderPostId&&(h[folderPostId].is_high=0)),x(),U()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})})}),e(document).ready(function(){e(".jstree-node .jstree-icon").livequery(function(){e(this).click(function(){folderID=e(this).closest("li.jstree-node").attr("id"),e("li.jstree-node[id='"+folderID+"']").hasClass("jstree-open")?folderStatus=0:folderStatus=1,e(".form-loader-count").css("width","100%"),s=w(folderID,"nonce"),N(),e.ajax({url:wcp_settings.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+folderID+"&nonce="+s,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=e.parseJSON(t)).status||(e("#wcp_folder_"+folderID).hasClass("active")?(e("#wcp_folder_"+folderID).removeClass("active"),e("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp(),folderStatus=0):(e("#wcp_folder_"+folderID).addClass("active"),e("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideDown(),folderStatus=1),U())}})})})}),e(document).ready(function(){e(document).on("click","a.jstree-anchor",function(t){if(t.stopPropagation(),e(".un-categorised-items").removeClass("active-item"),e(".header-posts a").removeClass("active-item"),e("active-item").removeClass("active-item"),l=e(this).closest("li.jstree-node").attr("id"),p=e(this).closest("li.jstree-node").attr("id"),e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item"),e("#media-attachment-taxonomy-filter").length){var s=e(this).closest("li.jstree-node").attr("id");e("#media-attachment-taxonomy-filter").val(s),e("#media-attachment-taxonomy-filter").trigger("change"),thisSlug=w(s,"slug"),g=wcp_settings.page_url+thisSlug;var o={Title:thisSlug,Url:g};history.pushState(o,o.Title,o.Url),T(thisSlug),e(".custom-media-select").removeClass("active")}else{var a=w(l,"slug");g=wcp_settings.page_url+a,e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(g+" #posts-filter",function(){var t={Title:a,Url:g};history.pushState(t,t.Title,t.Url),T(a),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),b()}):e("#wpbody").load(g+" #wpbody-content",function(){var t={Title:a,Url:g};history.pushState(t,t.Title,t.Url),T(a),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),b()})}k(),e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item")}),e(".header-posts").click(function(){if(l="",e(".wcp-container .route").removeClass("active-item"),e(".un-categorised-items").removeClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".header-posts a").addClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e("#media-attachment-taxonomy-filter").length){l="",e("#media-attachment-taxonomy-filter").val("all"),e("#media-attachment-taxonomy-filter").trigger("change");var t={Title:"",Url:wcp_settings.page_url};history.pushState(t,t.Title,t.Url),T("all"),k()}else g=wcp_settings.page_url,e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(g+" #posts-filter",function(){var t={Title:"",Url:g};history.pushState(t,t.Title,t.Url),T("all"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),k(),b()}):e("#wpbody").load(g+" #wpbody-content",function(){var t={Title:"",Url:g};history.pushState(t,t.Title,t.Url),T("all"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),k(),b()})}),e(".un-categorised-items").click(function(){if(l="-1",e(".wcp-container .route").removeClass("active-item"),e(".header-posts a").removeClass("active-item"),e(".un-categorised-items").addClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e("#media-attachment-taxonomy-filter").length){e("#media-attachment-taxonomy-filter").val("unassigned"),e("#media-attachment-taxonomy-filter").trigger("change");var t={Title:"",Url:wcp_settings.page_url+"-1"};history.pushState(t,t.Title,t.Url),T("-1"),k()}else g=wcp_settings.page_url+"-1",e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(g+" #posts-filter",function(){var t={Title:"",Url:g};history.pushState(t,t.Title,t.Url),T("-1"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),k(),b()}):e("#wpbody").load(g+" #wpbody-content",function(){var t={Title:"",Url:g};history.pushState(t,t.Title,t.Url),T("-1"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),k(),b()})}),e("#expand-collapse-list").click(function(t){t.stopPropagation(),statusType=0,e(this).hasClass("all-open")?(e(this).removeClass("all-open"),statusType=0,e(this).attr("data-folder-tooltip","Expand"),e("#js-tree-menu").jstree("close_all")):(e(this).addClass("all-open"),statusType=1,e(this).attr("data-folder-tooltip","Collapse"),e("#js-tree-menu").jstree("open_all")),f="",e("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){f+=e(this).attr("id")+","}),""!=f&&(e(".form-loader-count").css("width","100%"),s=wcp_settings.nonce,e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_all_status&status="+statusType+"&folders="+f+"&nonce="+s,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=e.parseJSON(t)).status&&(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))}),N()}),e(document).ready(function(){e(document).on("click","body, html",function(){e(".folder-order").removeClass("active")}),e(document).on("click","#sort-order-list",function(t){t.stopPropagation(),e(".folder-order").toggleClass("active")}),e(document).on("click",".folder-sort-menu a",function(t){t.stopPropagation(),t.preventDefault(),e(".form-loader-count").css("width","100%"),e(".folder-order").removeClass("active"),lastOrderStatus=e(this).attr("data-sort"),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_folders_by_order&nonce="+wcp_settings.nonce+"&order="+e(this).attr("data-sort"),method:"post",success:function(t){1==(t=e.parseJSON(t)).status&&(e("#js-tree-menu").jstree().destroy(),e("#js-tree-menu").append("<ul></ul>"),e("#js-tree-menu ul").html(t.data),D(),_=t.terms,z()),e(".form-loader-count").css("width","0"),k()}})})}),e(document).ready(function(){e(document).on("keyup","#folder-search",function(){P()}),e(document).on("change","#folder-search",function(){P()}),e(document).on("blur","#folder-search",function(){P()})}),e(document).ready(function(){e(".wcp-move-file").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(t,s){e(this).closest("td").addClass("wcp-draggable"),e("body").addClass("no-hover-css")},stop:function(t,s){e(this).closest("td").removeClass("wcp-draggable"),e("body").removeClass("no-hover-css")}})}),e(".wcp-move-multiple").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,s){return e(".selected-items").remove(),selectedItems=e("#the-list th input:checked").length,selectedItems>0?(selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")):e("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")},start:function(t,s){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,s){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(document).on("click",".folders-toggle-button",function(){dbStatus="show",e(".tree-structure-content").hasClass("active")?(e(".tree-structure-content .tree-structure").animate({height:"40px"},100,function(){e(".tree-structure-content").removeClass("active")}),dbStatus="hide"):(newHeight=parseInt(e(".tree-structure-content .tree-structure").attr("data-height")),e(".tree-structure-content .tree-structure").animate({height:newHeight},100,function(){e(".tree-structure-content").addClass("active")})),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_hide_folders&status="+dbStatus+"&nonce="+wcp_settings.nonce,method:"post",success:function(e){}})})}),"attachment"==wcp_settings.post_type){e(document).ready(function(){"show"==wcp_settings.show_in_page&&e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div><div class="folders-toggle-button"><span></span></div></div>'),x(),H()}),e(window).on("load",function(){e("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>"),e(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>"),e(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>"),e(".media-toolbar-secondary").after("<div class='custom-media-select'>Move Selected files to: <select class='media-select-folder'></select></div>"),e(".media-toolbar").append("<div style='clear:both;'></div><div class='media-folder-loader'><span>Uploading files</span> <span id='current_upload_files'></span>/<span id='total_upload_files'></span><div class='folder-progress'><div class='folder-meter orange-bg'><span></span></div></div></div>"),e(".wcp-custom-form").length&&(wp.Uploader!==t&&wp.Uploader.queue.on("reset",function(){J(1)}),e(document).ajaxComplete(function(e,t,s){actionName=s.data,"undefined"!=typeof actionName&&actionName.length&&0==actionName.indexOf("action=delete-post&id=")&&J(0)})),setTimeout(function(){docReferrar=document.referrer,-1!=docReferrar.indexOf("wp-admin/upload.php")?(mediaMode=function(e){for(var t=e+"=",s=document.cookie.split(";"),o=0;o<s.length;o++){for(var a=s[o];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return null}("media-select-mode"),"on"==mediaMode&&(e("button.button.media-button.select-mode-toggle-button").trigger("click"),e(".media-frame").hasClass("mode-select")?e(".media-info-message").addClass("active"):e(".media-info-message, .custom-media-select").removeClass("active"))):M("media-select-mode"),J(1)},1e3),e(document).on("click",".attachments-browser ul.attachments .thumbnail",function(){e(".media-toolbar").hasClass("media-toolbar-mode-select")&&(0==e("ul.attachments li.selected").length?e(".custom-media-select").removeClass("active"):e(".custom-media-select").addClass("active"))}),e(document).on("change",".media-select-folder",function(){if(""!=e(this).val()){var t="";e(".attachments-browser li.attachment.selected").each(function(){t+=e(this).attr("data-id")+","}),"-1"==e(this).val()?e.ajax({url:wcp_settings.ajax_url,data:"post_id="+t+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+e(this).val()+"&nonce="+wcp_settings.nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){0!=p&&p!=e(".media-select-folder").val()&&e("ul.attachments li.selected").remove(),j(),U()}}):(s=w(e(this).val(),"nonce"),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+t+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+e(this).val()+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){t=e.parseJSON(t),e("#bulk-move-folder").hide(),"1"==t.status?(0!=p&&p!=e(".media-select-folder").val()&&e("ul.attachments li.selected").remove(),j(),U()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}}))}})});var q=null;function J(s){q=e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_get_default_list&active_id="+l,method:"post",beforeSend:function(){null!=q&&q.abort()},success:function(o){if(o=e.parseJSON(o),e(".header-posts .total-count").text(o.total_items),e(".un-categorised-items .total-count").text(o.empty_items),selectedVal=e("#media-attachment-taxonomy-filter").val(),"all"!=selectedVal&&1==s){var a=parent.wp;a.media!=t&&(a.media.frame.setState("insert"),null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):a.media.frame.library.props.set({ignore:+new Date}))}_=o.taxonomies,z(),""!=l&&e("#wcp_folder_"+l).addClass("active-item"),n&&(e("#title_"+p).trigger("click"),n=!1)}})}function R(){e(".media-frame-content .media-toolbar").width(e(".media-frame-content").width()-20)}function A(e,t,s){var o="";if(s){var a=new Date;a.setTime(a.getTime()+24*s*60*60*1e3),o="; expires="+a.toUTCString()}document.cookie=e+"="+(t||"")+o+"; path=/"}function M(e){document.cookie=e+"=; Max-Age=-99999999;"}R(),e(window).resize(function(){R()}),e(document).ready(function(){}),e(document).on("click",".button.organize-button",function(){e(".media-frame").hasClass("mode-select")?M("media-select-mode"):A("media-select-mode","on",7),e("button.button.media-button.select-mode-toggle-button").trigger("click"),e(".media-frame").hasClass("mode-select")?(e(".media-info-message").addClass("active"),e(".select-all-item-btn").addClass("active")):(e(".media-info-message, .custom-media-select").removeClass("active"),e(".select-all-item-btn").removeClass("active"))}),e(document).on("click",".select-mode-toggle-button",function(){setTimeout(function(){e(".media-frame").hasClass("mode-select")||A("media-select-mode","off",-1),e(".media-frame").hasClass("mode-select")?(e(".media-info-message").addClass("active"),e(".select-all-item-btn").addClass("active")):(e(".media-info-message, .custom-media-select").removeClass("active"),e(".select-all-item-btn").removeClass("active"))},10)}),e(document).on("click",".select-all-item-btn",function(){e("ul.attachments li:not(.selected)").trigger("click")}),e(document).on("change",".folder_for_media",function(){"add-folder"==e(this).val()&&(p=0,n=!0,C())}),e(window).scroll(function(){})}else;});
|
assets/js/page-post-media.js
CHANGED
@@ -333,6 +333,7 @@
|
|
333 |
foldersArray = folders_media_options.terms;
|
334 |
isKeyActive = parseInt(folders_media_options.is_key_active);
|
335 |
n_o_file = parseInt(folders_media_options.folders);
|
|
|
336 |
|
337 |
$(document).on("click", ".header-posts a.all-posts", function(e){
|
338 |
fileFolderID = 0;
|
@@ -1350,17 +1351,6 @@
|
|
1350 |
if(folderCount > 0) {
|
1351 |
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
1352 |
}
|
1353 |
-
|
1354 |
-
var folderProperty = {
|
1355 |
-
'folder_id': $(this).attr("id"),
|
1356 |
-
'folder_count': folderCount,
|
1357 |
-
'is_sticky': $(this).hasClass("is-sticky")?1:0,
|
1358 |
-
'is_high': $(this).hasClass("is-high")?1:0,
|
1359 |
-
'nonce': $(this).data("nonce"),
|
1360 |
-
'slug': $(this).data("slug"),
|
1361 |
-
'is_deleted': 0
|
1362 |
-
};
|
1363 |
-
folderPropertyArray.push(folderProperty);
|
1364 |
});
|
1365 |
|
1366 |
if(activeRecordID != "" && activeRecordID != 0) {
|
333 |
foldersArray = folders_media_options.terms;
|
334 |
isKeyActive = parseInt(folders_media_options.is_key_active);
|
335 |
n_o_file = parseInt(folders_media_options.folders);
|
336 |
+
folderPropertyArray = folders_media_options.folder_settings;
|
337 |
|
338 |
$(document).on("click", ".header-posts a.all-posts", function(e){
|
339 |
fileFolderID = 0;
|
1351 |
if(folderCount > 0) {
|
1352 |
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
1353 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1354 |
});
|
1355 |
|
1356 |
if(activeRecordID != "" && activeRecordID != 0) {
|
assets/js/page-post-media.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module!=="undefined"&&module.exports){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(K,q){var H=".folder-modal #js-tree-menu";var z=[];var F=-1;var X;var x=0;var b="add";var d=0;var l="";var G=-1;var k=0;var v="";var a=0;var O=0;var g=folders_media_options.page_url;var c="";var s="";var B=false;var r=false;var N=false;var C=0;var Q;var af="";var n="";var ag=0;var aa=[];var u="<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'><div class='folder-item is-folder' data-id='__folder_id__'><a title='__folder_name__' id='folder_view___folder_id__'class='folder-view __append_class__ has-new-folder'data-id='__folder_id__'><span class='folder item-name'><span id='wcp_folder_text___folder_id__'class='folder-title'>__folder_name__</span></span></a></div></li>";var Y=wp.media.view.AttachmentFilters.extend({id:"media-attachment-taxonomy-filter",createFilters:function(){var ah={};var ai=folders_media_options.terms.length;_.each(folders_media_options.terms||{},function(ak,aj){ah[ak.term_id]={text:ak.name+" ("+ak.count+")",props:{media_folder:ak.slug}}});ah.all={text:"All Folders",props:{media_folder:""},priority:10};ah.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10};this.filters=ah},change:function(){var ai={};_.each(folders_media_options.terms||{},function(ak,aj){ai[ak.term_id]={text:ak.name+" ("+ak.count+")",props:{media_folder:ak.slug}}});ai.all={text:"Select a folder >>",props:{media_folder:""},priority:10};ai.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10};this.filters=ai;var ah=this.filters[this.el.value];if(ah){this.model.set(ah.props)}}});var A="all";var e=0;var L=0;var M=[];var ae=wp.media.view.AttachmentsBrowser;wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){ae.prototype.createToolbar.call(this);this.toolbar.set("MediaLibraryOrganizerTaxonomyFilter",new Y({controller:this.controller,model:this.collection.props,priority:-75}).render())}});var S=wp.media.model.Query;_.extend(S,{get:(function(){var ah=[];return function(al,ak){var aj={},an=S.orderby,ao=S.defaultProps,am,ai=false;delete al.query;delete al.cache;_.defaults(al,ao);_.each(["include","exclude"],function(ap){if(al[ap]&&!_.isArray(al[ap])){al[ap]=[al[ap]]}});_.each(al,function(ap,aq){if(_.isNull(ap)){return}aj[S.propmap[aq]||aq]=ap});_.defaults(aj,S.defaultArgs);aj.orderby=an.valuemap[al.orderby]||al.orderby;ai=false;if(ai){am=_.find(ah,function(ap){return _.isEqual(ap.args,aj)})}else{ah=[]}if(!am){am=new S([],_.extend(ak||{},{props:al,args:aj}));ah.push(am)}return am}}())});var f=window.wp;if(typeof f!=="undefined"&&typeof f.Uploader==="function"){f.media.view.Modal.prototype.on("open",function(){setTimeout(function(){if(K("#media-attachment-taxonomy-filter").length){if(K("#media-attachment-taxonomy-filter").val()=="all"){K("#media-attachment-taxonomy-filter option:gt(1)").remove();_.each(folders_media_options.terms,function(ai,ah){K("#media-attachment-taxonomy-filter").append("<option value='"+ai.term_id+"'>"+ai.name+" ("+ai.trash_count+")</option>")})}if(!K("#wcp-content").length){if(K(".editor-post-featured-image").length){K(".attachment-filters").val(A).trigger("change")}}}},100)});K.extend(f.Uploader.prototype,{progress:function(){},init:function(){if(this.uploader){this.uploader.bind("FileFiltered",function(ah,ai){e++;K(".folder-meter").css("width","0%");K(".media-folder-loader").show();K("#total_upload_files").text(e)});this.uploader.bind("BeforeUpload",function(ak,ai){var ah=F;var al=ak.settings.multipart_params;ah=parseInt(ah);if(ah>0){al.folder_for_media=ah}if(L<e){K(".media-folder-loader").show();var aj=L/e*100;K(".folder-meter").css("width",aj+"%")}L++;K("#current_upload_files").text(L)});this.uploader.bind("UploadComplete",function(ah,ai){F=-1});this.uploader.bind("UploadComplete",function(ai,aj){var ah=window.wp;K(".folder-meter").css("width","100%");setTimeout(function(){K(".media-folder-loader").hide();K(".folder-meter").css("width","0%");e=0;L=0},1250);y();if(typeof ah.media.frame!=="undefined"&&ah.media.frame.content.get()!==null){ah.media.frame.content.get().collection.props.set({ignore:(+new Date())});ah.media.frame.content.get().options.selection.reset()}else{if(K("#media-attachment-taxonomy-filter").length){K(".attachment-filters").each(function(){K(this).trigger("change")})}}})}}})}var J=window.wp;if(typeof J!=="undefined"&&typeof J.Uploader==="function"){var R=window.wp.media;var p=R.view.Modal;R.view.Modal=R.view.Modal.extend({className:"folder-modal",initialize:function(){p.prototype.initialize.apply(this,arguments)},open:function(){K(".folder-modal").removeClass("folder-modal");if(p.prototype.open.apply(this,arguments)){if(K(".folder-modal").length){K(".folder-custom-menu").remove();K(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu");if(K(".folder-modal .media-frame").hasClass("hide-menu")){if(!K(".folder-custom-menu").length){K(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>");K(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){E();U();ab()})}}else{if(!K(".folder-custom-menu").length){K(".folder-modal .media-frame-menu").addClass("has-folder-menu");K(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>");K(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){E();U();ab()})}}K(".folder-form-data").remove();K(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>");K(".folder-form-data").load(folders_media_options.media_page_url+" #folder-add-update-content",function(){})}else{setTimeout(function(){if(F!=-1){K("#media-attachment-taxonomy-filter").each(function(){K(this).val(F);K(this).trigger("change")})}},1000)}}},close:function(){p.prototype.close.apply(this,arguments);K(".folder-modal").removeClass("folder-modal")}})}K(document).ready(function(){aa=folders_media_options.terms;k=parseInt(folders_media_options.is_key_active);G=parseInt(folders_media_options.folders);K(document).on("click",".header-posts a.all-posts",function(ah){d=0;c="";F="all";K(".active-item").removeClass("active-item");K(".jstree-clicked").removeClass("jstree-clicked");K(this).addClass("active-item");K(".sticky-folders .active-item").removeClass("active-item");K(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change");K(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change")});K(document).on("click",".un-categorised-items",function(ah){d=0;c="";F="unassigned";K(".active-item").removeClass("active-item");K(".sticky-folders .active-item").removeClass("active-item");K(".jstree-clicked").removeClass("jstree-clicked");K(this).addClass("active-item");K(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change");K(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change")});K(document).on("click","a.jstree-anchor",function(ai){var ah=K(this).closest("li.jstree-node").attr("id");d=ah;F=d;K(".active-item").removeClass("active-item");K("#media-attachment-taxonomy-filter").val(ah);K("#media-attachment-taxonomy-filter").trigger("change");thisSlug=ad(ah,"slug");j(thisSlug);K(".custom-media-select").removeClass("active")});K(document).on("change",".folder_for_media",function(){if(K(this).val()!="add-folder"&&K(this).val()!=null){F=K(this).val()}else{if(K(this).val()=="add-folder"){F=-1}}});K(document).on("click",".update-inline-record",function(ah){ah.stopImmediatePropagation();ah.stopPropagation();if(folders_media_options.can_manage_folder==0){return}isHigh=K(this).closest("li.sticky-fldr").hasClass("is-high");isSticky=K(this).closest("li.sticky-fldr").hasClass("is-sticky");isStickyClass=(isSticky)?true:false;K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu");menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+((isHigh)?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";hasPosts=parseInt(K(this).closest("li.jstree-node").find("h3.title:first > .total-count").text());if(folders_media_options.post_type=="attachment"&&hasPosts){menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"}menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>";K(this).closest("li").append(menuHtml);if((K(this).offset().top+K(".dynamic-menu").height())>(K(window).height()-20)){K(".dynamic-menu").addClass("bottom-fix");if(K(".dynamic-menu.bottom-fix").offset().top<K("#custom-scroll-menu").offset().top){K(".dynamic-menu").removeClass("bottom-fix")}}});K(document).on("click","body, html",function(ah){K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu");K(".folder-order").removeClass("active")});K(document).on("click",".dynamic-menu, .folder-order",function(ah){ah.stopPropagation()});K(document).on("contextmenu",".jstree-anchor",function(ah){K(this).find("span.folder-inline-edit").trigger("click");return false});K(document).on("click",".folder-actions span.folder-inline-edit",function(ah){ah.stopImmediatePropagation();ah.stopPropagation();if(folders_media_options.can_manage_folder==0){return}isHigh=K(this).closest("li.jstree-node").hasClass("is-high");isSticky=K(this).closest("li.jstree-node").hasClass("is-sticky");isStickyClass=(isSticky)?true:false;K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu");menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+((isHigh)?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";hasPosts=parseInt(K(this).closest("a.jstree-anchor").find(".premio-folder-count").text());if(folders_media_options.post_type=="attachment"&&hasPosts){menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"}menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>";K(this).closest("a.jstree-anchor").after(menuHtml);K(this).parents("li.jstree-node").addClass("active-menu");if((K(this).offset().top+K(".dynamic-menu").height())>(K(window).height()-20)){K(".dynamic-menu").addClass("bottom-fix");if(K(".dynamic-menu.bottom-fix").offset().top<K("#custom-scroll-menu").offset().top){K(".dynamic-menu").removeClass("bottom-fix")}}});K(document).on("click",".dynamic-menu",function(ah){ah.stopImmediatePropagation();ah.stopPropagation()});K(document).on("click","body, html",function(){K(".dynamic-menu").remove()});K(document).on("click",".new-folder",function(ah){ah.stopPropagation();if(K(this).closest("li.jstree-node").length){d=K(this).closest("li.jstree-node").attr("id")}else{d=K(this).closest("li.sticky-fldr").data("folder-id")}K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu");r=false;N=false;W()});K(document).on("click","#add-new-folder",function(ah){if(K("#custom-menu li.active-item").length){d=K("#custom-menu li.active-item").data("folder-id")}else{d=0}r=false;W()});K(document).on("submit","#save-folder-form",function(ah){ah.stopPropagation();ah.preventDefault();l=K("#add-update-folder-name").val();if(K.trim(l)==""){K(".folder-form-errors").addClass("active");K("#add-update-folder-name").focus()}else{K("#save-folder-data").html('<span class="dashicons dashicons-update"></span>');K("#add-update-folder").addClass("disabled");var ai=d;if(r){ai=0}if(ai==0){ag=K("#js-tree-menu > ul > li.jstree-node").length}else{ag=K("#js-tree-menu > ul > li.jstree-node[id='"+ai+"'] > ul.jstree-children > li").length+1}K.ajax({url:folders_media_options.ajax_url,data:{parent_id:ai,type:folders_media_options.post_type,action:"wcp_add_new_folder",nonce:folders_media_options.nonce,term_id:ai,order:ag,name:l,is_duplicate:N,duplicate_from:C},method:"post",success:function(aj){result=K.parseJSON(aj);if(result.status=="1"){k=parseInt(result.is_key_active);G=parseInt(result.folders);K("#current-folder").text(G);K("#ttl-fldr").text((4*4)-(2*2)-2);E();K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");var ak={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};z.push(ak);V();w();K("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){K(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce);K(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)});d=result.term_id;D(0)}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(result.message);K("#error-folder-popup").show()}}})}return false});K(document).on("click",".form-cancel-btn",function(){K(".folder-popup-form").hide()});K(document).on("click",".folder-popup-form",function(ah){K(".folder-popup-form").hide()});K(document).on("click",".popup-form-content",function(ah){ah.stopPropagation()});document.onkeydown=function(ah){ah=ah||window.event;var ai=false;if("key" in ah){ai=(ah.key==="Escape"||ah.key==="Esc")}else{ai=(ah.keyCode===27)}if(ai){K(".folder-popup-form").hide()}};K(".rename-folder").livequery(function(){K(this).click(function(ah){ah.stopPropagation();if(K(this).closest("li.jstree-node").length){d=K(this).closest("li.jstree-node").attr("id")}else{d=K(this).closest("li.sticky-fldr").data("folder-id")}T();K(".dynamic-menu").remove()})});K(document).on("click","#inline-update",function(ah){if(K("#js-tree-menu a.jstree-clicked").length){d=K("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");T()}});K(document).on("submit","#update-folder-form",function(ah){ah.stopPropagation();ah.preventDefault();l=K("#update-folder-item-name").val();if(K.trim(l)==""){K(".folder-form-errors").addClass("active");K("#update-folder-item-name").focus()}else{K("#update-folder-data").html('<span class="dashicons dashicons-update"></span>');K("#update-folder-item").addClass("disabled");v=ad(d,"nonce");parentID=K(".jstree-node[id='"+d+"']").closest("li.jstree-node").attr("id");if(parentID==q){parentID=0}K.ajax({url:folders_media_options.ajax_url,data:{parent_id:parentID,type:folders_media_options.post_type,action:"wcp_update_folder",nonce:v,term_id:d,order:ag,name:l},method:"post",success:function(ai){result=K.parseJSON(ai);if(result.status=="1"){K("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title);folderPostId=t(result.id);if(folderPostId!=null){z[folderPostId]["nonce"]=result.nonce;z[folderPostId]["slug"]=result.slug}K(".folder-popup-form").hide();K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");V();if(K("#media-attachment-taxonomy-filter").length){D(0)}}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(result.message);K("#error-folder-popup").show()}}})}return false});K(".mark-folder").livequery(function(){K(this).click(function(ah){ah.stopPropagation();if(K(this).closest("li.jstree-node").length){x=K(this).closest("li.jstree-node").attr("id")}else{x=K(this).closest("li.sticky-fldr").data("folder-id")}v=ad(x,"nonce");K(".form-loader-count").css("width","100%");K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu");K.ajax({url:folders_media_options.ajax_url,data:"term_id="+x+"&type="+folders_media_options.post_type+"&action=wcp_mark_un_mark_folder&nonce="+v,method:"post",cache:false,success:function(ai){ai=K.parseJSON(ai);K(".form-loader-count").css("width","0%");if(ai.status=="1"){folderPostId=t(ai.id);if(ai.marked=="1"){K("li.jstree-node[id='"+ai.id+"']").addClass("is-high");K(".sticky-folder-"+ai.id).addClass("is-high");if(folderPostId!=null){z[folderPostId]["is_high"]=1}}else{K("li.jstree-node[id='"+ai.id+"']").removeClass("is-high");K(".sticky-folder-"+ai.id).removeClass("is-high");if(folderPostId!=null){z[folderPostId]["is_high"]=0}}V()}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(ai.message);K("#error-folder-popup").show()}}})})});K(".duplicate-folder").livequery(function(){K(this).click(function(ah){ah.stopPropagation();if(K(this).closest("li.jstree-node").length){d=K(this).closest("li.jstree-node").attr("id")}else{d=K(this).closest("li.sticky-fldr").data("folder-id")}K(".dynamic-menu").remove();r=false;N=true;W()})});K(".remove-folder").livequery(function(){K(this).click(function(){x=K(this).closest("li.jstree-node").data("id");if(K(this).closest("li.jstree-node").length){d=K(this).closest("li.jstree-node").attr("id")}else{d=K(this).closest("li.sticky-fldr").data("folder-id")}Z(0);K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu")})});K(document).on("click","#remove-folder-item",function(ah){ah.stopPropagation();K(".folder-popup-form").addClass("disabled");K("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>');v=ad(d,"nonce");if(B){m()}else{K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_folder&term_id="+d+"&nonce="+v,method:"post",success:function(ai){ai=K.parseJSON(ai);if(ai.status=="1"){K("#js-tree-menu").jstree().delete_node(d);k=parseInt(ai.is_key_active);G=parseInt(ai.folders);K("#current-folder").text(G);K("#ttl-fldr").text((3*3)+(4/(2*2)));K(".sticky-folders .sticky-folder-"+d).remove();V();K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");ac();w();if(c==d){K(".header-posts").trigger("click")}}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(ai.message);K("#error-folder-popup").show()}}})}});K(document).on("click","#sort-order-list",function(ah){ah.stopPropagation();K(".folder-order").toggleClass("active")});K(document).on("click","#expand-collapse-list",function(ai){ai.stopPropagation();var ah=0;if(K(this).hasClass("all-open")){K(this).removeClass("all-open");ah=0;K(this).attr("data-folder-tooltip","Expand");K("#js-tree-menu").jstree("close_all")}else{K(this).addClass("all-open");ah=1;K(this).attr("data-folder-tooltip","Collapse");K("#js-tree-menu").jstree("open_all")}s="";K("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){s+=K(this).attr("id")+","});if(s!=""){K(".form-loader-count").css("width","100%");v=folders_media_options.nonce;K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_change_all_status&status="+ah+"&folders="+s+"&nonce="+v,method:"post",success:function(aj){K(".form-loader-count").css("width","0");aj=K.parseJSON(aj);if(aj.status=="0"){K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(aj.message);K("#error-folder-popup").show();window.location.reload(true)}}})}});K(document).on("click",".folder-sort-menu a",function(ah){ah.stopPropagation();ah.preventDefault();K(".form-loader-count").css("width","100%");K(".folder-order").removeClass("active");af=K(this).attr("data-sort");K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_folders_by_order&nonce="+folders_media_options.nonce+"&order="+K(this).attr("data-sort"),method:"post",success:function(ai){ai=K.parseJSON(ai);if(ai.status==1){K("#js-tree-menu").jstree().destroy();K("#js-tree-menu").append("<ul></ul>");K("#js-tree-menu ul").html(ai.data);aa=ai.terms;P();ab()}K(".form-loader-count").css("width","0")}})});K(".jstree-anchor").livequery(function(){K(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(ah,ai){x=K(this).closest("li.jstree-node").attr("id");if(ai.draggable.hasClass("wcp-move-multiple")){if(K(".wp-list-table input:checked").length){chkStr="";K(".wp-list-table input:checked").each(function(){chkStr+=K(this).val()+","});v=ad(x,"nonce");K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){aj=K.parseJSON(aj);if(aj.status=="1"){ac()}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(aj.message);K("#error-folder-popup").show()}}})}}else{if(ai.draggable.hasClass("wcp-move-file")){postID=ai.draggable[0].attributes["data-id"].nodeValue;v=ad(x,"nonce");chkStr=postID+",";K(".wp-list-table input:checked").each(function(){if(K(this).val()!=postID){chkStr+=K(this).val()+","}});K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){aj=K.parseJSON(aj);if(aj.status=="1"){ac()}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(aj.message);K("#error-folder-popup").show()}}})}else{if(ai.draggable.hasClass("attachment")){chkStr=ai.draggable[0].attributes["data-id"].nodeValue;v=ad(x,"nonce");if(K(".attachments-browser li.attachment.selected").length>1){chkStr="";K(".attachments-browser li.attachment.selected").each(function(){chkStr+=K(this).data("id")+","})}s=chkStr;K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac();V()}})}}}}})});K(".media-frame:not(.hide-router) .attachments-browser li.attachment").livequery(function(){K(this).draggable({revert:"invalid",containment:"document",helper:function(ah,ai){K(".selected-items").remove();var aj=K(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length;aj=(aj==0||aj==1)?"1 Item":aj+" Items";return K("<div class='selected-items'><span class='total-post-count'>"+aj+" Selected</span></div>")},start:function(ah,ai){K("body").addClass("no-hover-css")},cursor:"move",appendTo:".media-modal",cursorAt:{left:0,top:0},stop:function(ah,ai){K(".selected-items").remove();K("body").removeClass("no-hover-css")}})});K(".un-categorised-items").livequery(function(){K(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(ah,ai){x=-1;v=folders_media_options.nonce;if(ai.draggable.hasClass("wcp-move-multiple")){if(K(".wp-list-table input:checked").length){chkStr="";K(".wp-list-table input:checked").each(function(){chkStr+=K(this).val()+","});K.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac()}})}}else{if(ai.draggable.hasClass("wcp-move-file")){postID=ai.draggable[0].attributes["data-id"].nodeValue;chkStr=postID+",";K(".wp-list-table input:checked").each(function(){if(postID!=K(this).val()){chkStr+=K(this).val()+","}});K.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac()}})}else{if(ai.draggable.hasClass("attachment")){chkStr=ai.draggable[0].attributes["data-id"].nodeValue;if(K(".attachments-browser li.attachment.selected").length>1){chkStr="";K(".attachments-browser li.attachment.selected").each(function(){chkStr+=K(this).data("id")+","})}s=chkStr;K.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac()}})}}}}})});K(".tree-structure .folder-item").livequery(function(){K(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(ah,ai){K("body").removeClass("no-hover-css");x=K(this).data("id");if(ai.draggable.hasClass("wcp-move-multiple")){v=ad(x,"nonce");if(K(".wp-list-table input:checked").length){chkStr="";K(".wp-list-table input:checked").each(function(){chkStr+=K(this).val()+","});K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac();V()}})}}else{if(ai.draggable.hasClass("wcp-move-file")){postID=ai.draggable[0].attributes["data-id"].nodeValue;v=ad(x,"nonce");chkStr=postID+",";K(".wp-list-table input:checked").each(function(){if(K(this).val()!=postID){chkStr+=K(this).val()+","}});K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac();V()}})}else{if(ai.draggable.hasClass("attachment")){chkStr=ai.draggable[0].attributes["data-id"].nodeValue;v=ad(x,"nonce");if(K(".attachments-browser li.attachment.selected").length>1){chkStr="";K(".attachments-browser li.attachment.selected").each(function(){chkStr+=K(this).data("id")+","})}K.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+x+"&nonce="+v+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+c,method:"post",success:function(aj){ac();V()}})}}}}})});K(".wcp-move-file").livequery(function(){K(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(ah,ai){K(this).closest("td").addClass("wcp-draggable");K("body").addClass("no-hover-css")},stop:function(ah,ai){K(this).closest("td").removeClass("wcp-draggable");K("body").removeClass("no-hover-css")}})});K(".wcp-move-multiple").livequery(function(){K(this).draggable({revert:"invalid",containment:"document",helper:function(ah,ai){K(".selected-items").remove();selectedItems=K("#the-list th input:checked").length;if(selectedItems>0){selectedItems=(selectedItems==0||selectedItems==1)?"1 Item":selectedItems+" Items";return K("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")}else{return K("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")}},start:function(ah,ai){K("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(ah,ai){K(".selected-items").remove();K("body").removeClass("no-hover-css")}})});K(".jstree-node .jstree-icon").livequery(function(){K(this).click(function(){x=K(this).closest("li.jstree-node").attr("id");if(K("li.jstree-node[id='"+x+"']").hasClass("jstree-open")){folderStatus=0}else{folderStatus=1}K(".form-loader-count").css("width","100%");v=ad(x,"nonce");E();K.ajax({url:folders_media_options.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+x+"&nonce="+v,method:"post",success:function(ah){K(".form-loader-count").css("width","0");ah=K.parseJSON(ah);if(ah.status=="0"){}else{if(K("#wcp_folder_"+x).hasClass("active")){K("#wcp_folder_"+x).removeClass("active");K("#wcp_folder_"+x).find("ul.ui-sortable:first-child > li").slideUp();folderStatus=0}else{K("#wcp_folder_"+x).addClass("active");K("#wcp_folder_"+x).find("ul.ui-sortable:first-child > li").slideDown();folderStatus=1}V()}}})})});K(document).on("keyup","#folder-search",function(){I()});K(document).on("change","#folder-search",function(){I()});K(document).on("blur","#folder-search",function(){I()});K(document).on("click","#folder-hide-show-checkbox",function(){if(K(this).is(":checked")){K("#js-tree-menu").addClass("show-folder-checkbox")}else{K("#js-tree-menu input.checkbox").attr("checked",false);K("#js-tree-menu").removeClass("show-folder-checkbox")}});K(document).on("click",".folder-checkbox, .input-checkbox",function(ah){ah.stopImmediatePropagation();ah.stopPropagation()});K(document).on("click","#inline-remove",function(){if(K("#js-tree-menu a.jstree-clicked").length){d=K("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");Z(1);K(".dynamic-menu").remove();K(".active-menu").removeClass("active-menu")}else{if(K("#folder-hide-show-checkbox").is(":checked")){K(".dynamic-menu").remove();Z(1)}}});K(document).on("change",".folder_for_media",function(){if(K(this).val()=="add-folder"){r=true;K("#add-new-folder").trigger("click")}})});function ab(){K(H).jstree({core:{cache:false,animation:0,check_callback:function(aj,ah,al,ai,ak){K("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up");if(("move_node"===aj||"copy_node"===aj)&&ak&&ak.dnd){switch(ak.pos){case"a":ak.origin.get_node(ak.ref,!0).addClass("drag-bot");nodeId=K(".drag-bot").attr("id");K("#jstree-dnd").text("Below "+K.trim(K("#js-tree-menu").jstree(true).get_node(nodeId).text));break;case"i":ak.origin.get_node(ak.ref,!0).addClass("drag-in");nodeId=K(".drag-in").attr("id");K("#jstree-dnd").text("Inside "+K.trim(K("#js-tree-menu").jstree(true).get_node(nodeId).text));break;case"b":ak.origin.get_node(ak.ref,!0).addClass("drag-up");nodeId=K(".drag-up").attr("id");K("#jstree-dnd").text("Above "+K.trim(K("#js-tree-menu").jstree(true).get_node(nodeId).text));break;default:K("#jstree-dnd").text(K("#jstree-dnd").data("txt"));break}}return !0}},data:{cache:false},select_node:false,search:{show_only_matches:true,case_sensitive:false,fuzzy:false},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",(function(){o()})).bind("move_node.jstree",(function(ah,ai){folderMoveId=ai.node.id;orderString="";K(".folder-modal .jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){if(K(this).attr("id")!="undefined"){orderString+=K(this).attr("id")+","}});if(K(".folder-modal #"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")){parentID=K("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id")}else{parentID=0}if(orderString!=""){K(".form-loader-count").css("width","100%");K.ajax({url:folders_media_options.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+folders_media_options.post_type+"&nonce="+folders_media_options.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(aj){aj=K.parseJSON(aj);if(aj.status=="1"){K("#wcp_folder_parent").html(aj.options);K(".form-loader-count").css("width","0");ac();V();P()}else{K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html(aj.message);K("#error-folder-popup").show();window.location.reload(true)}}})}}))}function o(){K("#js-tree-menu .jstree-node").each(function(){var ai=parseInt(K(this).data("count"));if(ai>0){K(".jstree-node[id='"+K(this).attr("id")+"'] > a span.premio-folder-count").text(ai)}var ah={folder_id:K(this).attr("id"),folder_count:ai,is_sticky:K(this).hasClass("is-sticky")?1:0,is_high:K(this).hasClass("is-high")?1:0,nonce:K(this).data("nonce"),slug:K(this).data("slug"),is_deleted:0};z.push(ah)});if(c!=""&&c!=0){if(K(".jstree-node[id='"+c+"']").length){K("#js-tree-menu").jstree("select_node",c);if(K(".sticky-folders .sticky-folder-"+c+" a").length){K(".sticky-folders .sticky-folder-"+c+" a").addClass("active-item")}}}K(".ajax-preloader").hide();K(".js-tree-data").show();U();w();if(K(".sticky-folders ul > li").length>0){K(".sticky-folders").addClass("active")}}function ad(ah,ai){if(z.length>0){for(i=0;i<z.length;i++){if(parseInt(z[i]["folder_id"])==parseInt(ah)){return z[i][ai]}}}return""}function t(ah){if(z.length>0){for(i=0;i<z.length;i++){if(parseInt(z[i]["folder_id"])==parseInt(ah)){return i}}}return null}function w(){K(".sticky-folders > ul").html("");var ah="";K("#js-tree-menu li.jstree-node.is-sticky").each(function(){var ak=K(this).attr("id");var al=K.trim(K("#js-tree-menu").jstree(true).get_node(ak).text);var am=K("#"+ak+"_anchor .premio-folder-count").text();var aj=K("li.jstree-node[id='"+ak+"']").hasClass("is-high")?" is-high ":"";ah+="<li data-folder-id='"+ak+"' class='sticky-fldr "+aj+" sticky-folder-"+ak+"'><a href='javascript:;'><span class='folder-title'>"+al+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'></span></span></a></li>"});K(".sticky-folders > ul").html(ah);if(K(".jstree-anchor.jstree-clicked").length){var ai=K(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");K(".sticky-folders .sticky-folder-"+ai+" a").addClass("active-item")}if(K(".sticky-folders > ul > li").length>0){K(".sticky-folders").addClass("active")}else{K(".sticky-folders").removeClass("active")}U()}function U(){}function m(){if(K("#folder-hide-show-checkbox").is(":checked")){if(K("#js-tree-menu input.checkbox:checked").length>0){var ah="";var ai=false;K("#js-tree-menu input.checkbox:checked").each(function(){ah+=K(this).closest("li.jstree-node").attr("id")+",";if(K(this).closest("li.jstree-node").hasClass("jstree-clicked")){ai=true}});K(".form-loader-count").css("width","100%");K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_muliple_folder&term_id="+ah+"&nonce="+folders_media_options.nonce,method:"post",success:function(aj){aj=K.parseJSON(aj);K(".form-loader-count").css("width","0px");if(aj.status=="1"){k=parseInt(aj.is_key_active);G=parseInt(aj.folders);K("#current-folder").text(G);for(i=0;i<aj.term_ids.length;i++){K(".folder-modal #js-tree-menu").jstree().delete_node(aj.term_ids[i])}K("#ttl-fldr").text((4*2)+(4/2));V();K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");ac();w();V();if(!K(".folder-modal #wcp_folder_"+c).length){K(".header-posts a").trigger("click");c=0}}else{window.location.reload()}K("#folder-hide-show-checkbox").attr("checked",false);K("#js-tree-menu input.checkbox").attr("checked",false);K("#js-tree-menu").removeClass("show-folder-checkbox")}})}else{}}}function ac(){if(K(".media-toolbar").hasClass("media-toolbar-mode-select")){if(K("ul.attachments li.selected").length){K("ul.attachments li.selected").trigger("click");K(".select-mode-toggle-button").trigger("click")}}if(s!=""&&(K("#js-tree-menu a.jstree-clicked").length>0||c=="-1")){if(K("#media-attachment-taxonomy-filter").length){s=s.split(",");for(var ah=0;ah<s.length;ah++){if(s[ah]!=""){K(".attachments-browser li[data-id='"+s[ah]+"']").remove()}}}s=""}if(K("#media-attachment-taxonomy-filter").length){D(0)}else{K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=get_folders_default_list",method:"post",success:function(ai){ai=K.parseJSON(ai);K(".header-posts .total-count").text(ai.total_items);K(".un-categorised-items .total-count").text(ai.empty_items);aa=ai.taxonomies;P()}});K(".folder-loader-ajax").addClass("active");if(K("#folder-posts-filter").length){K("#folder-posts-filter").load(g+" #posts-filter",function(){var ai={Title:"",Url:g};history.pushState(ai,ai.Title,ai.Url);if(folders_media_options.show_in_page=="show"&&!K(".tree-structure").length){K(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}triggerInlineUpdate()})}else{K("#wpbody").load(g+" #wpbody-content",false,function(ai){var aj={Title:"",Url:g};history.pushState(aj,aj.Title,aj.Url);if(folders_media_options.show_in_page=="show"&&!K(".tree-structure").length){K(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}})}}}function y(){var ah=K("#media-attachment-taxonomy-filter").val();h=K.ajax({url:folders_media_options.ajax_url,data:"type=attachment&action=wcp_get_default_list&active_id=0",method:"post",beforeSend:function(){if(h!=null){h.abort()}},success:function(ai){var ai=K.parseJSON(ai);aa=ai.taxonomies;P()}})}function P(){if(K("#media-attachment-taxonomy-filter").length){K("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=aa;var aj=K(this);currentDDVal=K(this).val();aj.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");M=aa;for(var ak=0;ak<aa.length;ak++){aj.append("<option value='"+aa[ak].term_id+"'>"+aa[ak].name+" ("+aa[ak].trash_count+")</option>")}aj.val(currentDDVal).trigger("change")});if(K("select.folder_for_media").length){var ai=K("select.folder_for_media").val();K("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var ah=0;ah<aa.length;ah++){K("select.folder_for_media option:last-child").before("<option value='"+aa[ah].term_id+"'>"+aa[ah].name+"</option>")}if(ai!=""){K(".folder_for_media").val(ai)}}}K("span.premio-folder-count").text("");K(".folder-count").text("");for(ah=0;ah<aa.length;ah++){if(parseInt(aa[ah].trash_count)!=0){K(".jstree-node[id='"+aa[ah].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(aa[ah].trash_count);K(".sticky-folder-"+aa[ah].term_id+" .premio-folder-count").text(aa[ah].trash_count)}}if(c!=""){K("#wcp_folder_"+c).addClass("active-item")}if(r){K("#title_"+d).trigger("click");r=false}}function I(){var ah=K.trim(K("#folder-search").val());K("#js-tree-menu").jstree("search",ah)}function Z(ah){var ai="Are you sure you want to delete the selected folder?";var aj="Items in the folder will not be deleted.";B=false;if(ah==1){if(K("#folder-hide-show-checkbox").is(":checked")){B=true;if(K("#js-tree-menu input.checkbox:checked").length==0){K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#error-folder-popup-message").html("Please select at least one folder to delete");K("#error-folder-popup").show();return}else{if(K("#js-tree-menu input.checkbox:checked").length>1){ai="Are you sure you want to delete the selected folders?";aj="Items in the selected folders will not be deleted."}}}}K(".folder-popup-form").hide();K(".folder-popup-form").removeClass("disabled");K("#remove-folder-item").text("Yes, Delete it!");K("#remove-folder-message").text(ai);K("#remove-folder-notice").text(aj);K("#confirm-remove-folder").show();K("#remove-folder-item").focus()}function T(){folderName=K.trim(K("#js-tree-menu").jstree(true).get_node(d).text);parentID=K("#wcp_folder_"+d).closest("li.jstree-node").data("folder-id");if(parentID==q){parentID=0}K("#update-folder-data").text("Submit");K(".folder-form-errors").removeClass("active");K("#update-folder-item-name").val(folderName);K("#update-folder-item").removeClass("disabled");K("#update-folder-item").show();K("#update-folder-item-name").focus();K(".dynamic-menu").remove()}function W(){if(k==0&&G>=((4*4)-(3*3)+(4/4)+(8/(2*2)))){K("#folder-limitation-message").html("You've reached the "+((4*4)-(2*2)-2)+" folder limitation!");K("#no-more-folder-credit").show();return false}K("#add-update-folder-title").text("Add new folder");K("#save-folder-data").text("Submit");K(".folder-form-errors").removeClass("active");K("#add-update-folder-name").val("");if(N){C=d;K("#add-update-folder-name").val(K.trim(K("#js-tree-menu").jstree(true).get_node(d).text)+" #2");if(K("#"+d+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")){d=K("#"+d+"_anchor").closest(".jstree-node").parent().parent().attr("id")}else{d=0}}K("#add-update-folder").removeClass("disabled");K("#add-update-folder").show();K("#add-update-folder-name").focus();K(".dynamic-menu").remove()}function E(){setTimeout(function(){var ah=true;if(K("#js-tree-menu .jstree-node.jstree-leaf").length==K("#js-tree-menu .jstree-node").length){K("#expand-collapse-list").removeClass("all-open");K("#expand-collapse-list").attr("data-folder-tooltip","Expand")}else{var ai=K("#js-tree-menu .jstree-node.jstree-closed").length+K("#js-tree-menu .jstree-node.jstree-open").length;if(K("#js-tree-menu .jstree-node.jstree-closed").length==ai){K("#expand-collapse-list").removeClass("all-open");K("#expand-collapse-list").attr("data-folder-tooltip","Expand")}else{K("#expand-collapse-list").addClass("all-open");K("#expand-collapse-list").attr("data-folder-tooltip","Collapse")}}},500)}var h;function D(ah){h=K.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_get_default_list&active_id="+c,method:"post",beforeSend:function(){if(h!=null){h.abort()}},success:function(ai){ai=K.parseJSON(ai);K(".header-posts .total-count").text(ai.total_items);K(".un-categorised-items .total-count").text(ai.empty_items);selectedVal=K("#media-attachment-taxonomy-filter").val();if(selectedVal!="all"&&ah==1){var aj=parent.wp;if(aj.media!=q){aj.media.frame.setState("insert");if(aj.media.frame.content.get()!==null){aj.media.frame.content.get().collection.props.set({ignore:(+new Date())});aj.media.frame.content.get().options.selection.reset()}else{aj.media.frame.library.props.set({ignore:(+new Date())})}}}aa=ai.taxonomies;P()}})}function j(ah){K.ajax({url:folders_media_options.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+folders_media_options.post_type+"&post_id="+ah+"&nonce="+folders_media_options.nonce,cache:false,async:false,success:function(){}})}function V(){K(".folder-loader-ajax").addClass("active");K(".folder-loader-ajax img").removeClass("active");K(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated");setTimeout(function(){K(".folder-loader-ajax").removeClass("active");K(".folder-loader-ajax img").addClass("active");K(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2000)}}));
|
1 |
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){var o=".folder-modal #js-tree-menu",s=[],a=-1,r=0,l=0,d="",n=-1,c=0,m="",p=folders_media_options.page_url,f="",u="",h=!1,v=!1,g=!1,y=0,j=0,w=[],k=wp.media.view.AttachmentFilters.extend({id:"media-attachment-taxonomy-filter",createFilters:function(){var e={};folders_media_options.terms.length;_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"All Folders",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e},change:function(){var e={};_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"Select a folder >>",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e;var t=this.filters[this.el.value];t&&this.model.set(t.props)}}),x=0,b=0,C=wp.media.view.AttachmentsBrowser;wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){C.prototype.createToolbar.call(this),this.toolbar.set("MediaLibraryOrganizerTaxonomyFilter",new k({controller:this.controller,model:this.collection.props,priority:-75}).render())}});var S,I=wp.media.model.Query;_.extend(I,{get:(S=[],function(e,t){var o,s={},a=I.orderby,r=I.defaultProps;return delete e.query,delete e.cache,_.defaults(e,r),_.each(["include","exclude"],function(t){e[t]&&!_.isArray(e[t])&&(e[t]=[e[t]])}),_.each(e,function(e,t){_.isNull(e)||(s[I.propmap[t]||t]=e)}),_.defaults(s,I.defaultArgs),s.orderby=a.valuemap[e.orderby]||e.orderby,S=[],o||(o=new I([],_.extend(t||{},{props:e,args:s})),S.push(o)),o})});var P=window.wp;void 0!==P&&"function"==typeof P.Uploader&&(P.media.view.Modal.prototype.on("open",function(){setTimeout(function(){e("#media-attachment-taxonomy-filter").length&&("all"==e("#media-attachment-taxonomy-filter").val()&&(e("#media-attachment-taxonomy-filter option:gt(1)").remove(),_.each(folders_media_options.terms,function(t,o){e("#media-attachment-taxonomy-filter").append("<option value='"+t.term_id+"'>"+t.name+" ("+t.trash_count+")</option>")})),e("#wcp-content").length||e(".editor-post-featured-image").length&&e(".attachment-filters").val("all").trigger("change"))},100)}),e.extend(P.Uploader.prototype,{progress:function(){},init:function(){this.uploader&&(this.uploader.bind("FileFiltered",function(t,o){x++,e(".folder-meter").css("width","0%"),e(".media-folder-loader").show(),e("#total_upload_files").text(x)}),this.uploader.bind("BeforeUpload",function(t,o){var s=a,r=t.settings.multipart_params;if((s=parseInt(s))>0&&(r.folder_for_media=s),b<x){e(".media-folder-loader").show();var i=b/x*100;e(".folder-meter").css("width",i+"%")}b++,e("#current_upload_files").text(b)}),this.uploader.bind("UploadComplete",function(e,t){a=-1}),this.uploader.bind("UploadComplete",function(t,o){var s=window.wp;e(".folder-meter").css("width","100%"),setTimeout(function(){e(".media-folder-loader").hide(),e(".folder-meter").css("width","0%"),x=0,b=0},1250),function(){e("#media-attachment-taxonomy-filter").val();D=e.ajax({url:folders_media_options.ajax_url,data:"type=attachment&action=wcp_get_default_list&active_id=0",method:"post",beforeSend:function(){null!=D&&D.abort()},success:function(t){var t=e.parseJSON(t);w=t.taxonomies,F()}})}(),void 0!==s.media.frame&&null!==s.media.frame.content.get()?(s.media.frame.content.get().collection.props.set({ignore:+new Date}),s.media.frame.content.get().options.selection.reset()):e("#media-attachment-taxonomy-filter").length&&e(".attachment-filters").each(function(){e(this).trigger("change")})}))}}));var D,N=window.wp;if(void 0!==N&&"function"==typeof N.Uploader){var A=window.wp.media,q=A.view.Modal;A.view.Modal=A.view.Modal.extend({className:"folder-modal",initialize:function(){q.prototype.initialize.apply(this,arguments)},open:function(){e(".folder-modal").removeClass("folder-modal"),q.prototype.open.apply(this,arguments)&&(e(".folder-modal").length?(e(".folder-custom-menu").remove(),e(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu"),e(".folder-modal .media-frame").hasClass("hide-menu")?e(".folder-custom-menu").length||(e(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>"),e(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){E(),O()})):e(".folder-custom-menu").length||(e(".folder-modal .media-frame-menu").addClass("has-folder-menu"),e(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>"),e(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){E(),O()})),e(".folder-form-data").remove(),e(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>"),e(".folder-form-data").load(folders_media_options.media_page_url+" #folder-add-update-content",function(){})):setTimeout(function(){-1!=a&&e("#media-attachment-taxonomy-filter").each(function(){e(this).val(a),e(this).trigger("change")})},1e3))},close:function(){q.prototype.close.apply(this,arguments),e(".folder-modal").removeClass("folder-modal")}})}function O(){e(o).jstree({core:{cache:!1,animation:0,check_callback:function(t,o,s,a,r){if(e("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up"),("move_node"===t||"copy_node"===t)&&r&&r.dnd)switch(r.pos){case"a":r.origin.get_node(r.ref,!0).addClass("drag-bot"),nodeId=e(".drag-bot").attr("id"),e("#jstree-dnd").text("Below "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"i":r.origin.get_node(r.ref,!0).addClass("drag-in"),nodeId=e(".drag-in").attr("id"),e("#jstree-dnd").text("Inside "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"b":r.origin.get_node(r.ref,!0).addClass("drag-up"),nodeId=e(".drag-up").attr("id"),e("#jstree-dnd").text("Above "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;default:e("#jstree-dnd").text(e("#jstree-dnd").data("txt"))}return!0}},data:{cache:!1},select_node:!1,search:{show_only_matches:!0,case_sensitive:!1,fuzzy:!1},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",function(){!function(){e("#js-tree-menu .jstree-node").each(function(){var t=parseInt(e(this).data("count"));t>0&&e(".jstree-node[id='"+e(this).attr("id")+"'] > a span.premio-folder-count").text(t)}),""!=f&&0!=f&&e(".jstree-node[id='"+f+"']").length&&(e("#js-tree-menu").jstree("select_node",f),e(".sticky-folders .sticky-folder-"+f+" a").length&&e(".sticky-folders .sticky-folder-"+f+" a").addClass("active-item"));e(".ajax-preloader").hide(),e(".js-tree-data").show(),T(),e(".sticky-folders ul > li").length>0&&e(".sticky-folders").addClass("active")}()}).bind("move_node.jstree",function(t,o){folderMoveId=o.node.id,orderString="",e(".folder-modal .jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){"undefined"!=e(this).attr("id")&&(orderString+=e(this).attr("id")+",")}),e(".folder-modal #"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?parentID=e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id"):parentID=0,""!=orderString&&(e(".form-loader-count").css("width","100%"),e.ajax({url:folders_media_options.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+folders_media_options.post_type+"&nonce="+folders_media_options.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#wcp_folder_parent").html(t.options),e(".form-loader-count").css("width","0"),H(),Q(),F()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))})}function U(e,t){if(s.length>0)for(i=0;i<s.length;i++)if(parseInt(s[i].folder_id)==parseInt(e))return s[i][t];return""}function J(e){if(s.length>0)for(i=0;i<s.length;i++)if(parseInt(s[i].folder_id)==parseInt(e))return i;return null}function T(){e(".sticky-folders > ul").html("");var t="";if(e("#js-tree-menu li.jstree-node.is-sticky").each(function(){var o=e(this).attr("id"),s=e.trim(e("#js-tree-menu").jstree(!0).get_node(o).text),a=(e("#"+o+"_anchor .premio-folder-count").text(),e("li.jstree-node[id='"+o+"']").hasClass("is-high")?" is-high ":"");t+="<li data-folder-id='"+o+"' class='sticky-fldr "+a+" sticky-folder-"+o+"'><a href='javascript:;'><span class='folder-title'>"+s+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'></span></span></a></li>"}),e(".sticky-folders > ul").html(t),e(".jstree-anchor.jstree-clicked").length){var o=e(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");e(".sticky-folders .sticky-folder-"+o+" a").addClass("active-item")}e(".sticky-folders > ul > li").length>0?e(".sticky-folders").addClass("active"):e(".sticky-folders").removeClass("active")}function H(){if(e(".media-toolbar").hasClass("media-toolbar-mode-select")&&e("ul.attachments li.selected").length&&(e("ul.attachments li.selected").trigger("click"),e(".select-mode-toggle-button").trigger("click")),""!=u&&(e("#js-tree-menu a.jstree-clicked").length>0||"-1"==f)){if(e("#media-attachment-taxonomy-filter").length){u=u.split(",");for(var t=0;t<u.length;t++)""!=u[t]&&e(".attachments-browser li[data-id='"+u[t]+"']").remove()}u=""}e("#media-attachment-taxonomy-filter").length?R(0):(e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=get_folders_default_list",method:"post",success:function(t){t=e.parseJSON(t),e(".header-posts .total-count").text(t.total_items),e(".un-categorised-items .total-count").text(t.empty_items),w=t.taxonomies,F()}}),e(".folder-loader-ajax").addClass("active"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(p+" #posts-filter",function(){var t={Title:"",Url:p};history.pushState(t,t.Title,t.Url),"show"!=folders_media_options.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),triggerInlineUpdate()}):e("#wpbody").load(p+" #wpbody-content",!1,function(t){var o={Title:"",Url:p};history.pushState(o,o.Title,o.Url),"show"!=folders_media_options.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}))}function F(){if(e("#media-attachment-taxonomy-filter").length&&(e("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=w;var t=e(this);currentDDVal=e(this).val(),t.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),w;for(var o=0;o<w.length;o++)t.append("<option value='"+w[o].term_id+"'>"+w[o].name+" ("+w[o].trash_count+")</option>");t.val(currentDDVal).trigger("change")}),e("select.folder_for_media").length)){var t=e("select.folder_for_media").val();e("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var o=0;o<w.length;o++)e("select.folder_for_media option:last-child").before("<option value='"+w[o].term_id+"'>"+w[o].name+"</option>");""!=t&&e(".folder_for_media").val(t)}for(e("span.premio-folder-count").text(""),e(".folder-count").text(""),o=0;o<w.length;o++)0!=parseInt(w[o].trash_count)&&(e(".jstree-node[id='"+w[o].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(w[o].trash_count),e(".sticky-folder-"+w[o].term_id+" .premio-folder-count").text(w[o].trash_count));""!=f&&e("#wcp_folder_"+f).addClass("active-item"),v&&(e("#title_"+l).trigger("click"),v=!1)}function M(){var t=e.trim(e("#folder-search").val());e("#js-tree-menu").jstree("search",t)}function V(t){var o="Are you sure you want to delete the selected folder?",s="Items in the folder will not be deleted.";if(h=!1,1==t&&e("#folder-hide-show-checkbox").is(":checked")){if(h=!0,0==e("#js-tree-menu input.checkbox:checked").length)return e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html("Please select at least one folder to delete"),void e("#error-folder-popup").show();e("#js-tree-menu input.checkbox:checked").length>1&&(o="Are you sure you want to delete the selected folders?",s="Items in the selected folders will not be deleted.")}e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#remove-folder-item").text("Yes, Delete it!"),e("#remove-folder-message").text(o),e("#remove-folder-notice").text(s),e("#confirm-remove-folder").show(),e("#remove-folder-item").focus()}function z(){folderName=e.trim(e("#js-tree-menu").jstree(!0).get_node(l).text),parentID=e("#wcp_folder_"+l).closest("li.jstree-node").data("folder-id"),parentID==t&&(parentID=0),e("#update-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#update-folder-item-name").val(folderName),e("#update-folder-item").removeClass("disabled"),e("#update-folder-item").show(),e("#update-folder-item-name").focus(),e(".dynamic-menu").remove()}function B(){if(0==c&&n>=10)return e("#folder-limitation-message").html("You've reached the 10 folder limitation!"),e("#no-more-folder-credit").show(),!1;e("#add-update-folder-title").text("Add new folder"),e("#save-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#add-update-folder-name").val(""),g&&(y=l,e("#add-update-folder-name").val(e.trim(e("#js-tree-menu").jstree(!0).get_node(l).text)+" #2"),l=e("#"+l+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?e("#"+l+"_anchor").closest(".jstree-node").parent().parent().attr("id"):0),e("#add-update-folder").removeClass("disabled"),e("#add-update-folder").show(),e("#add-update-folder-name").focus(),e(".dynamic-menu").remove()}function E(){setTimeout(function(){if(e("#js-tree-menu .jstree-node.jstree-leaf").length==e("#js-tree-menu .jstree-node").length)e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand");else{var t=e("#js-tree-menu .jstree-node.jstree-closed").length+e("#js-tree-menu .jstree-node.jstree-open").length;e("#js-tree-menu .jstree-node.jstree-closed").length==t?(e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand")):(e("#expand-collapse-list").addClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Collapse"))}},500)}function R(o){D=e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_get_default_list&active_id="+f,method:"post",beforeSend:function(){null!=D&&D.abort()},success:function(s){if(s=e.parseJSON(s),e(".header-posts .total-count").text(s.total_items),e(".un-categorised-items .total-count").text(s.empty_items),selectedVal=e("#media-attachment-taxonomy-filter").val(),"all"!=selectedVal&&1==o){var a=parent.wp;a.media!=t&&(a.media.frame.setState("insert"),null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):a.media.frame.library.props.set({ignore:+new Date}))}w=s.taxonomies,F()}})}function Q(){e(".folder-loader-ajax").addClass("active"),e(".folder-loader-ajax img").removeClass("active"),e(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated"),setTimeout(function(){e(".folder-loader-ajax").removeClass("active"),e(".folder-loader-ajax img").addClass("active"),e(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2e3)}e(document).ready(function(){w=folders_media_options.terms,c=parseInt(folders_media_options.is_key_active),n=parseInt(folders_media_options.folders),s=folders_media_options.folder_settings,e(document).on("click",".header-posts a.all-posts",function(t){l=0,f="",a="all",e(".active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e(this).addClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change"),e(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change")}),e(document).on("click",".un-categorised-items",function(t){l=0,f="",a="unassigned",e(".active-item").removeClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e(this).addClass("active-item"),e(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change"),e(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change")}),e(document).on("click","a.jstree-anchor",function(t){var o,s=e(this).closest("li.jstree-node").attr("id");a=l=s,e(".active-item").removeClass("active-item"),e("#media-attachment-taxonomy-filter").val(s),e("#media-attachment-taxonomy-filter").trigger("change"),thisSlug=U(s,"slug"),o=thisSlug,e.ajax({url:folders_media_options.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+folders_media_options.post_type+"&post_id="+o+"&nonce="+folders_media_options.nonce,cache:!1,async:!1,success:function(){}}),e(".custom-media-select").removeClass("active")}),e(document).on("change",".folder_for_media",function(){"add-folder"!=e(this).val()&&null!=e(this).val()?a=e(this).val():"add-folder"==e(this).val()&&(a=-1)}),e(document).on("click",".update-inline-record",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=folders_media_options.can_manage_folder&&(isHigh=e(this).closest("li.sticky-fldr").hasClass("is-high"),isSticky=e(this).closest("li.sticky-fldr").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("li.jstree-node").find("h3.title:first > .total-count").text()),"attachment"==folders_media_options.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("li").append(menuHtml),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click","body, html",function(t){e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e(".folder-order").removeClass("active")}),e(document).on("click",".dynamic-menu, .folder-order",function(e){e.stopPropagation()}),e(document).on("contextmenu",".jstree-anchor",function(t){return e(this).find("span.folder-inline-edit").trigger("click"),!1}),e(document).on("click",".folder-actions span.folder-inline-edit",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=folders_media_options.can_manage_folder&&(isHigh=e(this).closest("li.jstree-node").hasClass("is-high"),isSticky=e(this).closest("li.jstree-node").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("a.jstree-anchor").find(".premio-folder-count").text()),"attachment"==folders_media_options.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("a.jstree-anchor").after(menuHtml),e(this).parents("li.jstree-node").addClass("active-menu"),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".dynamic-menu",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","body, html",function(){e(".dynamic-menu").remove()}),e(document).on("click",".new-folder",function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),v=!1,g=!1,B()}),e(document).on("click","#add-new-folder",function(t){l=e("#custom-menu li.active-item").length?e("#custom-menu li.active-item").data("folder-id"):0,v=!1,B()}),e(document).on("submit","#save-folder-form",function(t){if(t.stopPropagation(),t.preventDefault(),d=e("#add-update-folder-name").val(),""==e.trim(d))e(".folder-form-errors").addClass("active"),e("#add-update-folder-name").focus();else{e("#save-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#add-update-folder").addClass("disabled");var o=l;v&&(o=0),j=0==o?e("#js-tree-menu > ul > li.jstree-node").length:e("#js-tree-menu > ul > li.jstree-node[id='"+o+"'] > ul.jstree-children > li").length+1,e.ajax({url:folders_media_options.ajax_url,data:{parent_id:o,type:folders_media_options.post_type,action:"wcp_add_new_folder",nonce:folders_media_options.nonce,term_id:o,order:j,name:d,is_duplicate:g,duplicate_from:y},method:"post",success:function(t){if(result=e.parseJSON(t),"1"==result.status){c=parseInt(result.is_key_active),n=parseInt(result.folders),e("#current-folder").text(n),e("#ttl-fldr").text(10),E(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled");var o={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};s.push(o),Q(),T(),e("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){e(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce),e(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)}),l=result.term_id,R(0)}else e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show()}})}return!1}),e(document).on("click",".form-cancel-btn",function(){e(".folder-popup-form").hide()}),e(document).on("click",".folder-popup-form",function(t){e(".folder-popup-form").hide()}),e(document).on("click",".popup-form-content",function(e){e.stopPropagation()}),document.onkeydown=function(t){("key"in(t=t||window.event)?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&e(".folder-popup-form").hide()},e(".rename-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),z(),e(".dynamic-menu").remove()})}),e(document).on("click","#inline-update",function(t){e("#js-tree-menu a.jstree-clicked").length&&(l=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),z())}),e(document).on("submit","#update-folder-form",function(o){return o.stopPropagation(),o.preventDefault(),d=e("#update-folder-item-name").val(),""==e.trim(d)?(e(".folder-form-errors").addClass("active"),e("#update-folder-item-name").focus()):(e("#update-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#update-folder-item").addClass("disabled"),m=U(l,"nonce"),parentID=e(".jstree-node[id='"+l+"']").closest("li.jstree-node").attr("id"),parentID==t&&(parentID=0),e.ajax({url:folders_media_options.ajax_url,data:{parent_id:parentID,type:folders_media_options.post_type,action:"wcp_update_folder",nonce:m,term_id:l,order:j,name:d},method:"post",success:function(t){result=e.parseJSON(t),"1"==result.status?(e("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title),folderPostId=J(result.id),null!=folderPostId&&(s[folderPostId].nonce=result.nonce,s[folderPostId].slug=result.slug),e(".folder-popup-form").hide(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),Q(),e("#media-attachment-taxonomy-filter").length&&R(0)):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show())}})),!1}),e(".mark-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),r=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),m=U(r,"nonce"),e(".form-loader-count").css("width","100%"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e.ajax({url:folders_media_options.ajax_url,data:"term_id="+r+"&type="+folders_media_options.post_type+"&action=wcp_mark_un_mark_folder&nonce="+m,method:"post",cache:!1,success:function(t){t=e.parseJSON(t),e(".form-loader-count").css("width","0%"),"1"==t.status?(folderPostId=J(t.id),"1"==t.marked?(e("li.jstree-node[id='"+t.id+"']").addClass("is-high"),e(".sticky-folder-"+t.id).addClass("is-high"),null!=folderPostId&&(s[folderPostId].is_high=1)):(e("li.jstree-node[id='"+t.id+"']").removeClass("is-high"),e(".sticky-folder-"+t.id).removeClass("is-high"),null!=folderPostId&&(s[folderPostId].is_high=0)),Q()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})}),e(".duplicate-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),v=!1,g=!0,B()})}),e(".remove-folder").livequery(function(){e(this).click(function(){r=e(this).closest("li.jstree-node").data("id"),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),V(0),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")})}),e(document).on("click","#remove-folder-item",function(t){t.stopPropagation(),e(".folder-popup-form").addClass("disabled"),e("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>'),m=U(l,"nonce"),h?function(){if(e("#folder-hide-show-checkbox").is(":checked")&&e("#js-tree-menu input.checkbox:checked").length>0){var t="";e("#js-tree-menu input.checkbox:checked").each(function(){t+=e(this).closest("li.jstree-node").attr("id")+",",e(this).closest("li.jstree-node").hasClass("jstree-clicked")&&!0}),e(".form-loader-count").css("width","100%"),e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_muliple_folder&term_id="+t+"&nonce="+folders_media_options.nonce,method:"post",success:function(t){if(t=e.parseJSON(t),e(".form-loader-count").css("width","0px"),"1"==t.status){for(c=parseInt(t.is_key_active),n=parseInt(t.folders),e("#current-folder").text(n),i=0;i<t.term_ids.length;i++)e(".folder-modal #js-tree-menu").jstree().delete_node(t.term_ids[i]);e("#ttl-fldr").text(10),Q(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),H(),T(),Q(),e(".folder-modal #wcp_folder_"+f).length||(e(".header-posts a").trigger("click"),f=0)}else window.location.reload();e("#folder-hide-show-checkbox").attr("checked",!1),e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox")}})}}():e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_folder&term_id="+l+"&nonce="+m,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#js-tree-menu").jstree().delete_node(l),c=parseInt(t.is_key_active),n=parseInt(t.folders),e("#current-folder").text(n),e("#ttl-fldr").text(10),e(".sticky-folders .sticky-folder-"+l).remove(),Q(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),H(),T(),f==l&&e(".header-posts").trigger("click")):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})}),e(document).on("click","#sort-order-list",function(t){t.stopPropagation(),e(".folder-order").toggleClass("active")}),e(document).on("click","#expand-collapse-list",function(t){t.stopPropagation();var o=0;e(this).hasClass("all-open")?(e(this).removeClass("all-open"),o=0,e(this).attr("data-folder-tooltip","Expand"),e("#js-tree-menu").jstree("close_all")):(e(this).addClass("all-open"),o=1,e(this).attr("data-folder-tooltip","Collapse"),e("#js-tree-menu").jstree("open_all")),u="",e("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){u+=e(this).attr("id")+","}),""!=u&&(e(".form-loader-count").css("width","100%"),m=folders_media_options.nonce,e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_change_all_status&status="+o+"&folders="+u+"&nonce="+m,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=e.parseJSON(t)).status&&(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))}),e(document).on("click",".folder-sort-menu a",function(t){t.stopPropagation(),t.preventDefault(),e(".form-loader-count").css("width","100%"),e(".folder-order").removeClass("active"),e(this).attr("data-sort"),e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_folders_by_order&nonce="+folders_media_options.nonce+"&order="+e(this).attr("data-sort"),method:"post",success:function(t){1==(t=e.parseJSON(t)).status&&(e("#js-tree-menu").jstree().destroy(),e("#js-tree-menu").append("<ul></ul>"),e("#js-tree-menu ul").html(t.data),w=t.terms,F(),O()),e(".form-loader-count").css("width","0")}})}),e(".jstree-anchor").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){r=e(this).closest("li.jstree-node").attr("id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),m=U(r,"nonce"),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?H():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,m=U(r,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?H():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,m=U(r,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),u=chkStr,e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H(),Q()}}))}})}),e(".media-frame:not(.hide-router) .attachments-browser li.attachment").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,o){e(".selected-items").remove();var s=e(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length;return e("<div class='selected-items'><span class='total-post-count'>"+(s=0==s||1==s?"1 Item":s+" Items")+" Selected</span></div>")},start:function(t,o){e("body").addClass("no-hover-css")},cursor:"move",appendTo:".media-modal",cursorAt:{left:0,top:0},stop:function(t,o){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".un-categorised-items").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){r=-1,m=folders_media_options.nonce,o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H()}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,chkStr=postID+",",e(".wp-list-table input:checked").each(function(){postID!=e(this).val()&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),u=chkStr,e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H()}}))}})}),e(".tree-structure .folder-item").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){e("body").removeClass("no-hover-css"),r=e(this).data("id"),o.draggable.hasClass("wcp-move-multiple")?(m=U(r,"nonce"),e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H(),Q()}}))):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,m=U(r,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H(),Q()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,m=U(r,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){H(),Q()}}))}})}),e(".wcp-move-file").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(t,o){e(this).closest("td").addClass("wcp-draggable"),e("body").addClass("no-hover-css")},stop:function(t,o){e(this).closest("td").removeClass("wcp-draggable"),e("body").removeClass("no-hover-css")}})}),e(".wcp-move-multiple").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,o){return e(".selected-items").remove(),selectedItems=e("#the-list th input:checked").length,selectedItems>0?(selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")):e("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")},start:function(t,o){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,o){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".jstree-node .jstree-icon").livequery(function(){e(this).click(function(){r=e(this).closest("li.jstree-node").attr("id"),e("li.jstree-node[id='"+r+"']").hasClass("jstree-open")?folderStatus=0:folderStatus=1,e(".form-loader-count").css("width","100%"),m=U(r,"nonce"),E(),e.ajax({url:folders_media_options.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+r+"&nonce="+m,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=e.parseJSON(t)).status||(e("#wcp_folder_"+r).hasClass("active")?(e("#wcp_folder_"+r).removeClass("active"),e("#wcp_folder_"+r).find("ul.ui-sortable:first-child > li").slideUp(),folderStatus=0):(e("#wcp_folder_"+r).addClass("active"),e("#wcp_folder_"+r).find("ul.ui-sortable:first-child > li").slideDown(),folderStatus=1),Q())}})})}),e(document).on("keyup","#folder-search",function(){M()}),e(document).on("change","#folder-search",function(){M()}),e(document).on("blur","#folder-search",function(){M()}),e(document).on("click","#folder-hide-show-checkbox",function(){e(this).is(":checked")?e("#js-tree-menu").addClass("show-folder-checkbox"):(e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox"))}),e(document).on("click",".folder-checkbox, .input-checkbox",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","#inline-remove",function(){e("#js-tree-menu a.jstree-clicked").length?(l=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),V(1),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")):e("#folder-hide-show-checkbox").is(":checked")&&(e(".dynamic-menu").remove(),V(1))}),e(document).on("change",".folder_for_media",function(){"add-folder"==e(this).val()&&(v=!0,e("#add-new-folder").trigger("click"))})})});
|
folders.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
-
* Version: 2.6
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
@@ -30,7 +30,7 @@ if(!defined("WCP_FOLDER_URL")) {
|
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
-
define('WCP_FOLDER_VERSION', "2.6");
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
+
* Version: 2.6.1
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
+
define('WCP_FOLDER_VERSION', "2.6.1");
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
includes/class-affiliate.php
CHANGED
@@ -90,7 +90,7 @@ class Folder_affiliate_program {
|
|
90 |
right: 0;
|
91 |
-webkit-border-radius: 5px;
|
92 |
-moz-border-radius: 5px;
|
93 |
-
border-radius: 5px
|
94 |
}
|
95 |
.<?php echo $this->plugin_slug ?>-affiliate-title {
|
96 |
padding: 0 0 10px 0;
|
90 |
right: 0;
|
91 |
-webkit-border-radius: 5px;
|
92 |
-moz-border-radius: 5px;
|
93 |
+
border-radius: 5px;
|
94 |
}
|
95 |
.<?php echo $this->plugin_slug ?>-affiliate-title {
|
96 |
padding: 0 0 10px 0;
|
includes/folders.class.php
CHANGED
@@ -948,11 +948,28 @@ class WCP_Folders
|
|
948 |
$show_in_page = false;
|
949 |
$admin_url = admin_url("upload.php?post_type=attachment&media_folder=");
|
950 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
wp_enqueue_script('folders-livequery', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
952 |
wp_enqueue_script('folders-tree', WCP_FOLDER_URL . 'assets/js/jstree.min.js', array(), WCP_FOLDER_VERSION, true);
|
953 |
wp_enqueue_script('folders-media', WCP_FOLDER_URL . 'assets/js/page-post-media.min.js', array('media-editor', 'media-views', 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION, true);
|
954 |
wp_localize_script('folders-media', 'folders_media_options', array(
|
955 |
-
'terms' =>
|
956 |
'taxonomy' => get_taxonomy('media_folder'),
|
957 |
'ajax_url' => admin_url("admin-ajax.php"),
|
958 |
'media_page_url' => admin_url("upload.php"),
|
@@ -973,6 +990,7 @@ class WCP_Folders
|
|
973 |
'selected_taxonomy' => $selected_taxonomy,
|
974 |
'show_in_page' => $show_in_page,
|
975 |
'svg_file' => WCP_FOLDER_URL . 'assets/images/pin.png',
|
|
|
976 |
));
|
977 |
/* Free/Pro URL Change */
|
978 |
wp_enqueue_style('folders-jstree', WCP_FOLDER_URL . 'assets/css/jstree.min.css', array(), WCP_FOLDER_VERSION);
|
@@ -2758,7 +2776,7 @@ class WCP_Folders
|
|
2758 |
wp_enqueue_script('wcp-folders-alert', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
2759 |
// wp_register_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/custom.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
2760 |
wp_enqueue_script('wcp-folders-jstree', plugin_dir_url(dirname(__FILE__)) . 'assets/js/jstree.min.js', array('jquery'), WCP_FOLDER_VERSION);
|
2761 |
-
wp_enqueue_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/folders.
|
2762 |
|
2763 |
|
2764 |
$post_type = self::get_custom_post_type($typenow);
|
@@ -2818,6 +2836,21 @@ class WCP_Folders
|
|
2818 |
}
|
2819 |
$taxonomies = self::get_terms_hierarchical($post_type);
|
2820 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2821 |
$response['terms'] = $taxonomies;
|
2822 |
wp_localize_script('wcp-folders-custom', 'wcp_settings', array(
|
2823 |
'ajax_url' => admin_url('admin-ajax.php'),
|
@@ -2838,6 +2871,7 @@ class WCP_Folders
|
|
2838 |
'show_in_page' => $show_in_page,
|
2839 |
'svg_file' => WCP_FOLDER_URL.'assets/images/pin.png',
|
2840 |
'taxonomies' => $taxonomies,
|
|
|
2841 |
));
|
2842 |
} else {
|
2843 |
self::is_add_update_screen();
|
948 |
$show_in_page = false;
|
949 |
$admin_url = admin_url("upload.php?post_type=attachment&media_folder=");
|
950 |
|
951 |
+
$taxonomies = self::get_terms_hierarchical('media_folder');
|
952 |
+
|
953 |
+
$folder_settings = array();
|
954 |
+
foreach($taxonomies as $taxonomy) {
|
955 |
+
$is_sticky = get_term_meta($taxonomy->term_id, "is_folder_sticky", true);
|
956 |
+
$is_high = get_term_meta($taxonomy->term_id, "is_highlighted", true);
|
957 |
+
$folder_settings[] = array(
|
958 |
+
'folder_id' => $taxonomy->term_id,
|
959 |
+
'is_sticky' => intval($is_sticky),
|
960 |
+
'is_high' => intval($is_high),
|
961 |
+
'nonce' => wp_create_nonce('wcp_folder_term_'.$taxonomy->term_id),
|
962 |
+
'is_deleted' => 0,
|
963 |
+
'slug' => $taxonomy->slug,
|
964 |
+
'folder_count' => intval($taxonomy->trash_count)
|
965 |
+
);
|
966 |
+
}
|
967 |
+
|
968 |
wp_enqueue_script('folders-livequery', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
969 |
wp_enqueue_script('folders-tree', WCP_FOLDER_URL . 'assets/js/jstree.min.js', array(), WCP_FOLDER_VERSION, true);
|
970 |
wp_enqueue_script('folders-media', WCP_FOLDER_URL . 'assets/js/page-post-media.min.js', array('media-editor', 'media-views', 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION, true);
|
971 |
wp_localize_script('folders-media', 'folders_media_options', array(
|
972 |
+
'terms' => $taxonomies,
|
973 |
'taxonomy' => get_taxonomy('media_folder'),
|
974 |
'ajax_url' => admin_url("admin-ajax.php"),
|
975 |
'media_page_url' => admin_url("upload.php"),
|
990 |
'selected_taxonomy' => $selected_taxonomy,
|
991 |
'show_in_page' => $show_in_page,
|
992 |
'svg_file' => WCP_FOLDER_URL . 'assets/images/pin.png',
|
993 |
+
'folder_settings' => $folder_settings
|
994 |
));
|
995 |
/* Free/Pro URL Change */
|
996 |
wp_enqueue_style('folders-jstree', WCP_FOLDER_URL . 'assets/css/jstree.min.css', array(), WCP_FOLDER_VERSION);
|
2776 |
wp_enqueue_script('wcp-folders-alert', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
2777 |
// wp_register_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/custom.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
2778 |
wp_enqueue_script('wcp-folders-jstree', plugin_dir_url(dirname(__FILE__)) . 'assets/js/jstree.min.js', array('jquery'), WCP_FOLDER_VERSION);
|
2779 |
+
wp_enqueue_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/folders.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
2780 |
|
2781 |
|
2782 |
$post_type = self::get_custom_post_type($typenow);
|
2836 |
}
|
2837 |
$taxonomies = self::get_terms_hierarchical($post_type);
|
2838 |
|
2839 |
+
$folder_settings = array();
|
2840 |
+
foreach($taxonomies as $taxonomy) {
|
2841 |
+
$is_sticky = get_term_meta($taxonomy->term_id, "is_folder_sticky", true);
|
2842 |
+
$is_high = get_term_meta($taxonomy->term_id, "is_highlighted", true);
|
2843 |
+
$folder_settings[] = array(
|
2844 |
+
'folder_id' => $taxonomy->term_id,
|
2845 |
+
'is_sticky' => intval($is_sticky),
|
2846 |
+
'is_high' => intval($is_high),
|
2847 |
+
'nonce' => wp_create_nonce('wcp_folder_term_'.$taxonomy->term_id),
|
2848 |
+
'is_deleted' => 0,
|
2849 |
+
'slug' => $taxonomy->slug,
|
2850 |
+
'folder_count' => intval($taxonomy->trash_count)
|
2851 |
+
);
|
2852 |
+
}
|
2853 |
+
|
2854 |
$response['terms'] = $taxonomies;
|
2855 |
wp_localize_script('wcp-folders-custom', 'wcp_settings', array(
|
2856 |
'ajax_url' => admin_url('admin-ajax.php'),
|
2871 |
'show_in_page' => $show_in_page,
|
2872 |
'svg_file' => WCP_FOLDER_URL.'assets/images/pin.png',
|
2873 |
'taxonomies' => $taxonomies,
|
2874 |
+
'folder_settings' => $folder_settings
|
2875 |
));
|
2876 |
} else {
|
2877 |
self::is_add_update_screen();
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: galdub, tomeraharon, premio
|
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories, media library folders, media library folder
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.5
|
6 |
-
Stable tag: 2.6
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage your Media library files, Pages, Posts, and Custom Posts in folders
|
@@ -162,6 +162,9 @@ A live demo for the Folders plugin is available at <a href="https://demo.premio.
|
|
162 |
|
163 |
== Changelog ==
|
164 |
|
|
|
|
|
|
|
165 |
= 2.6 =
|
166 |
Gallery related bugs and items-counter issues were fixed
|
167 |
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories, media library folders, media library folder
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.5
|
6 |
+
Stable tag: 2.6.1
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage your Media library files, Pages, Posts, and Custom Posts in folders
|
162 |
|
163 |
== Changelog ==
|
164 |
|
165 |
+
= 2.6.1 =
|
166 |
+
Various bugs fixed
|
167 |
+
|
168 |
= 2.6 =
|
169 |
Gallery related bugs and items-counter issues were fixed
|
170 |
|
templates/admin/admin-content.php
CHANGED
@@ -29,6 +29,12 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
29 |
.ui-resizable-handle.ui-resizable-e:before, .ui-resizable-handle.ui-resizable-w:before {border-color: <?php echo esc_attr($customize_folders['new_folder_color']) ?>;}
|
30 |
<?php
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
if(isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
33 |
$rgbColor = self::hexToRgb($customize_folders['folder_bg_color']);
|
34 |
?>
|
@@ -56,12 +62,6 @@ if(isset($customize_folders['folder_bg_color']) && !empty($customize_folders['fo
|
|
56 |
.jstree-node.drag-in > a.jstree-anchor.jstree-hovered { background-color: <?php echo esc_attr($customize_folders['folder_bg_color']) ?> !important; color: #ffffff; }
|
57 |
<?php
|
58 |
}
|
59 |
-
if(isset($customize_folders['bulk_organize_button_color']) && !empty($customize_folders['bulk_organize_button_color'])) {
|
60 |
-
?>
|
61 |
-
button.button.organize-button { background-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; border-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; }
|
62 |
-
button.button.organize-button:hover { background-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; border-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; }
|
63 |
-
<?php
|
64 |
-
}
|
65 |
$font_family = "";
|
66 |
if(isset($customize_folders['folder_font']) && !empty($customize_folders['folder_font'])) {
|
67 |
$font_family = $customize_folders['folder_font'];
|
29 |
.ui-resizable-handle.ui-resizable-e:before, .ui-resizable-handle.ui-resizable-w:before {border-color: <?php echo esc_attr($customize_folders['new_folder_color']) ?>;}
|
30 |
<?php
|
31 |
}
|
32 |
+
if(isset($customize_folders['bulk_organize_button_color']) && !empty($customize_folders['bulk_organize_button_color'])) {
|
33 |
+
?>
|
34 |
+
button.button.organize-button { background-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; border-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; }
|
35 |
+
button.button.organize-button:hover { background-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; border-color: <?php echo esc_attr($customize_folders['bulk_organize_button_color']) ?>; }
|
36 |
+
<?php
|
37 |
+
}
|
38 |
if(isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
39 |
$rgbColor = self::hexToRgb($customize_folders['folder_bg_color']);
|
40 |
?>
|
62 |
.jstree-node.drag-in > a.jstree-anchor.jstree-hovered { background-color: <?php echo esc_attr($customize_folders['folder_bg_color']) ?> !important; color: #ffffff; }
|
63 |
<?php
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
$font_family = "";
|
66 |
if(isset($customize_folders['folder_font']) && !empty($customize_folders['folder_font'])) {
|
67 |
$font_family = $customize_folders['folder_font'];
|