From 0494244e8068198707bf602199413cd216b0d515 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 3 Feb 2013 18:48:30 -0500 Subject: Super first pass: - jQuery 1.90 - jQuery UI 1.10 - Superfish 1.5.1 (minus all plugins) - jQuery Form 3.26.0-2013.01.28 Deleted all other jQuery plugins for now. - Reworked autocomplete to use the latest jQuery code. - Deleted references to $.browser.msie, no longer supported - Basic CSS support for autocomplete - lots more work needed there --- themes/wind/js/ui.init.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'themes/wind/js/ui.init.js') diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index 3ee3e32e..5a83c015 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -82,9 +82,6 @@ $(document).ready(function() { } else { var sib_height = $(this).prev().height(); } - if ($.browser.msie && $.browser.version <= 8) { - sib_height = sib_height + 1; - } $(this).css("height", sib_height); $(this).css("position", "relative"); $(this).css("top", 0).css("left", 0); -- cgit v1.2.3 From 09fbe4c3442af2689b1ec7e540cd87a282c01123 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 25 Feb 2013 17:13:10 +0100 Subject: #2018 - Make ui.init.js thumbnail hover effect more robust. - changed thumbnail hover effect to store its original height on mouseenter, then return to it on mouseleave. - removed previous routine which depended on the height of its siblings and was incompatible with some IE versions. --- themes/wind/js/ui.init.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'themes/wind/js/ui.init.js') diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index 5a83c015..c9f9202c 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -54,6 +54,8 @@ $(document).ready(function() { // Initialize thumbnail hover effect $(".g-item").hover( function() { + // Store original height so we can change it back afterward + $(this).attr("data-orig-height", $(this).height()); // Insert a placeholder to hold the item's position in the grid var placeHolder = $(this).clone().attr("id", "g-place-holder"); $(this).after($(placeHolder)); @@ -77,17 +79,12 @@ $(document).ready(function() { }, function() { // Reset item height and position - if ($(this).next().height()) { - var sib_height = $(this).next().height(); - } else { - var sib_height = $(this).prev().height(); - } - $(this).css("height", sib_height); + $(this).css("height", $(this).attr("data-orig-height")); $(this).css("position", "relative"); $(this).css("top", 0).css("left", 0); // Remove the placeholder and hover class from the item $(this).removeClass("g-hover-item"); - $(this).gallery_valign(); + $(this).gallery_valign(); $("#g-place-holder").remove(); } ); @@ -95,7 +92,7 @@ $(document).ready(function() { // Realign any thumbnails that change so that when we rotate a thumb it stays centered. $(".g-item").bind("gallery.change", function() { $(".g-item").each(function() { - $(this).height($(this).find("img").height() + 2); + $(this).height($(this).find("img").height() + 2); }); $(".g-item").equal_heights().gallery_valign(); }); -- cgit v1.2.3 From ef2ca6edb572501145ec3a4d6aa529118081188a Mon Sep 17 00:00:00 2001 From: shadlaws Date: Thu, 28 Feb 2013 17:10:48 +0100 Subject: #2018 follow-on and #2023 - Fixed issues with thumb hover effects. - cleaned up resize after hover: more efficient, totally browser-compatible (IE7-10, FF, Chrome tested!). - cleaned up resize on hover: more efficient, fixed bug with neighbors that are bigger but only by a little. - fixed bugs when moving off item with expanded context menu and then quickly back: oversized hover, flicker. - cleaned up formatting, removed unneeded code, and added comments. --- lib/gallery.common.js | 6 ++++-- themes/wind/js/ui.init.js | 33 +++++++++++++-------------------- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'themes/wind/js/ui.init.js') diff --git a/lib/gallery.common.js b/lib/gallery.common.js index fa11aeb9..c3d1362c 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -144,11 +144,13 @@ list.hide(); hover_target.hover( + // The stop arguments below ensure that when we leave an item with an expanded context + // menu then *quickly* come back, we neither freeze mid-slide nor flicker. function() { - list.stop(true, true).slideDown("fast"); + list.stop(false, true).slideDown("fast"); }, function() { - list.stop(true, true).slideUp("slow"); + list.stop(true, false).slideUp("slow"); } ); diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index c9f9202c..fd75c210 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -49,42 +49,35 @@ $(document).ready(function() { // Album and search results views if ($("#g-album-grid").length) { // Set equal height for album items and vertically align thumbnails/metadata - $('.g-item').equal_heights().gallery_valign(); + $(".g-item").equal_heights().gallery_valign(); + // Store the resulting item height. Storing this here for the whole grid as opposed to in the + // hover event as an attr for each item is more efficient and ensures IE6-8 compatibility. + var item_height = $(".g-item").height(); // Initialize thumbnail hover effect $(".g-item").hover( function() { - // Store original height so we can change it back afterward - $(this).attr("data-orig-height", $(this).height()); // Insert a placeholder to hold the item's position in the grid - var placeHolder = $(this).clone().attr("id", "g-place-holder"); - $(this).after($(placeHolder)); + var place_holder = $(this).clone().attr("id", "g-place-holder"); + $(this).after($(place_holder)); // Style and position the hover item var position = $(this).position(); $(this).css("top", position.top).css("left", position.left); $(this).addClass("g-hover-item"); - // Initialize the contextual menu + // Initialize the contextual menu. Note that putting it here delays execution until needed. $(this).gallery_context_menu(); - // Set the hover item's height + // Set the hover item's height. Use "li a" on the context menu so we get the height of the + // collapsed menu and avoid problems with incomplete slideUp/Down animations. $(this).height("auto"); - var context_menu = $(this).find(".g-context-menu"); - var adj_height = $(this).height() + context_menu.height(); - if ($(this).next().height() > $(this).height()) { - $(this).height($(this).next().height()); - } else if ($(this).prev().height() > $(this).height()) { - $(this).height($(this).prev().height()); - } else { - $(this).height(adj_height); - } + $(this).height(Math.max($(this).height(), item_height) + + $(this).find(".g-context-menu li a").height()); }, function() { // Reset item height and position - $(this).css("height", $(this).attr("data-orig-height")); - $(this).css("position", "relative"); - $(this).css("top", 0).css("left", 0); + $(this).height(item_height); + $(this).css("top", "").css("left", ""); // Remove the placeholder and hover class from the item $(this).removeClass("g-hover-item"); - $(this).gallery_valign(); $("#g-place-holder").remove(); } ); -- cgit v1.2.3 From 2e94edab5396d53b1b09b6b1415d1f66d6f16de5 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 11 Mar 2013 17:16:20 +0100 Subject: #2053 - Change all .bind() to .on() for jQuery future-proofing. - on/off are preferred to bind/unbind, live/die, and delegate/undelegate in jQuery 1.7+ - they're likely on the road toward deprecation, so let's replace them now. --- lib/gallery.common.js | 4 ++-- modules/server_add/js/server_add.js | 2 +- themes/wind/js/ui.init.js | 2 +- themes/wind/views/photo.html.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'themes/wind/js/ui.init.js') diff --git a/lib/gallery.common.js b/lib/gallery.common.js index 5ff6b397..f5dee958 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -212,7 +212,7 @@ } // Attach event listeners to the input - input.bind("focus", function(e) { + input.on("focus", function(e) { // Empty input value if it equals it's label if ($(this).val() == label.html()) { $(this).val(""); @@ -220,7 +220,7 @@ button.attr("disabled", false); }); - input.bind("blur", function(e){ + input.on("blur", function(e) { // Reset the input value if it's empty if ($(this).val() == "") { $(this).val(label.html()); diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 02dda4c0..a2499896 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -33,7 +33,7 @@ $("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) { self.open_dir(event); }); - $("#g-dialog").bind("dialogclose", function(event, ui) { + $("#g-dialog").on("dialogclose", function(event, ui) { window.location.reload(); }); }, diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index fd75c210..4f901778 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -83,7 +83,7 @@ $(document).ready(function() { ); // Realign any thumbnails that change so that when we rotate a thumb it stays centered. - $(".g-item").bind("gallery.change", function() { + $(".g-item").on("gallery.change", function() { $(".g-item").each(function() { $(this).height($(this).find("img").height() + 2); }); diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php index b42ab987..1fab71e1 100644 --- a/themes/wind/views/photo.html.php +++ b/themes/wind/views/photo.html.php @@ -12,7 +12,7 @@ // After the image is rotated or replaced we have to reload the image dimensions // so that the full size view isn't distorted. - $("#g-photo").bind("gallery.change", function() { + $("#g-photo").on("gallery.change", function() { $.ajax({ url: "item()->id) ?>", dataType: "json", -- cgit v1.2.3