diff options
author | shadlaws <shad@shadlaws.com> | 2013-02-23 21:38:49 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-02-23 21:38:49 +0100 |
commit | b09a5fab9481b6feb67fb7eed6643698f8652707 (patch) | |
tree | 574ecc601368dc4f5d62234328580d14c876827f /lib/gallery.panel.js | |
parent | fd012276cbf03cc1dc7b8da10aac5cc6f26326c6 (diff) |
#2013 - Clean up gallery.panel.js (formatting only)
- fixed whitespaces
Diffstat (limited to 'lib/gallery.panel.js')
-rw-r--r-- | lib/gallery.panel.js | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/lib/gallery.panel.js b/lib/gallery.panel.js index 15c09920..877faf64 100644 --- a/lib/gallery.panel.js +++ b/lib/gallery.panel.js @@ -1,90 +1,90 @@ (function($) { - $.widget("ui.gallery_panel", { - _init: function() { - var self = this; - this.element.click(function(event) { - event.preventDefault(); - var element = event.currentTarget; - var parent = $(element).parent().parent(); - var sHref = $(element).attr("href"); - var parentClass = $(parent).attr("class"); - var ePanel = "<tr id=\"g-panel\"><td colspan=\"6\"></td></tr>"; + $.widget("ui.gallery_panel", { + _init: function() { + var self = this; + this.element.click(function(event) { + event.preventDefault(); + var element = event.currentTarget; + var parent = $(element).parent().parent(); + var sHref = $(element).attr("href"); + var parentClass = $(parent).attr("class"); + var ePanel = "<tr id=\"g-panel\"><td colspan=\"6\"></td></tr>"; - // We keep track of the open vs. closed state by looking to see if there's - // a data-orig-text attr. If that attr is missing, then the panel is closed - // and we want to open it - var should_open = !$(element).attr("data-orig-text"); + // We keep track of the open vs. closed state by looking to see if there's + // a data-orig-text attr. If that attr is missing, then the panel is closed + // and we want to open it + var should_open = !$(element).attr("data-orig-text"); - // Close any open panels and reset their button text - if ($("#g-panel").length) { - $("#g-panel").slideUp("slow").remove(); - $.each($(".g-panel-link"), - function() { - if ($(this).attr("data-orig-text")) { - $(this).children(".g-button-text").text($(this).attr("data-orig-text")); - $(this).attr("data-orig-text", ""); - } - } - ); - } + // Close any open panels and reset their button text + if ($("#g-panel").length) { + $("#g-panel").slideUp("slow").remove(); + $.each($(".g-panel-link"), + function() { + if ($(this).attr("data-orig-text")) { + $(this).children(".g-button-text").text($(this).attr("data-orig-text")); + $(this).attr("data-orig-text", ""); + } + } + ); + } - if (should_open) { - $(parent).after(ePanel); - $("#g-panel td").html(sHref); - $.ajax({ - url: sHref, - type: "GET", - success: function(data, textStatus, xhr) { - var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); - var content = ""; - if (mimeType[1] == "application/json") { - content = unescape(data.html); - } else { - content = data; - } + if (should_open) { + $(parent).after(ePanel); + $("#g-panel td").html(sHref); + $.ajax({ + url: sHref, + type: "GET", + success: function(data, textStatus, xhr) { + var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); + var content = ""; + if (mimeType[1] == "application/json") { + content = unescape(data.html); + } else { + content = data; + } - $("#g-panel td").html(content); - self._ajaxify_panel(); - if ($(element).attr("data-open-text")) { - $(element).attr("data-orig-text", $(element).children(".g-button-text").text()); - $(element).children(".g-button-text").text($(element).attr("data-open-text")); - } - $("#g-panel").addClass(parentClass).show().slideDown("slow"); - } - }); - } + $("#g-panel td").html(content); + self._ajaxify_panel(); + if ($(element).attr("data-open-text")) { + $(element).attr("data-orig-text", $(element).children(".g-button-text").text()); + $(element).children(".g-button-text").text($(element).attr("data-open-text")); + } + $("#g-panel").addClass(parentClass).show().slideDown("slow"); + } + }); + } - return false; - }); - }, + return false; + }); + }, - _ajaxify_panel: function () { - var self = this; - $("#g-panel td form").ajaxForm({ - dataType: "json", - beforeSubmit: function(formData, form, options) { - form.find(":submit") - .addClass("ui-state-disabled") - .attr("disabled", "disabled"); - return true; - }, - success: function(data) { - if (data.html) { - $("#g-panel td").html(data.html); - self._ajaxify_panel(); - } - if (data.result == "success") { - self._trigger("success", null, {}); - if (data.location) { - window.location = data.location; - } else { - window.location.reload(); - } - } - } - }); - }, + _ajaxify_panel: function () { + var self = this; + $("#g-panel td form").ajaxForm({ + dataType: "json", + beforeSubmit: function(formData, form, options) { + form.find(":submit") + .addClass("ui-state-disabled") + .attr("disabled", "disabled"); + return true; + }, + success: function(data) { + if (data.html) { + $("#g-panel td").html(data.html); + self._ajaxify_panel(); + } + if (data.result == "success") { + self._trigger("success", null, {}); + if (data.location) { + window.location = data.location; + } else { + window.location.reload(); + } + } + } + }); + }, - success: function(event, ui) {} - }); - })(jQuery); + success: function(event, ui) {} + }); +})(jQuery); |