Changeset 1192116
- Timestamp:
- 07/03/2015 11:13:44 PM (11 years ago)
- Location:
- gallery-factory-lite/trunk
- Files:
-
- 2 added
- 5 edited
-
admin/js/gallery-manager-tour.min.js (modified) (1 diff)
-
admin/js/gallery-manager.js (modified) (1 diff)
-
admin/js/gallery-manager.min.js (modified) (1 diff)
-
frontend/js/imagelightbox.min.js (added)
-
frontend/js/script.min.js (added)
-
gallery-factory.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gallery-factory-lite/trunk/admin/js/gallery-manager-tour.min.js
r1181499 r1192116 1 var VLS_GF = VLS_GF || {}; 2 VLS_GF.TourModule = function (c) { 3 function m() { 4 l = !1; 5 d.remove(); 6 c("body").off("wheel.vls-gf mousewheel.vls-gf touchmove.vls-gf"); 7 c.post(ajaxurl, {action: "vls_gf_disable_tour"}); 8 VLS_GF.AlbumsPanelModule.loadGalleryTree(); 9 c(".left-panel .fixed-items .unsorted a").trigger("click") 10 } 11 12 function p() { 13 if (!e)switch (f++, d.find(".vls-gf-tour-progress span").eq(f - 1).addClass("done"), d.find(".vls-gf-tour-message").remove(), f) { 14 case 1: 15 d.find(".vls-gf-tour-welcome-message").remove(); 16 a(".vls-gf-gallery-manager-container .left-panel", "r", 17 210, "This is the Albums Panel. Here you can navigate your image collection and manage albums"); 18 b(".vls-gf-gallery-manager-container .left-panel", 0, 0, 0, 0); 19 break; 20 case 2: 21 q(); 22 break; 23 case 3: 24 a("#vls-gf-btn-edit-gallery-tree", "r", 200, "Add, sort, move, rename or delete folders and albums by activating edit mode."); 25 b("#vls-gf-btn-edit-gallery-tree", 4, 4, 4, 4); 26 break; 27 case 4: 28 r(); 29 break; 30 case 5: 31 a("#vls-gf-btn-add-new-album", "r", 210, "Add a folder or an album by clicking these buttons"); 32 b("#vls-gf-btn-add-new-folder", 33 0, 120, 0, 0); 34 break; 35 case 6: 36 a("#vls-gf-gallery-tree", "r", 200, "To rename a folder or an album click these buttons."); 37 b("#vls-gf-gallery-tree", 0, -29, 0, -195); 38 break; 39 case 7: 40 a("#vls-gf-gallery-tree", "r", 200, "To delete a folder or an album click these buttons."); 41 b("#vls-gf-gallery-tree", 0, 0, 0, -214); 42 break; 43 case 8: 44 t(); 45 break; 46 case 9: 47 a("#vls-gf-tab-panel", "l", 200, "There are three tabs available. Overview tab opens by default when you switch the active album."); 48 b("#vls-gf-tab-panel", 0, 0, 0, 0); 49 break; 50 case 10: 51 a(".vls-gf-right-panel .vls-gf-tab-view", 52 "l", 200, "Overview tab shows all album's images. Here you can upload and delete images, move them between albums and edit image's details.", 100); 53 b(".vls-gf-right-panel .vls-gf-tab-view", 0, 0, 0, 0); 54 break; 55 case 11: 56 a(".vls-gf-right-panel .vls-gf-image-panel li:eq(0)", "r", 200, 'Click on a thumbnail to open the image details editing dialog. Drag thumbnail to the album in the Albums Panel to move it to another album or to the "Unsorted images" folder.'); 57 b(".vls-gf-right-panel .vls-gf-image-panel li:eq(0)", 0, 58 0, 0, 0); 59 break; 60 case 12: 61 a("#vls-gf-upload-image-button:parent", "r", 200, "Upload images to the active album"); 62 b("#vls-gf-upload-image-button:parent", 0, 0, 0, 0); 63 break; 64 case 13: 65 a("#vls-gf-bulk-select-start-button:parent", "l", 200, "Activate bulk select mode to enable selecting multiple images and moving or deleting them at once."); 66 b("#vls-gf-bulk-select-start-button:parent", 0, 0, 0, 0); 67 break; 68 case 14: 69 a("#vls-gf-tab-panel li:eq(1)", "l", 200, "Click this tab to switch to the layout editor for the current album."); 70 b("#vls-gf-tab-panel li:eq(1)", 71 0, 0, 0, 0); 72 break; 73 case 15: 74 u(); 75 break; 76 case 16: 77 a(".vls-gf-tab-view .vls-gf-tab-container-side", "l", 200, "Here you can set the layout options. The layout view is updated immediately on the change so you can see the result."); 78 b(".vls-gf-tab-view .vls-gf-tab-container-side", 6, 6, 6, 6); 79 break; 80 case 17: 81 a(".vls-gf-tab-view .vls-gf-tab-container-layout", "l", 200, "You can move every thumbnail to the desired position by dragging the thumbnail. If layout type 'Metro' is selected, you can also freely change the size of the thumbnail by dragging the resize helpers at the thumbnails' edges", 82 100); 83 b(".vls-gf-tab-view .vls-gf-tab-container-layout", 10, 10, 10, 10); 84 break; 85 case 18: 86 a("#vls-gf-tab-panel li:eq(2)", "l", 200, "To switch to the album details click this tab."); 87 b("#vls-gf-tab-panel li:eq(2)", 0, 0, 0, 0); 88 break; 89 case 19: 90 v(); 91 break; 92 case 20: 93 a(".vls-gf-right-panel .vls-gf-shortcode", "l", 200, "To insert an album to your post or page use the displayed shortcode."), b(".vls-gf-right-panel .vls-gf-shortcode", 6, 6, 6, 6), d.find("#vls-gf-tour-btn-close").remove(), d.find("#vls-gf-tour-btn-next").text("Done").off().on("click.vls-gf", 94 m), f = -1 95 } 96 } 97 98 function w() { 99 var k = c('<div class="vls-gf-tour-welcome-message">'); 100 k.append("<h1>Welcome to the Gallery Factory quick tour!</h1>"); 101 k.append('<p>This tour will guide you through the basic plugin features.<br>To proceed to the next step press "Next" button at the bottom of the screen.</p>'); 102 d.append(k); 103 k.css({ 104 top: Math.floor(d.height() / 2) - Math.floor(k.height() / 2) - 100 + "px", 105 left: Math.floor(d.width() / 2) - Math.floor(k.width() / 2) + "px" 106 }) 107 } 108 109 function q() { 110 a(".vls-gf-gallery-manager-container .left-panel", 111 "r", 200, "Expand the folder's contents by clicking on the folder."); 112 e = !0; 113 setTimeout(function () { 114 c("#vls-gf-gallery-tree .folder.level-1:eq(0)").trigger("click"); 115 setTimeout(function () { 116 c("#vls-gf-gallery-tree .folder.level-2:eq(1)").trigger("click"); 117 setTimeout(function () { 118 b("#vls-gf-gallery-tree", 56, 0, 0, 0); 119 e = !1 120 }, 500) 121 }, 500) 122 }, 1500) 123 } 124 125 function r() { 126 c("#vls-gf-btn-edit-gallery-tree").trigger("click"); 127 setTimeout(function () { 128 a("#vls-gf-gallery-tree", "r", 200, "Sort folders and albums and move them between folders by simply dragging them to the desired position."); 129 b("#vls-gf-gallery-tree", 0, 0, 0, 0) 130 }, 100) 131 } 132 133 function t() { 134 e = !0; 135 b("#vls-gf-gallery-tree", 0, 0, 0, 0); 136 c("#vls-gf-btn-gallery-tree-cancel").trigger("click"); 137 setTimeout(function () { 138 c("#vls-gf-gallery-tree .folder.level-1:eq(0)").trigger("click"); 139 setTimeout(function () { 140 c("#vls-gf-gallery-tree .folder.level-2:eq(1)").trigger("click"); 141 setTimeout(function () { 142 c("#vls-gf-gallery-tree .album.level-3:eq(0)").trigger("click"); 143 setTimeout(function () { 144 a(".vls-gf-right-panel", "l", 200, "This is the Main Panel. It displays the currently activated album and provides access to all album-related features.", 145 100); 146 b(".vls-gf-right-panel", 0, 0, 0, 0); 147 e = !1 148 }, 1E3) 149 }, 600) 150 }, 600) 151 }, 600) 152 } 153 154 function u() { 155 e = !0; 156 c("#vls-gf-tab-panel li:eq(1) a").trigger("click"); 157 setTimeout(function () { 158 a(".vls-gf-right-panel .vls-gf-tab-view", "l", 200, "Layout tab contains WYSIWYG layout editor fot the current album.", 100); 159 b(".vls-gf-right-panel .vls-gf-tab-view", 0, 0, 0, 0); 160 e = !1 161 }, 1500) 162 } 163 164 function v() { 165 e = !0; 166 c("#vls-gf-tab-panel li:eq(2) a").trigger("click"); 167 setTimeout(function () { 168 a(".vls-gf-right-panel .vls-gf-tab-view", "l", 200, "Edit tab contains albums details edit form.", 169 100); 170 b(".vls-gf-right-panel .vls-gf-tab-view", 0, 0, 0, 0); 171 e = !1 172 }, 1500) 173 } 174 175 function x() { 176 for (var k = c('<div id="vls-gf-tour-backdrop"><div class="vls-gf-tour-focus"></div><div class="vls-gf-tour-controls"><div class="vls-gf-tour-progress"></div><button id="vls-gf-tour-btn-close">Skip the tour</button><button id="vls-gf-tour-btn-next">next</button></div></div>'), b = k.find(".vls-gf-tour-progress"), a = 1; 20 >= a; a++)b.append('<span class="vls-gf-tour-step-' + a + '">'); 177 return k 178 } 179 180 function b(a, b, d, g, e) { 181 var h = c(a); 182 a = h.offset().left; 183 var f = h.offset().top, l = h.outerWidth(), h = h.outerHeight(); 184 n.css({left: a - e + "px", top: f - b + "px", width: l + e + d + "px", height: h + b + g + "px"}) 185 } 186 187 function a(a, b, e, g, f) { 188 a = c(a); 189 g = c('<div class="vls-gf-tour-message"></div>').text(g); 190 "l" === b ? g.addClass("vls-gf-tour-message-left") : "r" === b && g.addClass("vls-gf-tour-message-right"); 191 g.css("width", e + "px"); 192 d.append(g); 193 f = 0 < f ? a.offset().top + f : a.offset().top + Math.ceil(a.outerHeight() / 2) - Math.ceil(g.outerHeight() / 2); 194 var h = 0; 195 "l" === b ? h = a.offset().left - e - 40 : "r" === b && (h = a.offset().left + 196 a.outerWidth() + 40); 197 g.css({top: f + "px", left: h + "px"}) 198 } 199 200 var l = !1, f = 0, y = c("#wpwrap"), d, n, e = !1; 201 return { 202 isActive: function () { 203 return l 204 }, start: function () { 205 l = !0; 206 c("body").on("wheel.vls-gf mousewheel.vls-gf touchmove.vls-gf", function (a) { 207 return !1 208 }); 209 d = x(); 210 n = d.find(".vls-gf-tour-focus"); 211 y.append(d); 212 d.find("#vls-gf-tour-btn-close").on("click.vls-gf", m); 213 d.find("#vls-gf-tour-btn-next").on("click.vls-gf", p); 214 w() 215 } 216 } 217 }(jQuery); 1 var VLS_GF=VLS_GF||{}; 2 VLS_GF.TourModule=function(c){function m(){l=!1;d.remove();c("body").off("wheel.vls-gf mousewheel.vls-gf touchmove.vls-gf");c.post(ajaxurl,{action:"vls_gf_disable_tour"});VLS_GF.AlbumsPanelModule.loadGalleryTree();c(".left-panel .fixed-items .unsorted a").trigger("click")}function p(){if(!e)switch(f++,d.find(".vls-gf-tour-progress span").eq(f-1).addClass("done"),d.find(".vls-gf-tour-message").remove(),f){case 1:d.find(".vls-gf-tour-welcome-message").remove();a(".vls-gf-gallery-manager-container .left-panel","r", 3 210,"This is the Albums Panel. Here you can navigate your image collection and manage albums");b(".vls-gf-gallery-manager-container .left-panel",0,0,0,0);break;case 2:q();break;case 3:a("#vls-gf-btn-edit-gallery-tree","r",200,"Add, sort, move, rename or delete folders and albums by activating edit mode.");b("#vls-gf-btn-edit-gallery-tree",4,4,4,4);break;case 4:r();break;case 5:a("#vls-gf-btn-add-new-album","r",210,"Add a folder or an album by clicking these buttons");b("#vls-gf-btn-add-new-folder", 4 0,120,0,0);break;case 6:a("#vls-gf-gallery-tree","r",200,"To rename a folder or an album click these buttons.");b("#vls-gf-gallery-tree",0,-29,0,-195);break;case 7:a("#vls-gf-gallery-tree","r",200,"To delete a folder or an album click these buttons.");b("#vls-gf-gallery-tree",0,0,0,-214);break;case 8:t();break;case 9:a("#vls-gf-tab-panel","l",200,"There are three tabs available. Overview tab opens by default when you switch the active album.");b("#vls-gf-tab-panel",0,0,0,0);break;case 10:a(".vls-gf-right-panel .vls-gf-tab-view", 5 "l",200,"Overview tab shows all album's images. Here you can upload and delete images, move them between albums and edit image's details.",100);b(".vls-gf-right-panel .vls-gf-tab-view",0,0,0,0);break;case 11:a(".vls-gf-right-panel .vls-gf-image-panel li:eq(0)","r",200,'Click on a thumbnail to open the image details editing dialog. Drag thumbnail to the album in the Albums Panel to move it to another album or to the "Unsorted images" folder.');b(".vls-gf-right-panel .vls-gf-image-panel li:eq(0)",0, 6 0,0,0);break;case 12:a("#vls-gf-upload-image-button:parent","r",200,"Upload images to the active album");b("#vls-gf-upload-image-button:parent",0,0,0,0);break;case 13:a("#vls-gf-bulk-select-start-button:parent","l",200,"Activate bulk select mode to enable selecting multiple images and moving or deleting them at once.");b("#vls-gf-bulk-select-start-button:parent",0,0,0,0);break;case 14:a("#vls-gf-tab-panel li:eq(1)","l",200,"Click this tab to switch to the layout editor for the current album.");b("#vls-gf-tab-panel li:eq(1)", 7 0,0,0,0);break;case 15:u();break;case 16:a(".vls-gf-tab-view .vls-gf-tab-container-side","l",200,"Here you can set the layout options. The layout view is updated immediately on the change so you can see the result.");b(".vls-gf-tab-view .vls-gf-tab-container-side",6,6,6,6);break;case 17:a(".vls-gf-tab-view .vls-gf-tab-container-layout","l",200,"You can move every thumbnail to the desired position by dragging the thumbnail. If layout type 'Metro' is selected, you can also freely change the size of the thumbnail by dragging the resize helpers at the thumbnails' edges", 8 100);b(".vls-gf-tab-view .vls-gf-tab-container-layout",10,10,10,10);break;case 18:a("#vls-gf-tab-panel li:eq(2)","l",200,"To switch to the album details click this tab.");b("#vls-gf-tab-panel li:eq(2)",0,0,0,0);break;case 19:v();break;case 20:a(".vls-gf-right-panel .vls-gf-shortcode","l",200,"To insert an album to your post or page use the displayed shortcode."),b(".vls-gf-right-panel .vls-gf-shortcode",6,6,6,6),d.find("#vls-gf-tour-btn-close").remove(),d.find("#vls-gf-tour-btn-next").text("Done").off().on("click.vls-gf", 9 m),f=-1}}function w(){var k=c('<div class="vls-gf-tour-welcome-message">');k.append("<h1>Welcome to the Gallery Factory quick tour!</h1>");k.append('<p>This tour will guide you through the basic plugin features.<br>To proceed to the next step press "Next" button at the bottom of the screen.</p>');d.append(k);k.css({top:Math.floor(d.height()/2)-Math.floor(k.height()/2)-100+"px",left:Math.floor(d.width()/2)-Math.floor(k.width()/2)+"px"})}function q(){a(".vls-gf-gallery-manager-container .left-panel", 10 "r",200,"Expand the folder's contents by clicking on the folder.");e=!0;setTimeout(function(){c("#vls-gf-gallery-tree .folder.level-1:eq(0)").trigger("click");setTimeout(function(){c("#vls-gf-gallery-tree .folder.level-2:eq(1)").trigger("click");setTimeout(function(){b("#vls-gf-gallery-tree",56,0,0,0);e=!1},500)},500)},1500)}function r(){c("#vls-gf-btn-edit-gallery-tree").trigger("click");setTimeout(function(){a("#vls-gf-gallery-tree","r",200,"Sort folders and albums and move them between folders by simply dragging them to the desired position."); 11 b("#vls-gf-gallery-tree",0,0,0,0)},100)}function t(){e=!0;b("#vls-gf-gallery-tree",0,0,0,0);c("#vls-gf-btn-gallery-tree-cancel").trigger("click");setTimeout(function(){c("#vls-gf-gallery-tree .folder.level-1:eq(0)").trigger("click");setTimeout(function(){c("#vls-gf-gallery-tree .folder.level-2:eq(1)").trigger("click");setTimeout(function(){c("#vls-gf-gallery-tree .album.level-3:eq(0)").trigger("click");setTimeout(function(){a(".vls-gf-right-panel","l",200,"This is the Main Panel. It displays the currently activated album and provides access to all album-related features.", 12 100);b(".vls-gf-right-panel",0,0,0,0);e=!1},1E3)},600)},600)},600)}function u(){e=!0;c("#vls-gf-tab-panel li:eq(1) a").trigger("click");setTimeout(function(){a(".vls-gf-right-panel .vls-gf-tab-view","l",200,"Layout tab contains WYSIWYG layout editor fot the current album.",100);b(".vls-gf-right-panel .vls-gf-tab-view",0,0,0,0);e=!1},1500)}function v(){e=!0;c("#vls-gf-tab-panel li:eq(2) a").trigger("click");setTimeout(function(){a(".vls-gf-right-panel .vls-gf-tab-view","l",200,"Edit tab contains albums details edit form.", 13 100);b(".vls-gf-right-panel .vls-gf-tab-view",0,0,0,0);e=!1},1500)}function x(){for(var k=c('<div id="vls-gf-tour-backdrop"><div class="vls-gf-tour-focus"></div><div class="vls-gf-tour-controls"><div class="vls-gf-tour-progress"></div><button id="vls-gf-tour-btn-close">Skip the tour</button><button id="vls-gf-tour-btn-next">next</button></div></div>'),b=k.find(".vls-gf-tour-progress"),a=1;20>=a;a++)b.append('<span class="vls-gf-tour-step-'+a+'">');return k}function b(a,b,d,g,e){var h=c(a);a=h.offset().left; 14 var f=h.offset().top,l=h.outerWidth(),h=h.outerHeight();n.css({left:a-e+"px",top:f-b+"px",width:l+e+d+"px",height:h+b+g+"px"})}function a(a,b,e,g,f){a=c(a);g=c('<div class="vls-gf-tour-message"></div>').text(g);"l"===b?g.addClass("vls-gf-tour-message-left"):"r"===b&&g.addClass("vls-gf-tour-message-right");g.css("width",e+"px");d.append(g);f=0<f?a.offset().top+f:a.offset().top+Math.ceil(a.outerHeight()/2)-Math.ceil(g.outerHeight()/2);var h=0;"l"===b?h=a.offset().left-e-40:"r"===b&&(h=a.offset().left+ 15 a.outerWidth()+40);g.css({top:f+"px",left:h+"px"})}var l=!1,f=0,y=c("#wpwrap"),d,n,e=!1;return{isActive:function(){return l},start:function(){l=!0;c("body").on("wheel.vls-gf mousewheel.vls-gf touchmove.vls-gf",function(a){return!1});d=x();n=d.find(".vls-gf-tour-focus");y.append(d);d.find("#vls-gf-tour-btn-close").on("click.vls-gf",m);d.find("#vls-gf-tour-btn-next").on("click.vls-gf",p);w()}}}(jQuery); -
gallery-factory-lite/trunk/admin/js/gallery-manager.js
r1181499 r1192116 2366 2366 }); 2367 2367 2368 -
gallery-factory-lite/trunk/admin/js/gallery-manager.min.js
r1181499 r1192116 1 var VLS_GF = VLS_GF || {}; 2 VLS_GF.GalleryManager = function (b) { 3 var q, r, m; 4 5 function t(k, e, d, a) { 6 "all_images" == k || "unsorted_images" == k ? (e = 0, b("#vls-gf-tab-panel").slideUp(), "all_images" == k ? d = "All images" : "unsorted_images" == k && (d = "Unsorted images"), b(".vls-gf-window-title > .vls-gf-shortcode").css("display", "none").find("input").val("")) : (b("#vls-gf-tab-panel").slideDown(), b(".vls-gf-window-title .vls-gf-shortcode").css("display", "").find("input").val(a)); 7 b(".vls-gf-window-title > span").first().text(d); 8 q = k; 9 r = e; 10 m = "album_overview"; 11 g(m); 12 return !1 13 } 14 15 function g(b) { 16 b = b.replace("#", ""); 17 H.append('<div class="vls-gf-loading-overlay"><span></span></div>'); 18 D.find("li").removeClass("active"); 19 D.find('a[href="#' + b + '"]:first').parent().addClass("active"); 20 switch (b) { 21 case "album_overview": 22 VLS_GF.AlbumOverviewPanelModule.loadContent(q, r); 23 break; 24 case "album_layout": 25 VLS_GF.AlbumLayoutPanelModule.loadContent(r); 26 break; 27 case "album_edit": 28 VLS_GF.ItemEditPanelModule.loadContent("album", r) 29 } 30 return !1 31 } 32 33 function e() { 34 return b('<div class="vls-gf-modal"><div class="vls-gf-backdrop"></div><div class="vls-gf-window"></div></div>') 35 } 36 37 function u() { 38 b(".vls-gf-modal").remove() 39 } 40 41 function w() { 42 var k = b(this).closest(".vls-gf-modal"); 43 if (k.hasClass("vls-gf-busy"))return !1; 44 var e = k.data("vlsGfImages"), d = k.data("vlsGfLinks"), a = k.data("vlsGfCurrentImage"), a = e.indexOf(a); 45 0 < a && (a--, k.data("vlsGfCurrentImage", e[a]), A(k, e[a], d[a])) 46 } 47 48 function G() { 49 var k = b(this).closest(".vls-gf-modal"); 50 if (k.hasClass("vls-gf-busy"))return !1; 51 var e = k.data("vlsGfImages"), d = k.data("vlsGfLinks"), a = k.data("vlsGfCurrentImage"), a = e.indexOf(a); 52 a < e.length - 1 && (a++, k.data("vlsGfCurrentImage", 53 e[a]), A(k, e[a], d[a])) 54 } 55 56 function A(e, g, d) { 57 e.addClass("vls-gf-busy"); 58 b.getJSON(ajaxurl, {action: "vls_gf_view_image_details", image_id: g, link_id: d}, function (b) { 59 e.find(".vls-gf-content").empty().append(b.view); 60 b = e.find(".vls-gf-window"); 61 b.css("margin-top", 0 - b.height() / 2); 62 e.removeClass("vls-gf-busy") 63 }) 64 } 65 66 function E() { 67 var e = b(".vls-gf-modal"), g = e.find(".vls-gf-window button.button-primary"); 68 if (!g.hasClass("vls-gf-processing")) { 69 g.addClass("vls-gf-processing"); 70 var d = {action: "vls_gf_update_image_details"}; 71 e.find(".vls-gf-window").find("form input, form select, form textarea").each(function () { 72 d[this.name] = 73 this.value 74 }); 75 b.post(ajaxurl, d, function (b) { 76 g.removeClass("vls-gf-processing"); 77 e.find(".vls-gf-update-feedback").show().fadeOut(3E3) 78 }) 79 } 80 } 81 82 var D, H; 83 q = "unsorted_images"; 84 r = 0; 85 m = "album_overview"; 86 return { 87 init: function () { 88 D = b("#vls-gf-tab-panel"); 89 H = b(".vls-gf-tab-view"); 90 D.find("ul > li > a").on("click.vls-gf", function (e) { 91 g(b(this).attr("href")); 92 e.preventDefault() 93 }); 94 VLS_GF.AlbumsPanelModule.init(); 95 t(q, r) 96 }, switchAlbum: t, reloadTab: function () { 97 g(m) 98 }, showConfirmDialog: function (k, g, d) { 99 var a = e(), h = a.find(".vls-gf-window"); 100 h.append('<div class="vls-gf-title"><span>Confirm delete</span></div>'); 101 var n = b('<div class="vls-gf-content"></div>'); 102 h.append(n); 103 n.append('<span class="vls-gf-message">' + k + "</span>"); 104 k = b('<div class="vls-gf-buttons-panel"></div>'); 105 h.append(k); 106 n = b('<a class="button" href="#">Cancel</a>'); 107 n.on("click.vls-gf", u); 108 k.append(n); 109 g = b('<a class="button-primary" href="#"></a>').text(g); 110 g.on("click.vls-gf", d); 111 k.append(g); 112 b("#wpwrap").append(a); 113 h.css("margin-top", 0 - h.height() / 2) 114 }, showNameDialog: function (g, m) { 115 var d = 116 "", a = "", h = ""; 117 "rename" === g ? (d = "Rename item", a = "Rename", h = "New name") : "createFolder" === g ? (d = "New folder", a = "Create", h = "Folder name") : "createAlbum" === g && (d = "New album", a = "Create", h = "Album name"); 118 var n = e(), c = n.find(".vls-gf-window"); 119 c.append('<div class="vls-gf-title"><span>' + d + "</span></div>"); 120 d = b('<div class="vls-gf-content"></div>'); 121 c.append(d); 122 d.append('<label class="vls-gf-form-element"><span>' + h + '</span><input type="text" value="" /></label>'); 123 h = d.find("input"); 124 h.on("keyup.vls-gf", function (b) { 125 13 == 126 b.keyCode && m() 127 }); 128 d = b('<div class="vls-gf-buttons-panel"></div>'); 129 c.append(d); 130 var p = b('<a class="button" href="#">Cancel</a>'); 131 p.on("click.vls-gf", u); 132 d.append(p); 133 a = b('<a class="button-primary" href="#"></a>').text(a); 134 a.on("click.vls-gf", m); 135 d.append(a); 136 b("#wpwrap").append(n); 137 c.css("margin-top", 0 - c.height() / 2); 138 h.focus() 139 }, showImageDetailsDialog: function (g, m, d, a) { 140 var h = e(); 141 h.data("vlsGfImages", d); 142 h.data("vlsGfLinks", a); 143 h.data("vlsGfCurrentImage", g); 144 b("#wpwrap").append(h); 145 d = h.find(".vls-gf-window"); 146 d.css({ 147 width: "680px", 148 "margin-left": "-340px" 149 }); 150 var n = b("<div />").addClass("vls-gf-title").append(b("<span/>").text(vlsGfGalleryAdminData.l10n.strImageDetails)); 151 d.append(n); 152 a = b("<div />").addClass("vls-gf-window-controls"); 153 n.append(a); 154 n = b("<button/>").addClass("vls-gf-btn-prev").text("<"); 155 n.on("click.vls-gf", w); 156 a.append(n); 157 n = b("<button/>").addClass("vls-gf-btn-next").text(">"); 158 n.on("click.vls-gf", G); 159 a.append(n); 160 n = b("<button/>").addClass("vls-gf-btn-cancel").text("\u00d7"); 161 n.on("click.vls-gf", u); 162 a.append(n); 163 d.append('<div class="vls-gf-content"></div>'); 164 a = b('<div class="vls-gf-buttons-panel"><span class="vls-gf-update-feedback">saved</span></div>'); 165 d.append(a); 166 d = b('<a class="button-primary" href="#">' + vlsGfGalleryAdminData.l10n.btnSave + "</a>"); 167 d.on("click.vls-gf", E); 168 a.append(d); 169 A(h, g, m) 170 }, closePopup: u 171 } 172 }(jQuery); 173 VLS_GF.AlbumsPanelModule = function (b) { 174 function q() { 175 b.get(ajaxurl, { 176 action: "vls_gf_view_gallery_tree", 177 tour: VLS_GF.TourModule && VLS_GF.TourModule.isActive() 178 }, function (b) { 179 d.empty().append(b); 180 d.find("li").on("click.vls-gf touchend.vls-gf", w); 181 r(); 182 d.parent().find("li.unsorted, li.album").droppable({ 183 accept: ".dragging-image", 184 hoverClass: "drop-ready", 185 drop: F 186 }) 187 }, "html") 188 } 189 190 function r() { 191 a.nextItemOrder = 99999; 192 var n = 0, c = 100, p = !1, e = 1, l = 1, f = 0, g = d.find("li").not(".vls-gf-deleted"); 193 g.sort(function (c, a) { 194 return parseInt(b(c).data("vlsGfOrder")) - 195 parseInt(b(a).data("vlsGfOrder")) 196 }); 197 for (var z = 0; z < g.length; ++z) { 198 var v = b(g[z]), C = parseInt(v.data("vlsGfLevel")); 199 C > c ? (v.addClass("vls-hidden"), v.css({ 200 position: "absolute", 201 top: (n - 1) * h.height + "px" 202 }), v.data("vlsGfPosition", n - 1).attr("data-vls-gf-position", n - 1)) : (++f, c = 100, v.removeClass("vls-hidden"), v.hasClass("folder") && !v.hasClass("opened") && (c = parseInt(v.data("vlsGfLevel"))), a.ghostPosition == n && ++n, v.hasClass("ui-draggable-dragging") || (v.css({top: n * h.height + "px"}), v.data("vlsGfPosition", n).attr("data-vls-gf-position", 203 n), n == a.ghostPosition - 1 ? (p = v.hasClass("folder"), e = C) : n == a.ghostPosition + 1 && (l = C, a.nextItemOrder = parseInt(v.data("vlsGfOrder"))), ++n)) 204 } 205 a.$draggedItem && (a.ghostLevel += a.initialLevel, l <= e ? (p && (e += e < (a.$draggedItem.hasClass("folder") ? 2 : 3) ? 1 : 0), a.ghostLevel > e ? a.ghostLevel = e : a.ghostLevel < l && (a.ghostLevel = l)) : a.ghostLevel = l, a.ghostPosition >= f && (a.ghostPosition = f - 1), a.$draggingGhost.css("top", a.ghostPosition * h.height + "px"), a.$draggingGhost.attr("class", "dragging-ghost"), a.$draggingGhost.addClass("level-" + 206 a.ghostLevel)); 207 d.css("height", 28 * f + "px") 208 } 209 210 function m(b, c) { 211 b.hasClass("opened") && "open" != c ? (b.removeClass("opened"), r()) : b.hasClass("opened") || "close" == c || (b.addClass("opened"), r()) 212 } 213 214 function t(e, c) { 215 var p = b(this); 216 a.itemTreeOffset = {top: d.offset().top, left: d.offset().left}; 217 p.removeClass("opened"); 218 d.find("li").draggable("disable"); 219 a.$draggedItem = p; 220 a.ghostPosition = Math.floor((p.offset().top - a.itemTreeOffset.top + h.middle) / h.height); 221 a.initialLevel = parseInt(p.data("vlsGfLevel")); 222 var x = d.find("li"); 223 x.sort(function (c, 224 a) { 225 return parseInt(b(c).data("vlsGfOrder")) - parseInt(b(a).data("vlsGfOrder")) 226 }); 227 for (var l = !1, f = 0; f < x.length; ++f) { 228 var g = b(x[f]); 229 parseInt(g.data("vlsGfId")); 230 var z = parseInt(g.data("vlsGfOrder")), v = parseInt(g.data("vlsGfLevel")); 231 parseInt(p.data("vlsGfId")); 232 var C = parseInt(p.data("vlsGfOrder")); 233 g.is(p) || (z > C && v <= a.initialLevel && !l ? l = !0 : z > C && v > a.initialLevel && !l && g.addClass("vls-gf-dragging-child")) 234 } 235 d.append(a.$draggingGhost); 236 r() 237 } 238 239 function g(e, c) { 240 var p = parseInt(c.offset.top) + h.middle; 241 if (!(p >= a.currentArea.top && 242 p <= a.currentArea.bottom && c.offset.left >= a.currentArea.left && c.offset.left <= a.currentArea.right)) { 243 clearTimeout(a.hoverTimeout); 244 var g = Math.floor((p - a.itemTreeOffset.top) / h.height); 245 0 > g && (g = 0); 246 a.ghostLevel = Math.floor((parseInt(c.offset.left) - a.itemTreeOffset.left) / 10); 247 a.currentArea.left = a.itemTreeOffset.left + 10 * a.ghostLevel; 248 a.currentArea.right = a.itemTreeOffset.left + 10 * (a.ghostLevel + 1) - 1; 249 var l = a.itemTreeOffset.top + h.height * g, p = p - l + 1, f = d.find("li").filter(function (c, a) { 250 var v = b(a); 251 return v.data("vlsGfPosition") == 252 g && !v.hasClass("vls-hidden") && !v.hasClass("ui-draggable-dragging") 253 }); 254 f && f.hasClass("folder") && !f.hasClass("opened") ? g > a.ghostPosition && p > h.bottomPart ? (a.ghostPosition = g, a.currentArea.top = l, a.currentArea.bottom = l + h.height - 1) : g < a.ghostPosition && p <= h.topPart ? (a.ghostPosition = g, a.currentArea.top = l, a.currentArea.bottom = l + h.height - 1) : (g > a.ghostPosition ? (a.currentArea.top = l, a.currentArea.bottom = l + h.bottomPart) : (a.currentArea.top = l + h.topPart, a.currentArea.bottom = l + h.height - 1), a.hoverTimeout = setTimeout(function () { 255 m(f, 256 "open") 257 }, 500)) : (a.ghostPosition = g, a.currentArea.top = l, a.currentArea.bottom = l + h.height - 1); 258 r() 259 } 260 } 261 262 function e() { 263 var a = b(this); 264 a.addClass("ui-draggable-placing"); 265 setTimeout(function () { 266 a.removeClass("ui-draggable-placing") 267 }, 550); 268 return !1 269 } 270 271 function u(e, c) { 272 var g = !1, x = b(this), l = d.find("li").not(".vls-gf-dragging-child, .ui-draggable-dragging"); 273 l.sort(function (c, a) { 274 var v = b(c), f = b(a); 275 return 1E5 * parseInt(v.data("vlsGfPosition")) + parseInt(v.data("vlsGfOrder")) - 1E5 * parseInt(f.data("vlsGfPosition")) - parseInt(f.data("vlsGfOrder")) 276 }); 277 var f = d.find("li.vls-gf-dragging-child"); 278 f.sort(function (c, a) { 279 return parseInt(b(c).data("vlsGfOrder")) - parseInt(b(a).data("vlsGfOrder")) 280 }); 281 for (var h = 0, z = 0; z <= l.length; ++z) { 282 if (z < l.length)var v = b(l[z]); 283 ++h; 284 if (!g && (z == l.length && 99999 == a.nextItemOrder || v.hasClass("vls-gf-deleted") || z < l.length && a.nextItemOrder == parseInt(v.data("vlsGfOrder")))) { 285 g = !0; 286 x.data("vlsGfOrder", h).attr("data-vls-gf-order", h); 287 ++h; 288 for (var C = 0; C < f.length; ++C) { 289 var m = b(f[C]), k = parseInt(m.data("vlsGfLevel")) + a.ghostLevel - a.initialLevel, 290 k = 3 < k ? 3 : k; 291 m.data("vlsGfOrder", h).attr("data-vls-gf-order", h).data("vlsGfLevel", k).attr("data-vls-gf-level", k).data("vlsGfPosition", k).attr("data-vls-gf-position", a.ghostPosition).removeClass("level-1 level-2 level-3 level-4 level-5 level-6 level-7").addClass("level-" + k).css("top", a.$draggingGhost.css("top")); 292 ++h 293 } 294 } 295 z < l.length && v.data("vlsGfOrder", h).attr("data-vls-gf-order", h) 296 } 297 x.css({ 298 left: "0px", 299 top: a.$draggingGhost.css("top") 300 }).removeClass("ui-draggable-dragging level-1 level-2 level-3 level-4 level-5 level-6 level-7").addClass("level-" + 301 a.ghostLevel).data("vlsGfPosition", a.ghostPosition).attr("data-vls-gf-position", a.ghostPosition).data("vlsGfLevel", a.ghostLevel).attr("data-vls-gf-level", a.ghostLevel); 302 d.find("li").removeClass("vls-gf-dragging-child").draggable("enable"); 303 a.$draggedItem = null; 304 a.ghostPosition = -1; 305 a.items = []; 306 a.$draggingGhost.remove(); 307 r() 308 } 309 310 function w() { 311 var a = b(this); 312 a.hasClass("ui-draggable-dragging") || a.hasClass("ui-draggable-placing") || (a.hasClass("folder") ? m(a) : a.hasClass("album") && (b(".vls-gf-gallery-manager-container .left-panel ul>li>span.wp-ui-highlight").remove(), 313 a.append('<span class="wp-ui-highlight">'), VLS_GF.GalleryManager.switchAlbum("album", a.data("vlsGfId"), a.find(".label").text(), a.data("vlsGfShortcode")))); 314 return !1 315 } 316 317 function G(a) { 318 var c = b(this).closest("li"); 319 VLS_GF.GalleryManager.showNameDialog("rename", function () { 320 var a = b(".vls-gf-modal").first().find("input").val(); 321 a && "" != a ? (c.find(".label").text(a), c.data("vlsGfIsRenamed", "true").attr("data-vls-gf-is-renamed", "true"), VLS_GF.GalleryManager.closePopup()) : alert("Name must be entered") 322 }); 323 return !1 324 } 325 326 function A(a) { 327 var c = 328 "", e = ""; 329 "vls-gf-btn-add-new-folder" == a.target.id ? (c = "folder", e = "createFolder") : (c = "album", e = "createAlbum"); 330 VLS_GF.GalleryManager.showNameDialog(e, function () { 331 var a = b(".vls-gf-modal").first().find("input").val(); 332 if (a && "" != a) { 333 var e = d.find("li"), f = 0; 334 0 < e.length && (f = parseInt(e.sort(function (a, c) { 335 return parseInt(b(a).data("vlsGfOrder")) - parseInt(b(c).data("vlsGfOrder")) 336 }).last().data("vlsGfOrder"))); 337 a = b('<li class="' + c + ' level-1"><a href="#"><span class="icon"></span><span class="label">' + a + '</span></a><span class="btn btn-delete"></span><span class="btn btn-rename"></span></li>'); 338 a.data("vlsGfId", 0).attr("data-vls-gf-id", 0).data("vlsGfLevel", 1).attr("data-vls-gf-level", 1).data("vlsGfOrder", f + 1).attr("data-vls-gf-order", f + 1).data("vlsGfPosition", 99999).attr("data-vls-gf-position", 99999).data("vlsGfIsAdded", "true").attr("data-vls-gf-is-added", "true").css("top", d.height() - 28 + "px"); 339 d.append(a); 340 a.bind("click.vls-gf", w); 341 a.find(".btn-rename").on("click.vls-gf", G); 342 a.find(".btn-delete").on("click.vls-gf", E); 343 k(); 344 r(); 345 VLS_GF.GalleryManager.closePopup() 346 } else alert("Name must be entered") 347 }) 348 } 349 350 function E() { 351 var a = "", c = b(this).closest("li"), a = c.hasClass("album") ? 'Delete album "' + c.find(".label").text() + '"?' : 'Delete folder "' + c.find(".label").text() + '" and all its descendants?'; 352 VLS_GF.GalleryManager.showConfirmDialog(a, "Delete", function () { 353 var a = 0; 354 d.find("li").not(".vls-gf-deleted").sort(function (a, c) { 355 return parseInt(b(a).data("vlsGfOrder")) - parseInt(b(c).data("vlsGfOrder")) 356 }).each(function () { 357 var e = b(this); 358 if (e.is(c))a = parseInt(e.data("vlsGfLevel")); else if (0 < a) { 359 var g = parseInt(e.data("vlsGfLevel")); 360 if (g > a)e.addClass("vls-gf-deleted").data("vlsGfLevel", g - a + 1).attr("data-vls-gf-level", g - a + 1).data("vlsGfPosition", 99999).attr("data-vls-gf-position", 99999); else return !1 361 } 362 }); 363 c.addClass("vls-gf-deleted").data("vlsGfLevel", 1).attr("data-vls-gf-level", 1).data("vlsGfIsDeleted", "true").attr("data-vls-gf-is-deleted", "true").data("vlsGfPosition", 99999).attr("data-vls-gf-position", 99999); 364 r(); 365 VLS_GF.GalleryManager.closePopup(); 366 return !1 367 }); 368 return !1 369 } 370 371 function D(a) { 372 if (0 < d.find(".vls-gf-loading-overlay").length)return !1; 373 b(this).css("display", "none"); 374 b("#vls-gf-panel-edit-gallery-tree").css("display", "block"); 375 var c = d.find("li"); 376 c.append('<span class="btn btn-delete"></span><span class="btn btn-rename"></span>'); 377 c.find(".btn-rename").on("click.vls-gf", G); 378 c.find(".btn-delete").on("click.vls-gf", E); 379 k(); 380 a.preventDefault() 381 } 382 383 function H(a) { 384 d.find("li").draggable("destroy").find(".btn").remove(); 385 b("#vls-gf-panel-edit-gallery-tree").css("display", "none"); 386 b("#vls-gf-btn-edit-gallery-tree").css("display", "block"); 387 d.append('<div class="vls-gf-loading-overlay"><span></span></div>'); 388 if ("vls-gf-btn-gallery-tree-commit" == a.target.id) { 389 var c = []; 390 d.find("li").each(function () { 391 var a = b(this), e = "", g = "", f = "", d = "", h = ""; 392 a.data("vlsGfIsAdded") && (f = a.data("vlsGfIsAdded")); 393 a.data("vlsGfIsRenamed") && (d = a.data("vlsGfIsRenamed")); 394 a.data("vlsGfIsDeleted") && (h = a.data("vlsGfIsDeleted")); 395 f && (g = a.hasClass("album") ? "album" : "folder"); 396 if (f || d)e = a.find(".label").text(); 397 c.push({ 398 id: parseInt(a.data("vlsGfId")), 399 type: g, 400 order: parseInt(a.data("vlsGfOrder")), 401 level: parseInt(a.data("vlsGfLevel")), 402 name: e, 403 is_added: f, 404 is_renamed: d, 405 is_deleted: h 406 }) 407 }); 408 b.post(ajaxurl, { 409 action: "vls_gf_commit_gallery_tree_changes", 410 security: vlsGfGalleryAdminData.nonce, 411 itemData: JSON.stringify(c) 412 }, function (a) { 413 q() 414 }, "json") 415 } else q(); 416 return !1 417 } 418 419 function k() { 420 d.find("li").draggable({ 421 distance: 2, 422 addClasses: !1, 423 cursor: "move", 424 cancel: ".btn", 425 start: t, 426 drag: g, 427 revert: e, 428 stop: u 429 }) 430 } 431 432 function F(a, c) { 433 var e = c.helper.data("sourceAlbum"), g; 434 g = b(a.target).hasClass("unsorted") ? 0 : parseInt(b(a.target).data("vlsGfId")); 435 var d = c.helper.data("draggedImages"); 436 e !== g && b.post(ajaxurl, 437 { 438 action: "vls_gf_move_images_to_album", 439 security: vlsGfGalleryAdminData.nonce, 440 images: JSON.stringify(d), 441 source_album: e, 442 target_album: g 443 }, VLS_GF.GalleryManager.reloadTab) 444 } 445 446 var d, a = { 447 $draggedItem: null, 448 $draggingGhost: b('<div class="dragging-ghost"><div></div></div>'), 449 itemTreeOffset: {top: 0, bottom: 0}, 450 currentArea: {top: 0, bottom: 0, left: 0, right: 0}, 451 initialLevel: 0, 452 nextItemOrder: 99999, 453 hoverTimeout: {}, 454 ghostPosition: -1, 455 ghostLevel: 0 456 }, h = {height: 28, middle: 14, topPart: 11, bottomPart: 18}; 457 return { 458 init: function () { 459 b(".vls-gf-gallery-manager-container .left-panel ul.fixed-items a").on("click.vls-gf", 460 function (a) { 461 var c = b(this); 462 b(".vls-gf-gallery-manager-container .left-panel ul>li>span.wp-ui-highlight").remove(); 463 c.parent().append('<span class="wp-ui-highlight">'); 464 c = c.attr("href").replace("#", ""); 465 VLS_GF.GalleryManager.switchAlbum(c, 0); 466 a.preventDefault() 467 }); 468 d = b("#vls-gf-gallery-tree"); 469 b("#vls-gf-btn-edit-gallery-tree").on("click.vls-gf", D); 470 b("#vls-gf-btn-gallery-tree-commit, #vls-gf-btn-gallery-tree-cancel").on("click.vls-gf", H); 471 b("#vls-gf-btn-add-new-folder, #vls-gf-btn-add-new-album").on("click.vls-gf", 472 A); 473 q() 474 }, loadGalleryTree: q 475 } 476 }(jQuery); 477 VLS_GF.AlbumOverviewPanelModule = function (b) { 478 function q(w) { 479 b(".vls-gf-tab-view").empty().append(w); 480 e = b(".vls-gf-tab-view .vls-gf-image-panel"); 481 w = { 482 thumb_width: 140, 483 thumb_height: 140, 484 sortable: !0, 485 dragdrop: !0, 486 views: {list: !1, thumbs: !0, active: "thumbs"}, 487 multipart_params: {action: "vls_gf_async_upload", album_id: g}, 488 flash_swf_url: "/plupload/js/Moxie.swf", 489 silverlight_xap_url: "/plupload/js/Moxie.xap", 490 stop: function () { 491 VLS_GF.GalleryManager.reloadTab() 492 }, 493 complete: function () { 494 VLS_GF.GalleryManager.reloadTab() 495 } 496 }; 497 var q = { 498 action: "vls_gf_async_upload", 499 album_id: g 500 }; 501 b.extend(q, vls_plupload_setup_object.multipart_params); 502 b.extend(w, vls_plupload_setup_object); 503 w.multipart_params = q; 504 b("#vls-gf-upload-panel").plupload(w); 505 b("#vls-gf-upload-image-button").on("click.vls-gf", function (e) { 506 b(".vls-gf-toolbar").slideUp(); 507 b("#vls-gf-upload-panel").slideDown(); 508 e.preventDefault() 509 }); 510 b("#vls-gf-upload-panel .plupload_cancel").on("click.vls-gf", function (e) { 511 b("#vls-gf-upload-panel").slideUp(); 512 b(".vls-gf-toolbar").slideDown() 513 }); 514 b("#vls-gf-bulk-select-start-button").on("click.vls-gf", 515 function (g) { 516 e.addClass("select-mode"); 517 b("#vls-gf-toolbar-image-overview").fadeOut(); 518 b("#vls-gf-toolbar-bulk-select-left").fadeIn(); 519 b("#vls-gf-toolbar-bulk-select-right").fadeIn(); 520 g.preventDefault() 521 }); 522 b("#vls-gf-bulk-select-cancel-button").on("click.vls-gf", function (g) { 523 e.removeClass("select-mode"); 524 e.find("li").removeClass("selected").find(".image-icon").remove(); 525 b("#vls-gf-toolbar-image-overview").fadeIn(); 526 b("#vls-gf-toolbar-bulk-select-left").fadeOut(); 527 b("#vls-gf-toolbar-bulk-select-right").fadeOut(); 528 u = null; 529 g.preventDefault() 530 }); 531 b("#vls-gf-bulk-select-delete-button").on("click.vls-gf", function (m) { 532 var t = []; 533 e.find("li.selected").each(function () { 534 t.push(parseInt(b(this).data("vlsGfImageId"))) 535 }); 536 b.post(ajaxurl, {action: "vls_gf_delete_images", images: t, album: g}, VLS_GF.GalleryManager.reloadTab); 537 u = null; 538 m.preventDefault() 539 }); 540 b("#vls-gf-bulk-select-all-button").on("click.vls-gf", function (e) { 541 b(".vls-gf-tab-view .vls-gf-image-panel li").not(".selected").addClass("selected").append('<div class="image-icon"><span></span></div>'); 542 u = null; 543 e.preventDefault() 544 }); 545 b("#vls-gf-bulk-select-none-button").on("click.vls-gf", function (e) { 546 b(".vls-gf-tab-view .vls-gf-image-panel li.selected").removeClass("selected").find(".image-icon").remove(); 547 u = null; 548 e.preventDefault() 549 }); 550 b("#vls-gf-bulk-select-invert-button").on("click.vls-gf", function (e) { 551 b(".vls-gf-tab-view .vls-gf-image-panel li").each(function () { 552 var e = b(this); 553 e.hasClass("selected") ? e.removeClass("selected").find(".image-icon").remove() : e.addClass("selected").append('<div class="image-icon"><span></span></div>') 554 }); 555 u = null; 556 e.preventDefault() 557 }); 558 e.find("li").on("click.vls-gf", function (g) { 559 var m = b(this), t = m.data("vlsGfImageId"), q = m.data("vlsGfLinkId"), q = q ? q : 0; 560 if (e.hasClass("select-mode")) { 561 if (g.shiftKey && u) { 562 var k = t = e.find("li").index(u), r = e.find("li").index(m); 563 r < k && (k = r, r = t); 564 var d = u.hasClass("selected") ? "select" : "deselect"; 565 e.find("li").each(function () { 566 var a = b(this), c = e.find("li").index(a); 567 c >= k && c <= r && ("select" === d ? a.addClass("selected").append('<div class="image-icon"><span></span></div>') : "deselect" === d && a.removeClass("selected").find(".image-icon").remove()) 568 }) 569 } else m.hasClass("selected") ? 570 m.removeClass("selected").find(".image-icon").remove() : m.addClass("selected").append('<div class="image-icon"><span></span></div>'); 571 u = m 572 } else { 573 var a = [], h = []; 574 e.find("li").each(function () { 575 a.push(parseInt(b(this).data("vlsGfImageId"))); 576 var e = b(this).data("vlsGfLinkId"); 577 h.push(parseInt(void 0 == e ? 0 : e)) 578 }); 579 VLS_GF.GalleryManager.showImageDetailsDialog(t, q, a, h) 580 } 581 g.preventDefault() 582 }); 583 e.find("li").draggable({ 584 delay: 100, 585 cursor: "none", 586 helper: r, 587 cursorAt: {top: 20, left: 20}, 588 appendTo: "body", 589 addClasses: !1, 590 start: m, 591 stop: t 592 }) 593 } 594 595 function r() { 596 e.hasClass("select-mode") || b(this).addClass("selected"); 597 var m = []; 598 e.find("li.selected").each(function () { 599 m.push(parseInt(b(this).data("vlsGfImageId"))) 600 }); 601 var t = b('<div id="vls-gf-image-drag-helper">' + m.length + "</div>"); 602 t.data("draggedImages", m); 603 t.data("sourceAlbum", g); 604 return t 605 } 606 607 function m() { 608 b(".left-panel").addClass("drop-ready"); 609 b(this).addClass("dragging-image") 610 } 611 612 function t() { 613 b(".left-panel").removeClass("drop-ready"); 614 b(this).removeClass("dragging-image"); 615 e.hasClass("select-mode") || b(this).removeClass("selected") 616 } 617 618 var g, e, u; 619 return { 620 loadContent: function (e, m) { 621 g = m; 622 b.get(ajaxurl, { 623 action: "vls_gf_view_album_overview", 624 item_type: e, 625 album_id: m, 626 tour: VLS_GF.TourModule && VLS_GF.TourModule.isActive() 627 }, q, "html") 628 } 629 } 630 }(jQuery); 631 VLS_GF.AlbumLayoutPanelModule = function (b) { 632 var q, r, m, t, g, e; 633 634 function u(a) { 635 f.layoutType = ""; 636 p = b(".vls-gf-tab-view").first(); 637 p.empty().append(a.view); 638 x = p.find(".vls-gf-tab-container-layout > div"); 639 l = p.find(".vls-gf-tab-container-side form"); 640 p.find(".vls-gf-x-1-1").on("click.vls-gf", function (a) { 641 w(1); 642 a.preventDefault() 643 }); 644 p.find(".vls-gf-x-1-2").on("click.vls-gf", function (a) { 645 w(.5); 646 a.preventDefault() 647 }); 648 p.find(".vls-gf-x-1-4").on("click.vls-gf", function (a) { 649 w(.25); 650 a.preventDefault() 651 }); 652 p.find(".vls-gf-btn-save-layout").on("click.vls-gf", 653 function (a) { 654 h(); 655 a.preventDefault() 656 }); 657 l.find("input, select").on("change.vls-gf", function () { 658 G(); 659 w(0) 660 }); 661 G(); 662 w(1); 663 x.find("li").draggable({ 664 containment: x, scroll: !0, cursor: "move", addClasses: !1, start: function (a, f) { 665 var d = b(this); 666 B.css({width: d.css("width"), height: d.css("height"), top: d.css("top"), left: d.css("left")}); 667 x.append(B); 668 B.fadeIn(300); 669 d.data("vlsGfMetroW") ? c.metroSize.width = parseInt(d.data("vlsGfMetroW")) : c.metroSize.width = 1; 670 d.data("vlsGfMetroH") ? c.metroSize.height = parseInt(d.data("vlsGfMetroH")) : 671 c.metroSize.height = 1; 672 c.centerShift = {x: Math.ceil(g / 2), y: Math.ceil(e / 2)}; 673 c.position = {x: f.position.left, y: f.position.top}; 674 c.editedItem = d; 675 E(a, f) 676 }, drag: E, stop: function (a, e) { 677 B.fadeOut(500, function () { 678 b(this).detach() 679 }); 680 c.editedItem = null; 681 F() 682 } 683 }) 684 } 685 686 function w(a) { 687 0 < a && (q = a); 688 p.find(".vls-gf-x-1-1").removeClass("vls-gf-active"); 689 p.find(".vls-gf-x-1-2").removeClass("vls-gf-active"); 690 p.find(".vls-gf-x-1-4").removeClass("vls-gf-active"); 691 r = Math.round(x.parent().width() * q); 692 .25 >= q ? (x.css("width", "25%"), p.find(".vls-gf-x-1-4").addClass("vls-gf-active")) : 693 .5 >= q ? (x.css("width", "50%"), p.find(".vls-gf-x-1-2").addClass("vls-gf-active")) : (x.css("width", "100%"), p.find(".vls-gf-x-1-1").addClass("vls-gf-active")); 694 m = Math.floor(f.horizontalSpacing * q); 695 t = Math.floor(f.verticalSpacing * q); 696 g = Math.floor((r - m * (f.columnCount - 1)) / f.columnCount); 697 e = Math.floor(g / f.aspectRatio); 698 F() 699 } 700 701 function G() { 702 var a = f.layoutType; 703 f.layoutType = l.find("#vls-gf-param-layout-type").val(); 704 var b = ""; 705 "metro" == f.layoutType ? (f.columnCount = parseInt(l.find("#vls-gf-param-metro-column-count").val()), 706 b = l.find("#vls-gf-param-metro-aspect-ratio").val(), f.horizontalSpacing = parseInt(l.find("#vls-gf-param-metro-horizontal-spacing").val()), f.verticalSpacing = parseInt(l.find("#vls-gf-param-metro-vertical-spacing").val())) : "grid" == f.layoutType && (f.columnCount = parseInt(l.find("#vls-gf-param-grid-column-count").val()), b = l.find("#vls-gf-param-grid-aspect-ratio").val(), f.horizontalSpacing = parseInt(l.find("#vls-gf-param-grid-horizontal-spacing").val()), f.verticalSpacing = parseInt(l.find("#vls-gf-param-grid-vertical-spacing").val())); 707 b = b.replace(",", "."); 708 b = b.replace(":", "/"); 709 b = b.replace("-", "/"); 710 b = b.split("/"); 711 f.aspectRatio = parseFloat(b[0]); 712 1 < b.length && (f.aspectRatio = Math.round(f.aspectRatio / parseFloat(b[1]) * 1E3) / 1E3); 713 .25 > f.aspectRatio && (f.aspectRatio = .25); 714 4 < f.aspectRatio && (f.aspectRatio = 4); 715 0 > f.horizontalSpacing && (f.horizontalSpacing = 0); 716 100 < f.horizontalSpacing && (f.horizontalSpacing = 100); 717 0 > f.verticalSpacing && (f.verticalSpacing = 0); 718 100 < f.verticalSpacing && (f.verticalSpacing = 100); 719 "grid" == f.layoutType ? (l.find("#vls-gf-param-grid-horizontal-spacing").val(f.horizontalSpacing.toString()), 720 l.find("#vls-gf-param-grid-vertical-spacing").val(f.verticalSpacing.toString()), l.find("#vls-gf-param-grid-aspect-ratio").val(f.aspectRatio.toString())) : "metro" == f.layoutType && (l.find("#vls-gf-param-metro-horizontal-spacing").val(f.horizontalSpacing.toString()), l.find("#vls-gf-param-metro-vertical-spacing").val(f.verticalSpacing.toString()), l.find("#vls-gf-param-metro-aspect-ratio").val(f.aspectRatio.toString())); 721 a != f.layoutType && (x.find("li.ui-resizable").resizable("destroy"), "metro" == f.layoutType ? 722 (l.find("#vls-gf-parameters-metro").css("display", "block"), l.find("#vls-gf-parameters-grid").css("display", "none"), x.find("li").resizable({ 723 handles: "all", 724 autoHide: !1, 725 minHeight: 43, 726 minWidth: 43, 727 start: D, 728 resize: H, 729 stop: k 730 })) : "grid" == f.layoutType ? (l.find("#vls-gf-parameters-metro").css("display", "none"), l.find("#vls-gf-parameters-grid").css("display", "block")) : (l.find("#vls-gf-parameters-metro").css("display", "none"), l.find("#vls-gf-parameters-grid").css("display", "none"))) 731 } 732 733 function A(a, b) { 734 return "x" + ("00000" + 735 a).slice(-5) + "y" + ("00000" + b).slice(-5) 736 } 737 738 function E(a, b) { 739 c.position = {x: b.position.left + c.centerShift.x, y: b.position.top + c.centerShift.y}; 740 if (c.position.x < c.currentArea.left || c.position.x > c.currentArea.right || c.position.y < c.currentArea.top || c.position.y > c.currentArea.bottom)c.currentArea.col = Math.floor(c.position.x / (g + m)), c.currentArea.row = Math.floor(c.position.y / (e + t)), c.currentArea.left = c.currentArea.col * (g + m) - m, c.currentArea.right = (c.currentArea.col + 1) * (g + m), c.currentArea.top = c.currentArea.row * (e + 741 t) - t, c.currentArea.bottom = (c.currentArea.row + 1) * (e + t), F() 742 } 743 744 function D(a, f) { 745 var d = b(this); 746 B.css({width: d.css("width"), height: d.css("height"), top: d.css("top"), left: d.css("left")}); 747 d.closest("div").append(B); 748 B.fadeIn(300); 749 d.data("vlsGfMetroW") ? c.metroSize.width = parseInt(d.data("vlsGfMetroW")) : c.metroSize.width = 1; 750 c.originalState.width = c.metroSize.width; 751 d.data("vlsGfMetroH") ? c.metroSize.height = parseInt(d.data("vlsGfMetroH")) : c.metroSize.height = 1; 752 c.originalState.height = c.metroSize.height; 753 d.data("vlsGfCol") ? 754 c.originalState.col = parseInt(d.data("vlsGfCol")) : c.originalState.col = 0; 755 d.data("vlsGfRow") ? c.originalState.row = parseInt(d.data("vlsGfRow")) : c.originalState.row = 0; 756 c.centerShift = {x: Math.ceil(g / 2), y: Math.ceil(e / 2)}; 757 c.position = {x: f.position.left, y: f.position.top}; 758 c.editedItem = d; 759 E(a, f) 760 } 761 762 function H(a, b) { 763 var d = Math.floor((b.size.width - Math.floor(.2 * g)) / (g + m)) + 1, f = Math.floor((b.size.height - Math.floor(.2 * e)) / (e + t)) + 1; 764 if (d !== c.metroSize.width || f !== c.metroSize.height)c.metroSize.width = d, c.metroSize.height = f, c.currentArea.col = 765 b.originalPosition.left === b.position.left ? c.originalState.col : c.originalState.col + c.originalState.width - d, c.currentArea.row = b.originalPosition.top === b.position.top ? c.originalState.row : c.originalState.row + c.originalState.height - f, F() 766 } 767 768 function k(a, e) { 769 B.fadeOut(500, function () { 770 b(this).detach() 771 }); 772 c.editedItem = null; 773 F() 774 } 775 776 function F() { 777 switch (f.layoutType) { 778 case "metro": 779 d(f); 780 break; 781 case "grid": 782 a(f) 783 } 784 } 785 786 function d() { 787 var a = [], d = 0, h = 0, l, k, n = [], p = 0, q = 0, r = 0, u = 0, w = 0; 788 x.find("li").each(function () { 789 var d = b(this), e = 0, f = 0, 790 g = 1, h = 1; 791 c.editedItem && (d.hasClass("ui-draggable-dragging") || d.hasClass("ui-resizable-resizing")) || (d.data("vlsGfCol") && (e = parseInt(d.data("vlsGfCol"))), d.data("vlsGfRow") && (f = parseInt(d.data("vlsGfRow"))), d.data("vlsGfMetroW") && (g = parseInt(d.data("vlsGfMetroW"))), d.data("vlsGfMetroH") && (h = parseInt(d.data("vlsGfMetroH"))), a.push({ 792 element: d, 793 row: f, 794 col: e, 795 width: g, 796 height: h 797 })) 798 }); 799 a.sort(function (a, b) { 800 return 100 * a.row + a.col - 100 * b.row - b.col 801 }); 802 if (c.editedItem) { 803 if (c.currentArea.col + c.metroSize.width > f.columnCount)return; 804 for (d = 0; d < c.metroSize.width; ++d)for (h = 0; h < c.metroSize.height; ++h)n.push(A(c.currentArea.col + d, c.currentArea.row + h)); 805 for (k = !1; !k;)0 > b.inArray(A(q, p), n) ? k = !0 : (++q, q >= f.columnCount && (q = 0, ++p)); 806 B.css({ 807 width: c.metroSize.width * (g + m) - m + "px", 808 height: c.metroSize.height * (e + t) - t + "px", 809 left: c.currentArea.col * (g + m) + "px", 810 top: c.currentArea.row * (e + t) + "px" 811 }); 812 c.editedItem.data("vlsGfCol", c.currentArea.col); 813 c.editedItem.data("vlsGfRow", c.currentArea.row); 814 c.editedItem.data("vlsGfMetroW", c.metroSize.width); 815 c.editedItem.attr("data-vls-gf-metro-w", 816 c.metroSize.width); 817 c.editedItem.data("vlsGfMetroH", c.metroSize.height); 818 c.editedItem.attr("data-vls-gf-metro-h", c.metroSize.height); 819 w < c.currentArea.row + c.metroSize.height - 1 && (w = c.currentArea.row + c.metroSize.height - 1) 820 } 821 for (l = 0; l < a.length; ++l) { 822 var y = a[l]; 823 y.width > f.columnCount && (y.width = f.columnCount); 824 k = !1; 825 u = q; 826 for (r = p; !k;) { 827 k = !0; 828 for (d = 0; d < y.width; ++d)for (h = 0; h < y.height; ++h)if (u + d >= f.columnCount || 0 <= b.inArray(A(u + d, r + h), n))k = !1; 829 k || (++u, u >= f.columnCount && (u = 0, ++r)) 830 } 831 for (d = 0; d < y.width; ++d)for (h = 0; h < y.height; ++h)n.push(A(u + 832 d, r + h)); 833 d = (g + m) * u; 834 h = (e + t) * r; 835 y.element.css("width", y.width * g + (y.width - 1) * m + "px").css("height", y.height * e + (y.height - 1) * t + "px").css("top", h + "px").css("left", d + "px"); 836 y.element.data("vlsGfCol", u); 837 y.element.data("vlsGfRow", r); 838 w < r + y.height - 1 && (w = r + y.height - 1); 839 for (k = !1; !k;)0 > b.inArray(A(q, p), n) ? k = !0 : (++q, q >= f.columnCount && (q = 0, ++p)) 840 } 841 x.find("ul").css("height", (w + 1) * e + w * t) 842 } 843 844 function a() { 845 var a = [], d = 0, h = 0, l, k = 0, n = 0, p = 0; 846 x.find("li").css("width", g + "px").css("height", e + "px").each(function () { 847 var d = b(this), e = 0, f = 0, 848 g = 0; 849 c.editedItem && (d.hasClass("ui-draggable-dragging") || d.hasClass("ui-resizable-resizing")) || (d.data("vlsGfCol") && (e = parseInt(d.data("vlsGfCol"))), d.data("vlsGfRow") && (f = parseInt(d.data("vlsGfRow"))), d.data("vlsGfLinkId") && (g = parseInt(d.data("vlsGfLinkId"))), a.push({ 850 element: d, 851 row: f, 852 col: e, 853 linkId: g 854 })) 855 }); 856 a.sort(function (a, b) { 857 return 100 * a.row + a.col - 100 * b.row - b.col 858 }); 859 c.editedItem && (B.css({ 860 left: c.currentArea.col * (g + m) + "px", 861 top: c.currentArea.row * (e + t) + "px" 862 }), c.editedItem.data("vlsGfCol", c.currentArea.col), 863 c.editedItem.data("vlsGfRow", c.currentArea.row), p < c.currentArea.row && (p = c.currentArea.row)); 864 for (l = n = k = 0; l < a.length; ++l) { 865 var q = a[l]; 866 c.editedItem && c.currentArea.col == n && c.currentArea.row == k && (++n, n >= f.columnCount && (n = 0, ++k)); 867 d = (g + m) * n; 868 h = (e + t) * k; 869 q.element.css("top", h + "px").css("left", d + "px"); 870 q.element.data("vlsGfCol", n).attr("data-vls-gf-col", n); 871 q.element.data("vlsGfRow", k).attr("data-vls-gf-row", k); 872 p < k && (p = k); 873 ++n; 874 n >= f.columnCount && (n = 0, ++k) 875 } 876 x.find("ul").css("height", (p + 1) * e + p * t) 877 } 878 879 function h() { 880 var a = 881 b(this); 882 if (!a.hasClass("vls-gf-processing")) { 883 a.addClass("vls-gf-processing"); 884 var c = { 885 layout_type: f.layoutType, 886 column_count: f.columnCount, 887 aspect_ratio: f.aspectRatio, 888 horizontal_spacing: f.horizontalSpacing, 889 vertical_spacing: f.verticalSpacing 890 }, d = []; 891 x.find("li").each(function () { 892 var a = b(this); 893 d.push({ 894 link_id: a.data("vlsGfLinkId"), 895 col: a.data("vlsGfCol"), 896 row: a.data("vlsGfRow"), 897 metro_w: a.data("vlsGfMetroW"), 898 metro_h: a.data("vlsGfMetroH") 899 }) 900 }); 901 b.post(ajaxurl, { 902 action: "vls_gf_update_album_layout", security: vlsGfGalleryAdminData.nonce, 903 album_id: n, options: JSON.stringify(c), images: JSON.stringify(d) 904 }, function (c) { 905 a.removeClass("vls-gf-processing"); 906 b(".vls-gf-update-feedback").show().fadeOut(3E3) 907 }) 908 } 909 } 910 911 var n, c = { 912 editedItem: null, 913 metroSize: {width: 1, height: 1}, 914 centerShift: {x: 0, y: 0}, 915 originalState: {width: 1, height: 1, col: 0, row: 0}, 916 position: {x: 0, y: 0}, 917 currentArea: {col: 0, row: 0, left: 0, right: 0, top: 0, bottom: 0} 918 }, p, x, l; 919 r = 0; 920 q = 1; 921 t = m = e = g = 0; 922 var f = { 923 layoutType: "", 924 columnCount: 0, 925 aspectRatio: 1, 926 horizontalSpacing: 0, 927 verticalSpacing: 0 928 }, B = b('<div class="vls-gf-dragging-placeholder"></div>'); 929 return { 930 loadContent: function (a) { 931 n = a; 932 b.getJSON(ajaxurl, { 933 action: "vls_gf_view_album_layout", 934 album_id: n, 935 tour: VLS_GF.TourModule && VLS_GF.TourModule.isActive() 936 }, u) 937 } 938 } 939 }(jQuery); 940 VLS_GF.ItemEditPanelModule = function (b) { 941 function q(m) { 942 b(".vls-gf-tab-view").empty().append(m.view); 943 b("#vls-gf-item-details button.button-primary").on("click.vls-gf", r) 944 } 945 946 function r(m) { 947 m.preventDefault(); 948 var q = b("#vls-gf-item-details"), g = q.find("button.button-primary"); 949 if (!g.hasClass("disabled")) { 950 g.addClass("disabled"); 951 q.find(".vls-gf-update-feedback").hide(); 952 var e = {action: "vls_gf_update_album_details"}; 953 q.find("input, select, textarea").each(function () { 954 e[this.name] = this.value 955 }); 956 b.post(ajaxurl, e, function () { 957 g.removeClass("disabled"); 958 q.find(".vls-gf-update-feedback").show().fadeOut(3E3) 959 }) 960 } 961 } 962 963 return { 964 loadContent: function (m, r) { 965 b.getJSON(ajaxurl, { 966 action: "vls_gf_view_gallery_item_edit", 967 item_type: m, 968 item_id: r, 969 tour: VLS_GF.TourModule && VLS_GF.TourModule.isActive() 970 }, q) 971 } 972 } 973 }(jQuery); 974 jQuery(document).ready(function () { 975 VLS_GF.TourModule && VLS_GF.TourModule.start(); 976 VLS_GF.GalleryManager.init() 977 }); 1 var VLS_GF=VLS_GF||{}; 2 VLS_GF.GalleryManager=function(b){var q,r,m;function t(k,e,d,a){"all_images"==k||"unsorted_images"==k?(e=0,b("#vls-gf-tab-panel").slideUp(),"all_images"==k?d="All images":"unsorted_images"==k&&(d="Unsorted images"),b(".vls-gf-window-title > .vls-gf-shortcode").css("display","none").find("input").val("")):(b("#vls-gf-tab-panel").slideDown(),b(".vls-gf-window-title .vls-gf-shortcode").css("display","").find("input").val(a));b(".vls-gf-window-title > span").first().text(d);q=k;r=e;m="album_overview"; 3 g(m);return!1}function g(b){b=b.replace("#","");H.append('<div class="vls-gf-loading-overlay"><span></span></div>');D.find("li").removeClass("active");D.find('a[href="#'+b+'"]:first').parent().addClass("active");switch(b){case "album_overview":VLS_GF.AlbumOverviewPanelModule.loadContent(q,r);break;case "album_layout":VLS_GF.AlbumLayoutPanelModule.loadContent(r);break;case "album_edit":VLS_GF.ItemEditPanelModule.loadContent("album",r)}return!1}function e(){return b('<div class="vls-gf-modal"><div class="vls-gf-backdrop"></div><div class="vls-gf-window"></div></div>')} 4 function u(){b(".vls-gf-modal").remove()}function w(){var k=b(this).closest(".vls-gf-modal");if(k.hasClass("vls-gf-busy"))return!1;var e=k.data("vlsGfImages"),d=k.data("vlsGfLinks"),a=k.data("vlsGfCurrentImage"),a=e.indexOf(a);0<a&&(a--,k.data("vlsGfCurrentImage",e[a]),A(k,e[a],d[a]))}function G(){var k=b(this).closest(".vls-gf-modal");if(k.hasClass("vls-gf-busy"))return!1;var e=k.data("vlsGfImages"),d=k.data("vlsGfLinks"),a=k.data("vlsGfCurrentImage"),a=e.indexOf(a);a<e.length-1&&(a++,k.data("vlsGfCurrentImage", 5 e[a]),A(k,e[a],d[a]))}function A(e,g,d){e.addClass("vls-gf-busy");b.getJSON(ajaxurl,{action:"vls_gf_view_image_details",image_id:g,link_id:d},function(b){e.find(".vls-gf-content").empty().append(b.view);b=e.find(".vls-gf-window");b.css("margin-top",0-b.height()/2);e.removeClass("vls-gf-busy")})}function E(){var e=b(".vls-gf-modal"),g=e.find(".vls-gf-window button.button-primary");if(!g.hasClass("vls-gf-processing")){g.addClass("vls-gf-processing");var d={action:"vls_gf_update_image_details"};e.find(".vls-gf-window").find("form input, form select, form textarea").each(function(){d[this.name]= 6 this.value});b.post(ajaxurl,d,function(b){g.removeClass("vls-gf-processing");e.find(".vls-gf-update-feedback").show().fadeOut(3E3)})}}var D,H;q="unsorted_images";r=0;m="album_overview";return{init:function(){D=b("#vls-gf-tab-panel");H=b(".vls-gf-tab-view");D.find("ul > li > a").on("click.vls-gf",function(e){g(b(this).attr("href"));e.preventDefault()});VLS_GF.AlbumsPanelModule.init();t(q,r)},switchAlbum:t,reloadTab:function(){g(m)},showConfirmDialog:function(k,g,d){var a=e(),h=a.find(".vls-gf-window"); 7 h.append('<div class="vls-gf-title"><span>Confirm delete</span></div>');var n=b('<div class="vls-gf-content"></div>');h.append(n);n.append('<span class="vls-gf-message">'+k+"</span>");k=b('<div class="vls-gf-buttons-panel"></div>');h.append(k);n=b('<a class="button" href="#">Cancel</a>');n.on("click.vls-gf",u);k.append(n);g=b('<a class="button-primary" href="#"></a>').text(g);g.on("click.vls-gf",d);k.append(g);b("#wpwrap").append(a);h.css("margin-top",0-h.height()/2)},showNameDialog:function(g,m){var d= 8 "",a="",h="";"rename"===g?(d="Rename item",a="Rename",h="New name"):"createFolder"===g?(d="New folder",a="Create",h="Folder name"):"createAlbum"===g&&(d="New album",a="Create",h="Album name");var n=e(),c=n.find(".vls-gf-window");c.append('<div class="vls-gf-title"><span>'+d+"</span></div>");d=b('<div class="vls-gf-content"></div>');c.append(d);d.append('<label class="vls-gf-form-element"><span>'+h+'</span><input type="text" value="" /></label>');h=d.find("input");h.on("keyup.vls-gf",function(b){13== 9 b.keyCode&&m()});d=b('<div class="vls-gf-buttons-panel"></div>');c.append(d);var p=b('<a class="button" href="#">Cancel</a>');p.on("click.vls-gf",u);d.append(p);a=b('<a class="button-primary" href="#"></a>').text(a);a.on("click.vls-gf",m);d.append(a);b("#wpwrap").append(n);c.css("margin-top",0-c.height()/2);h.focus()},showImageDetailsDialog:function(g,m,d,a){var h=e();h.data("vlsGfImages",d);h.data("vlsGfLinks",a);h.data("vlsGfCurrentImage",g);b("#wpwrap").append(h);d=h.find(".vls-gf-window");d.css({width:"680px", 10 "margin-left":"-340px"});var n=b("<div />").addClass("vls-gf-title").append(b("<span/>").text(vlsGfGalleryAdminData.l10n.strImageDetails));d.append(n);a=b("<div />").addClass("vls-gf-window-controls");n.append(a);n=b("<button/>").addClass("vls-gf-btn-prev").text("<");n.on("click.vls-gf",w);a.append(n);n=b("<button/>").addClass("vls-gf-btn-next").text(">");n.on("click.vls-gf",G);a.append(n);n=b("<button/>").addClass("vls-gf-btn-cancel").text("\u00d7");n.on("click.vls-gf",u);a.append(n);d.append('<div class="vls-gf-content"></div>'); 11 a=b('<div class="vls-gf-buttons-panel"><span class="vls-gf-update-feedback">saved</span></div>');d.append(a);d=b('<a class="button-primary" href="#">'+vlsGfGalleryAdminData.l10n.btnSave+"</a>");d.on("click.vls-gf",E);a.append(d);A(h,g,m)},closePopup:u}}(jQuery); 12 VLS_GF.AlbumsPanelModule=function(b){function q(){b.get(ajaxurl,{action:"vls_gf_view_gallery_tree",tour:VLS_GF.TourModule&&VLS_GF.TourModule.isActive()},function(b){d.empty().append(b);d.find("li").on("click.vls-gf touchend.vls-gf",w);r();d.parent().find("li.unsorted, li.album").droppable({accept:".dragging-image",hoverClass:"drop-ready",drop:F})},"html")}function r(){a.nextItemOrder=99999;var n=0,c=100,p=!1,e=1,l=1,f=0,g=d.find("li").not(".vls-gf-deleted");g.sort(function(c,a){return parseInt(b(c).data("vlsGfOrder"))- 13 parseInt(b(a).data("vlsGfOrder"))});for(var z=0;z<g.length;++z){var v=b(g[z]),C=parseInt(v.data("vlsGfLevel"));C>c?(v.addClass("vls-hidden"),v.css({position:"absolute",top:(n-1)*h.height+"px"}),v.data("vlsGfPosition",n-1).attr("data-vls-gf-position",n-1)):(++f,c=100,v.removeClass("vls-hidden"),v.hasClass("folder")&&!v.hasClass("opened")&&(c=parseInt(v.data("vlsGfLevel"))),a.ghostPosition==n&&++n,v.hasClass("ui-draggable-dragging")||(v.css({top:n*h.height+"px"}),v.data("vlsGfPosition",n).attr("data-vls-gf-position", 14 n),n==a.ghostPosition-1?(p=v.hasClass("folder"),e=C):n==a.ghostPosition+1&&(l=C,a.nextItemOrder=parseInt(v.data("vlsGfOrder"))),++n))}a.$draggedItem&&(a.ghostLevel+=a.initialLevel,l<=e?(p&&(e+=e<(a.$draggedItem.hasClass("folder")?2:3)?1:0),a.ghostLevel>e?a.ghostLevel=e:a.ghostLevel<l&&(a.ghostLevel=l)):a.ghostLevel=l,a.ghostPosition>=f&&(a.ghostPosition=f-1),a.$draggingGhost.css("top",a.ghostPosition*h.height+"px"),a.$draggingGhost.attr("class","dragging-ghost"),a.$draggingGhost.addClass("level-"+ 15 a.ghostLevel));d.css("height",28*f+"px")}function m(b,c){b.hasClass("opened")&&"open"!=c?(b.removeClass("opened"),r()):b.hasClass("opened")||"close"==c||(b.addClass("opened"),r())}function t(e,c){var p=b(this);a.itemTreeOffset={top:d.offset().top,left:d.offset().left};p.removeClass("opened");d.find("li").draggable("disable");a.$draggedItem=p;a.ghostPosition=Math.floor((p.offset().top-a.itemTreeOffset.top+h.middle)/h.height);a.initialLevel=parseInt(p.data("vlsGfLevel"));var x=d.find("li");x.sort(function(c, 16 a){return parseInt(b(c).data("vlsGfOrder"))-parseInt(b(a).data("vlsGfOrder"))});for(var l=!1,f=0;f<x.length;++f){var g=b(x[f]);parseInt(g.data("vlsGfId"));var z=parseInt(g.data("vlsGfOrder")),v=parseInt(g.data("vlsGfLevel"));parseInt(p.data("vlsGfId"));var C=parseInt(p.data("vlsGfOrder"));g.is(p)||(z>C&&v<=a.initialLevel&&!l?l=!0:z>C&&v>a.initialLevel&&!l&&g.addClass("vls-gf-dragging-child"))}d.append(a.$draggingGhost);r()}function g(e,c){var p=parseInt(c.offset.top)+h.middle;if(!(p>=a.currentArea.top&& 17 p<=a.currentArea.bottom&&c.offset.left>=a.currentArea.left&&c.offset.left<=a.currentArea.right)){clearTimeout(a.hoverTimeout);var g=Math.floor((p-a.itemTreeOffset.top)/h.height);0>g&&(g=0);a.ghostLevel=Math.floor((parseInt(c.offset.left)-a.itemTreeOffset.left)/10);a.currentArea.left=a.itemTreeOffset.left+10*a.ghostLevel;a.currentArea.right=a.itemTreeOffset.left+10*(a.ghostLevel+1)-1;var l=a.itemTreeOffset.top+h.height*g,p=p-l+1,f=d.find("li").filter(function(c,a){var v=b(a);return v.data("vlsGfPosition")== 18 g&&!v.hasClass("vls-hidden")&&!v.hasClass("ui-draggable-dragging")});f&&f.hasClass("folder")&&!f.hasClass("opened")?g>a.ghostPosition&&p>h.bottomPart?(a.ghostPosition=g,a.currentArea.top=l,a.currentArea.bottom=l+h.height-1):g<a.ghostPosition&&p<=h.topPart?(a.ghostPosition=g,a.currentArea.top=l,a.currentArea.bottom=l+h.height-1):(g>a.ghostPosition?(a.currentArea.top=l,a.currentArea.bottom=l+h.bottomPart):(a.currentArea.top=l+h.topPart,a.currentArea.bottom=l+h.height-1),a.hoverTimeout=setTimeout(function(){m(f, 19 "open")},500)):(a.ghostPosition=g,a.currentArea.top=l,a.currentArea.bottom=l+h.height-1);r()}}function e(){var a=b(this);a.addClass("ui-draggable-placing");setTimeout(function(){a.removeClass("ui-draggable-placing")},550);return!1}function u(e,c){var g=!1,x=b(this),l=d.find("li").not(".vls-gf-dragging-child, .ui-draggable-dragging");l.sort(function(c,a){var v=b(c),f=b(a);return 1E5*parseInt(v.data("vlsGfPosition"))+parseInt(v.data("vlsGfOrder"))-1E5*parseInt(f.data("vlsGfPosition"))-parseInt(f.data("vlsGfOrder"))}); 20 var f=d.find("li.vls-gf-dragging-child");f.sort(function(c,a){return parseInt(b(c).data("vlsGfOrder"))-parseInt(b(a).data("vlsGfOrder"))});for(var h=0,z=0;z<=l.length;++z){if(z<l.length)var v=b(l[z]);++h;if(!g&&(z==l.length&&99999==a.nextItemOrder||v.hasClass("vls-gf-deleted")||z<l.length&&a.nextItemOrder==parseInt(v.data("vlsGfOrder")))){g=!0;x.data("vlsGfOrder",h).attr("data-vls-gf-order",h);++h;for(var C=0;C<f.length;++C){var m=b(f[C]),k=parseInt(m.data("vlsGfLevel"))+a.ghostLevel-a.initialLevel, 21 k=3<k?3:k;m.data("vlsGfOrder",h).attr("data-vls-gf-order",h).data("vlsGfLevel",k).attr("data-vls-gf-level",k).data("vlsGfPosition",k).attr("data-vls-gf-position",a.ghostPosition).removeClass("level-1 level-2 level-3 level-4 level-5 level-6 level-7").addClass("level-"+k).css("top",a.$draggingGhost.css("top"));++h}}z<l.length&&v.data("vlsGfOrder",h).attr("data-vls-gf-order",h)}x.css({left:"0px",top:a.$draggingGhost.css("top")}).removeClass("ui-draggable-dragging level-1 level-2 level-3 level-4 level-5 level-6 level-7").addClass("level-"+ 22 a.ghostLevel).data("vlsGfPosition",a.ghostPosition).attr("data-vls-gf-position",a.ghostPosition).data("vlsGfLevel",a.ghostLevel).attr("data-vls-gf-level",a.ghostLevel);d.find("li").removeClass("vls-gf-dragging-child").draggable("enable");a.$draggedItem=null;a.ghostPosition=-1;a.items=[];a.$draggingGhost.remove();r()}function w(){var a=b(this);a.hasClass("ui-draggable-dragging")||a.hasClass("ui-draggable-placing")||(a.hasClass("folder")?m(a):a.hasClass("album")&&(b(".vls-gf-gallery-manager-container .left-panel ul>li>span.wp-ui-highlight").remove(), 23 a.append('<span class="wp-ui-highlight">'),VLS_GF.GalleryManager.switchAlbum("album",a.data("vlsGfId"),a.find(".label").text(),a.data("vlsGfShortcode"))));return!1}function G(a){var c=b(this).closest("li");VLS_GF.GalleryManager.showNameDialog("rename",function(){var a=b(".vls-gf-modal").first().find("input").val();a&&""!=a?(c.find(".label").text(a),c.data("vlsGfIsRenamed","true").attr("data-vls-gf-is-renamed","true"),VLS_GF.GalleryManager.closePopup()):alert("Name must be entered")});return!1}function A(a){var c= 24 "",e="";"vls-gf-btn-add-new-folder"==a.target.id?(c="folder",e="createFolder"):(c="album",e="createAlbum");VLS_GF.GalleryManager.showNameDialog(e,function(){var a=b(".vls-gf-modal").first().find("input").val();if(a&&""!=a){var e=d.find("li"),f=0;0<e.length&&(f=parseInt(e.sort(function(a,c){return parseInt(b(a).data("vlsGfOrder"))-parseInt(b(c).data("vlsGfOrder"))}).last().data("vlsGfOrder")));a=b('<li class="'+c+' level-1"><a href="#"><span class="icon"></span><span class="label">'+a+'</span></a><span class="btn btn-delete"></span><span class="btn btn-rename"></span></li>'); 25 a.data("vlsGfId",0).attr("data-vls-gf-id",0).data("vlsGfLevel",1).attr("data-vls-gf-level",1).data("vlsGfOrder",f+1).attr("data-vls-gf-order",f+1).data("vlsGfPosition",99999).attr("data-vls-gf-position",99999).data("vlsGfIsAdded","true").attr("data-vls-gf-is-added","true").css("top",d.height()-28+"px");d.append(a);a.bind("click.vls-gf",w);a.find(".btn-rename").on("click.vls-gf",G);a.find(".btn-delete").on("click.vls-gf",E);k();r();VLS_GF.GalleryManager.closePopup()}else alert("Name must be entered")})} 26 function E(){var a="",c=b(this).closest("li"),a=c.hasClass("album")?'Delete album "'+c.find(".label").text()+'"?':'Delete folder "'+c.find(".label").text()+'" and all its descendants?';VLS_GF.GalleryManager.showConfirmDialog(a,"Delete",function(){var a=0;d.find("li").not(".vls-gf-deleted").sort(function(a,c){return parseInt(b(a).data("vlsGfOrder"))-parseInt(b(c).data("vlsGfOrder"))}).each(function(){var e=b(this);if(e.is(c))a=parseInt(e.data("vlsGfLevel"));else if(0<a){var g=parseInt(e.data("vlsGfLevel")); 27 if(g>a)e.addClass("vls-gf-deleted").data("vlsGfLevel",g-a+1).attr("data-vls-gf-level",g-a+1).data("vlsGfPosition",99999).attr("data-vls-gf-position",99999);else return!1}});c.addClass("vls-gf-deleted").data("vlsGfLevel",1).attr("data-vls-gf-level",1).data("vlsGfIsDeleted","true").attr("data-vls-gf-is-deleted","true").data("vlsGfPosition",99999).attr("data-vls-gf-position",99999);r();VLS_GF.GalleryManager.closePopup();return!1});return!1}function D(a){if(0<d.find(".vls-gf-loading-overlay").length)return!1; 28 b(this).css("display","none");b("#vls-gf-panel-edit-gallery-tree").css("display","block");var c=d.find("li");c.append('<span class="btn btn-delete"></span><span class="btn btn-rename"></span>');c.find(".btn-rename").on("click.vls-gf",G);c.find(".btn-delete").on("click.vls-gf",E);k();a.preventDefault()}function H(a){d.find("li").draggable("destroy").find(".btn").remove();b("#vls-gf-panel-edit-gallery-tree").css("display","none");b("#vls-gf-btn-edit-gallery-tree").css("display","block");d.append('<div class="vls-gf-loading-overlay"><span></span></div>'); 29 if("vls-gf-btn-gallery-tree-commit"==a.target.id){var c=[];d.find("li").each(function(){var a=b(this),e="",g="",f="",d="",h="";a.data("vlsGfIsAdded")&&(f=a.data("vlsGfIsAdded"));a.data("vlsGfIsRenamed")&&(d=a.data("vlsGfIsRenamed"));a.data("vlsGfIsDeleted")&&(h=a.data("vlsGfIsDeleted"));f&&(g=a.hasClass("album")?"album":"folder");if(f||d)e=a.find(".label").text();c.push({id:parseInt(a.data("vlsGfId")),type:g,order:parseInt(a.data("vlsGfOrder")),level:parseInt(a.data("vlsGfLevel")),name:e,is_added:f, 30 is_renamed:d,is_deleted:h})});b.post(ajaxurl,{action:"vls_gf_commit_gallery_tree_changes",security:vlsGfGalleryAdminData.nonce,itemData:JSON.stringify(c)},function(a){q()},"json")}else q();return!1}function k(){d.find("li").draggable({distance:2,addClasses:!1,cursor:"move",cancel:".btn",start:t,drag:g,revert:e,stop:u})}function F(a,c){var e=c.helper.data("sourceAlbum"),g;g=b(a.target).hasClass("unsorted")?0:parseInt(b(a.target).data("vlsGfId"));var d=c.helper.data("draggedImages");e!==g&&b.post(ajaxurl, 31 {action:"vls_gf_move_images_to_album",security:vlsGfGalleryAdminData.nonce,images:JSON.stringify(d),source_album:e,target_album:g},VLS_GF.GalleryManager.reloadTab)}var d,a={$draggedItem:null,$draggingGhost:b('<div class="dragging-ghost"><div></div></div>'),itemTreeOffset:{top:0,bottom:0},currentArea:{top:0,bottom:0,left:0,right:0},initialLevel:0,nextItemOrder:99999,hoverTimeout:{},ghostPosition:-1,ghostLevel:0},h={height:28,middle:14,topPart:11,bottomPart:18};return{init:function(){b(".vls-gf-gallery-manager-container .left-panel ul.fixed-items a").on("click.vls-gf", 32 function(a){var c=b(this);b(".vls-gf-gallery-manager-container .left-panel ul>li>span.wp-ui-highlight").remove();c.parent().append('<span class="wp-ui-highlight">');c=c.attr("href").replace("#","");VLS_GF.GalleryManager.switchAlbum(c,0);a.preventDefault()});d=b("#vls-gf-gallery-tree");b("#vls-gf-btn-edit-gallery-tree").on("click.vls-gf",D);b("#vls-gf-btn-gallery-tree-commit, #vls-gf-btn-gallery-tree-cancel").on("click.vls-gf",H);b("#vls-gf-btn-add-new-folder, #vls-gf-btn-add-new-album").on("click.vls-gf", 33 A);q()},loadGalleryTree:q}}(jQuery); 34 VLS_GF.AlbumOverviewPanelModule=function(b){function q(w){b(".vls-gf-tab-view").empty().append(w);e=b(".vls-gf-tab-view .vls-gf-image-panel");w={thumb_width:140,thumb_height:140,sortable:!0,dragdrop:!0,views:{list:!1,thumbs:!0,active:"thumbs"},multipart_params:{action:"vls_gf_async_upload",album_id:g},flash_swf_url:"/plupload/js/Moxie.swf",silverlight_xap_url:"/plupload/js/Moxie.xap",stop:function(){VLS_GF.GalleryManager.reloadTab()},complete:function(){VLS_GF.GalleryManager.reloadTab()}};var q={action:"vls_gf_async_upload", 35 album_id:g};b.extend(q,vls_plupload_setup_object.multipart_params);b.extend(w,vls_plupload_setup_object);w.multipart_params=q;b("#vls-gf-upload-panel").plupload(w);b("#vls-gf-upload-image-button").on("click.vls-gf",function(e){b(".vls-gf-toolbar").slideUp();b("#vls-gf-upload-panel").slideDown();e.preventDefault()});b("#vls-gf-upload-panel .plupload_cancel").on("click.vls-gf",function(e){b("#vls-gf-upload-panel").slideUp();b(".vls-gf-toolbar").slideDown()});b("#vls-gf-bulk-select-start-button").on("click.vls-gf", 36 function(g){e.addClass("select-mode");b("#vls-gf-toolbar-image-overview").fadeOut();b("#vls-gf-toolbar-bulk-select-left").fadeIn();b("#vls-gf-toolbar-bulk-select-right").fadeIn();g.preventDefault()});b("#vls-gf-bulk-select-cancel-button").on("click.vls-gf",function(g){e.removeClass("select-mode");e.find("li").removeClass("selected").find(".image-icon").remove();b("#vls-gf-toolbar-image-overview").fadeIn();b("#vls-gf-toolbar-bulk-select-left").fadeOut();b("#vls-gf-toolbar-bulk-select-right").fadeOut(); 37 u=null;g.preventDefault()});b("#vls-gf-bulk-select-delete-button").on("click.vls-gf",function(m){var t=[];e.find("li.selected").each(function(){t.push(parseInt(b(this).data("vlsGfImageId")))});b.post(ajaxurl,{action:"vls_gf_delete_images",images:t,album:g},VLS_GF.GalleryManager.reloadTab);u=null;m.preventDefault()});b("#vls-gf-bulk-select-all-button").on("click.vls-gf",function(e){b(".vls-gf-tab-view .vls-gf-image-panel li").not(".selected").addClass("selected").append('<div class="image-icon"><span></span></div>'); 38 u=null;e.preventDefault()});b("#vls-gf-bulk-select-none-button").on("click.vls-gf",function(e){b(".vls-gf-tab-view .vls-gf-image-panel li.selected").removeClass("selected").find(".image-icon").remove();u=null;e.preventDefault()});b("#vls-gf-bulk-select-invert-button").on("click.vls-gf",function(e){b(".vls-gf-tab-view .vls-gf-image-panel li").each(function(){var e=b(this);e.hasClass("selected")?e.removeClass("selected").find(".image-icon").remove():e.addClass("selected").append('<div class="image-icon"><span></span></div>')}); 39 u=null;e.preventDefault()});e.find("li").on("click.vls-gf",function(g){var m=b(this),t=m.data("vlsGfImageId"),q=m.data("vlsGfLinkId"),q=q?q:0;if(e.hasClass("select-mode")){if(g.shiftKey&&u){var k=t=e.find("li").index(u),r=e.find("li").index(m);r<k&&(k=r,r=t);var d=u.hasClass("selected")?"select":"deselect";e.find("li").each(function(){var a=b(this),c=e.find("li").index(a);c>=k&&c<=r&&("select"===d?a.addClass("selected").append('<div class="image-icon"><span></span></div>'):"deselect"===d&&a.removeClass("selected").find(".image-icon").remove())})}else m.hasClass("selected")? 40 m.removeClass("selected").find(".image-icon").remove():m.addClass("selected").append('<div class="image-icon"><span></span></div>');u=m}else{var a=[],h=[];e.find("li").each(function(){a.push(parseInt(b(this).data("vlsGfImageId")));var e=b(this).data("vlsGfLinkId");h.push(parseInt(void 0==e?0:e))});VLS_GF.GalleryManager.showImageDetailsDialog(t,q,a,h)}g.preventDefault()});e.find("li").draggable({delay:100,cursor:"none",helper:r,cursorAt:{top:20,left:20},appendTo:"body",addClasses:!1,start:m,stop:t})} 41 function r(){e.hasClass("select-mode")||b(this).addClass("selected");var m=[];e.find("li.selected").each(function(){m.push(parseInt(b(this).data("vlsGfImageId")))});var t=b('<div id="vls-gf-image-drag-helper">'+m.length+"</div>");t.data("draggedImages",m);t.data("sourceAlbum",g);return t}function m(){b(".left-panel").addClass("drop-ready");b(this).addClass("dragging-image")}function t(){b(".left-panel").removeClass("drop-ready");b(this).removeClass("dragging-image");e.hasClass("select-mode")||b(this).removeClass("selected")} 42 var g,e,u;return{loadContent:function(e,m){g=m;b.get(ajaxurl,{action:"vls_gf_view_album_overview",item_type:e,album_id:m,tour:VLS_GF.TourModule&&VLS_GF.TourModule.isActive()},q,"html")}}}(jQuery); 43 VLS_GF.AlbumLayoutPanelModule=function(b){var q,r,m,t,g,e;function u(a){f.layoutType="";p=b(".vls-gf-tab-view").first();p.empty().append(a.view);x=p.find(".vls-gf-tab-container-layout > div");l=p.find(".vls-gf-tab-container-side form");p.find(".vls-gf-x-1-1").on("click.vls-gf",function(a){w(1);a.preventDefault()});p.find(".vls-gf-x-1-2").on("click.vls-gf",function(a){w(.5);a.preventDefault()});p.find(".vls-gf-x-1-4").on("click.vls-gf",function(a){w(.25);a.preventDefault()});p.find(".vls-gf-btn-save-layout").on("click.vls-gf", 44 function(a){h();a.preventDefault()});l.find("input, select").on("change.vls-gf",function(){G();w(0)});G();w(1);x.find("li").draggable({containment:x,scroll:!0,cursor:"move",addClasses:!1,start:function(a,f){var d=b(this);B.css({width:d.css("width"),height:d.css("height"),top:d.css("top"),left:d.css("left")});x.append(B);B.fadeIn(300);d.data("vlsGfMetroW")?c.metroSize.width=parseInt(d.data("vlsGfMetroW")):c.metroSize.width=1;d.data("vlsGfMetroH")?c.metroSize.height=parseInt(d.data("vlsGfMetroH")): 45 c.metroSize.height=1;c.centerShift={x:Math.ceil(g/2),y:Math.ceil(e/2)};c.position={x:f.position.left,y:f.position.top};c.editedItem=d;E(a,f)},drag:E,stop:function(a,e){B.fadeOut(500,function(){b(this).detach()});c.editedItem=null;F()}})}function w(a){0<a&&(q=a);p.find(".vls-gf-x-1-1").removeClass("vls-gf-active");p.find(".vls-gf-x-1-2").removeClass("vls-gf-active");p.find(".vls-gf-x-1-4").removeClass("vls-gf-active");r=Math.round(x.parent().width()*q);.25>=q?(x.css("width","25%"),p.find(".vls-gf-x-1-4").addClass("vls-gf-active")): 46 .5>=q?(x.css("width","50%"),p.find(".vls-gf-x-1-2").addClass("vls-gf-active")):(x.css("width","100%"),p.find(".vls-gf-x-1-1").addClass("vls-gf-active"));m=Math.floor(f.horizontalSpacing*q);t=Math.floor(f.verticalSpacing*q);g=Math.floor((r-m*(f.columnCount-1))/f.columnCount);e=Math.floor(g/f.aspectRatio);F()}function G(){var a=f.layoutType;f.layoutType=l.find("#vls-gf-param-layout-type").val();var b="";"metro"==f.layoutType?(f.columnCount=parseInt(l.find("#vls-gf-param-metro-column-count").val()), 47 b=l.find("#vls-gf-param-metro-aspect-ratio").val(),f.horizontalSpacing=parseInt(l.find("#vls-gf-param-metro-horizontal-spacing").val()),f.verticalSpacing=parseInt(l.find("#vls-gf-param-metro-vertical-spacing").val())):"grid"==f.layoutType&&(f.columnCount=parseInt(l.find("#vls-gf-param-grid-column-count").val()),b=l.find("#vls-gf-param-grid-aspect-ratio").val(),f.horizontalSpacing=parseInt(l.find("#vls-gf-param-grid-horizontal-spacing").val()),f.verticalSpacing=parseInt(l.find("#vls-gf-param-grid-vertical-spacing").val())); 48 b=b.replace(",",".");b=b.replace(":","/");b=b.replace("-","/");b=b.split("/");f.aspectRatio=parseFloat(b[0]);1<b.length&&(f.aspectRatio=Math.round(f.aspectRatio/parseFloat(b[1])*1E3)/1E3);.25>f.aspectRatio&&(f.aspectRatio=.25);4<f.aspectRatio&&(f.aspectRatio=4);0>f.horizontalSpacing&&(f.horizontalSpacing=0);100<f.horizontalSpacing&&(f.horizontalSpacing=100);0>f.verticalSpacing&&(f.verticalSpacing=0);100<f.verticalSpacing&&(f.verticalSpacing=100);"grid"==f.layoutType?(l.find("#vls-gf-param-grid-horizontal-spacing").val(f.horizontalSpacing.toString()), 49 l.find("#vls-gf-param-grid-vertical-spacing").val(f.verticalSpacing.toString()),l.find("#vls-gf-param-grid-aspect-ratio").val(f.aspectRatio.toString())):"metro"==f.layoutType&&(l.find("#vls-gf-param-metro-horizontal-spacing").val(f.horizontalSpacing.toString()),l.find("#vls-gf-param-metro-vertical-spacing").val(f.verticalSpacing.toString()),l.find("#vls-gf-param-metro-aspect-ratio").val(f.aspectRatio.toString()));a!=f.layoutType&&(x.find("li.ui-resizable").resizable("destroy"),"metro"==f.layoutType? 50 (l.find("#vls-gf-parameters-metro").css("display","block"),l.find("#vls-gf-parameters-grid").css("display","none"),x.find("li").resizable({handles:"all",autoHide:!1,minHeight:43,minWidth:43,start:D,resize:H,stop:k})):"grid"==f.layoutType?(l.find("#vls-gf-parameters-metro").css("display","none"),l.find("#vls-gf-parameters-grid").css("display","block")):(l.find("#vls-gf-parameters-metro").css("display","none"),l.find("#vls-gf-parameters-grid").css("display","none")))}function A(a,b){return"x"+("00000"+ 51 a).slice(-5)+"y"+("00000"+b).slice(-5)}function E(a,b){c.position={x:b.position.left+c.centerShift.x,y:b.position.top+c.centerShift.y};if(c.position.x<c.currentArea.left||c.position.x>c.currentArea.right||c.position.y<c.currentArea.top||c.position.y>c.currentArea.bottom)c.currentArea.col=Math.floor(c.position.x/(g+m)),c.currentArea.row=Math.floor(c.position.y/(e+t)),c.currentArea.left=c.currentArea.col*(g+m)-m,c.currentArea.right=(c.currentArea.col+1)*(g+m),c.currentArea.top=c.currentArea.row*(e+ 52 t)-t,c.currentArea.bottom=(c.currentArea.row+1)*(e+t),F()}function D(a,f){var d=b(this);B.css({width:d.css("width"),height:d.css("height"),top:d.css("top"),left:d.css("left")});d.closest("div").append(B);B.fadeIn(300);d.data("vlsGfMetroW")?c.metroSize.width=parseInt(d.data("vlsGfMetroW")):c.metroSize.width=1;c.originalState.width=c.metroSize.width;d.data("vlsGfMetroH")?c.metroSize.height=parseInt(d.data("vlsGfMetroH")):c.metroSize.height=1;c.originalState.height=c.metroSize.height;d.data("vlsGfCol")? 53 c.originalState.col=parseInt(d.data("vlsGfCol")):c.originalState.col=0;d.data("vlsGfRow")?c.originalState.row=parseInt(d.data("vlsGfRow")):c.originalState.row=0;c.centerShift={x:Math.ceil(g/2),y:Math.ceil(e/2)};c.position={x:f.position.left,y:f.position.top};c.editedItem=d;E(a,f)}function H(a,b){var d=Math.floor((b.size.width-Math.floor(.2*g))/(g+m))+1,f=Math.floor((b.size.height-Math.floor(.2*e))/(e+t))+1;if(d!==c.metroSize.width||f!==c.metroSize.height)c.metroSize.width=d,c.metroSize.height=f,c.currentArea.col= 54 b.originalPosition.left===b.position.left?c.originalState.col:c.originalState.col+c.originalState.width-d,c.currentArea.row=b.originalPosition.top===b.position.top?c.originalState.row:c.originalState.row+c.originalState.height-f,F()}function k(a,e){B.fadeOut(500,function(){b(this).detach()});c.editedItem=null;F()}function F(){switch(f.layoutType){case "metro":d(f);break;case "grid":a(f)}}function d(){var a=[],d=0,h=0,l,k,n=[],p=0,q=0,r=0,u=0,w=0;x.find("li").each(function(){var d=b(this),e=0,f=0, 55 g=1,h=1;c.editedItem&&(d.hasClass("ui-draggable-dragging")||d.hasClass("ui-resizable-resizing"))||(d.data("vlsGfCol")&&(e=parseInt(d.data("vlsGfCol"))),d.data("vlsGfRow")&&(f=parseInt(d.data("vlsGfRow"))),d.data("vlsGfMetroW")&&(g=parseInt(d.data("vlsGfMetroW"))),d.data("vlsGfMetroH")&&(h=parseInt(d.data("vlsGfMetroH"))),a.push({element:d,row:f,col:e,width:g,height:h}))});a.sort(function(a,b){return 100*a.row+a.col-100*b.row-b.col});if(c.editedItem){if(c.currentArea.col+c.metroSize.width>f.columnCount)return; 56 for(d=0;d<c.metroSize.width;++d)for(h=0;h<c.metroSize.height;++h)n.push(A(c.currentArea.col+d,c.currentArea.row+h));for(k=!1;!k;)0>b.inArray(A(q,p),n)?k=!0:(++q,q>=f.columnCount&&(q=0,++p));B.css({width:c.metroSize.width*(g+m)-m+"px",height:c.metroSize.height*(e+t)-t+"px",left:c.currentArea.col*(g+m)+"px",top:c.currentArea.row*(e+t)+"px"});c.editedItem.data("vlsGfCol",c.currentArea.col);c.editedItem.data("vlsGfRow",c.currentArea.row);c.editedItem.data("vlsGfMetroW",c.metroSize.width);c.editedItem.attr("data-vls-gf-metro-w", 57 c.metroSize.width);c.editedItem.data("vlsGfMetroH",c.metroSize.height);c.editedItem.attr("data-vls-gf-metro-h",c.metroSize.height);w<c.currentArea.row+c.metroSize.height-1&&(w=c.currentArea.row+c.metroSize.height-1)}for(l=0;l<a.length;++l){var y=a[l];y.width>f.columnCount&&(y.width=f.columnCount);k=!1;u=q;for(r=p;!k;){k=!0;for(d=0;d<y.width;++d)for(h=0;h<y.height;++h)if(u+d>=f.columnCount||0<=b.inArray(A(u+d,r+h),n))k=!1;k||(++u,u>=f.columnCount&&(u=0,++r))}for(d=0;d<y.width;++d)for(h=0;h<y.height;++h)n.push(A(u+ 58 d,r+h));d=(g+m)*u;h=(e+t)*r;y.element.css("width",y.width*g+(y.width-1)*m+"px").css("height",y.height*e+(y.height-1)*t+"px").css("top",h+"px").css("left",d+"px");y.element.data("vlsGfCol",u);y.element.data("vlsGfRow",r);w<r+y.height-1&&(w=r+y.height-1);for(k=!1;!k;)0>b.inArray(A(q,p),n)?k=!0:(++q,q>=f.columnCount&&(q=0,++p))}x.find("ul").css("height",(w+1)*e+w*t)}function a(){var a=[],d=0,h=0,l,k=0,n=0,p=0;x.find("li").css("width",g+"px").css("height",e+"px").each(function(){var d=b(this),e=0,f=0, 59 g=0;c.editedItem&&(d.hasClass("ui-draggable-dragging")||d.hasClass("ui-resizable-resizing"))||(d.data("vlsGfCol")&&(e=parseInt(d.data("vlsGfCol"))),d.data("vlsGfRow")&&(f=parseInt(d.data("vlsGfRow"))),d.data("vlsGfLinkId")&&(g=parseInt(d.data("vlsGfLinkId"))),a.push({element:d,row:f,col:e,linkId:g}))});a.sort(function(a,b){return 100*a.row+a.col-100*b.row-b.col});c.editedItem&&(B.css({left:c.currentArea.col*(g+m)+"px",top:c.currentArea.row*(e+t)+"px"}),c.editedItem.data("vlsGfCol",c.currentArea.col), 60 c.editedItem.data("vlsGfRow",c.currentArea.row),p<c.currentArea.row&&(p=c.currentArea.row));for(l=n=k=0;l<a.length;++l){var q=a[l];c.editedItem&&c.currentArea.col==n&&c.currentArea.row==k&&(++n,n>=f.columnCount&&(n=0,++k));d=(g+m)*n;h=(e+t)*k;q.element.css("top",h+"px").css("left",d+"px");q.element.data("vlsGfCol",n).attr("data-vls-gf-col",n);q.element.data("vlsGfRow",k).attr("data-vls-gf-row",k);p<k&&(p=k);++n;n>=f.columnCount&&(n=0,++k)}x.find("ul").css("height",(p+1)*e+p*t)}function h(){var a= 61 b(this);if(!a.hasClass("vls-gf-processing")){a.addClass("vls-gf-processing");var c={layout_type:f.layoutType,column_count:f.columnCount,aspect_ratio:f.aspectRatio,horizontal_spacing:f.horizontalSpacing,vertical_spacing:f.verticalSpacing},d=[];x.find("li").each(function(){var a=b(this);d.push({link_id:a.data("vlsGfLinkId"),col:a.data("vlsGfCol"),row:a.data("vlsGfRow"),metro_w:a.data("vlsGfMetroW"),metro_h:a.data("vlsGfMetroH")})});b.post(ajaxurl,{action:"vls_gf_update_album_layout",security:vlsGfGalleryAdminData.nonce, 62 album_id:n,options:JSON.stringify(c),images:JSON.stringify(d)},function(c){a.removeClass("vls-gf-processing");b(".vls-gf-update-feedback").show().fadeOut(3E3)})}}var n,c={editedItem:null,metroSize:{width:1,height:1},centerShift:{x:0,y:0},originalState:{width:1,height:1,col:0,row:0},position:{x:0,y:0},currentArea:{col:0,row:0,left:0,right:0,top:0,bottom:0}},p,x,l;r=0;q=1;t=m=e=g=0;var f={layoutType:"",columnCount:0,aspectRatio:1,horizontalSpacing:0,verticalSpacing:0},B=b('<div class="vls-gf-dragging-placeholder"></div>'); 63 return{loadContent:function(a){n=a;b.getJSON(ajaxurl,{action:"vls_gf_view_album_layout",album_id:n,tour:VLS_GF.TourModule&&VLS_GF.TourModule.isActive()},u)}}}(jQuery); 64 VLS_GF.ItemEditPanelModule=function(b){function q(m){b(".vls-gf-tab-view").empty().append(m.view);b("#vls-gf-item-details button.button-primary").on("click.vls-gf",r)}function r(m){m.preventDefault();var q=b("#vls-gf-item-details"),g=q.find("button.button-primary");if(!g.hasClass("disabled")){g.addClass("disabled");q.find(".vls-gf-update-feedback").hide();var e={action:"vls_gf_update_album_details"};q.find("input, select, textarea").each(function(){e[this.name]=this.value});b.post(ajaxurl,e,function(){g.removeClass("disabled"); 65 q.find(".vls-gf-update-feedback").show().fadeOut(3E3)})}}return{loadContent:function(m,r){b.getJSON(ajaxurl,{action:"vls_gf_view_gallery_item_edit",item_type:m,item_id:r,tour:VLS_GF.TourModule&&VLS_GF.TourModule.isActive()},q)}}}(jQuery);jQuery(document).ready(function(){VLS_GF.TourModule&&VLS_GF.TourModule.start();VLS_GF.GalleryManager.init()}); -
gallery-factory-lite/trunk/gallery-factory.php
r1181499 r1192116 24 24 25 25 //defining global variables 26 define( 'VLS_GF_VERSION', '1.1. 0' );26 define( 'VLS_GF_VERSION', '1.1.1' ); 27 27 define('VLS_GF_DB_VERSION', 2); 28 28 define('VLS_GF_MINIMUM_WP_VERSION', '3.9'); -
gallery-factory-lite/trunk/readme.txt
r1181501 r1192116 5 5 Requires at least: 3.9.0 6 6 Tested up to: 4.2.2 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.html
Note: See TracChangeset
for help on using the changeset viewer.