From 5b9d0d0168d9356fc7d944fb565cdbed85d659a1 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 3 Oct 2014 14:12:12 +0200 Subject: Only use colorbox if it's loaded Signed-off-by: Florian Pritz --- data/js/script.js | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/data/js/script.js b/data/js/script.js index 100f30bd0..a4c545088 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -78,12 +78,16 @@ function fixedEncodeURIComponent (str) { $('#delete_button').hide(); $("#delete_form input[id^='delete_']").remove(); $(".upload_thumbnails .marked").removeClass("marked"); - setup_colorbox(); + if (typeof $.colorbox !== 'undefined') { + setup_colorbox(); + } break; default: window.page_mode = "delete"; $('#delete_button').show(); - $.colorbox.remove(); + if (typeof $.colorbox !== 'undefined') { + $.colorbox.remove(); + } break; } }); @@ -238,22 +242,23 @@ function fixedEncodeURIComponent (str) { }); } - function setup_colorbox() { - $('.colorbox').colorbox({ - photo: true, - retinaImage: true, - maxHeight: "100%", - maxWidth: "100%", - next: '', - previous: '', - close: '', - loop: false, - orientation: function() { - return parseInt($(this).children().first().parent().attr("data-orientation")); - }, - }); + if (typeof $.colorbox !== 'undefined') { + function setup_colorbox() { + $('.colorbox').colorbox({ + photo: true, + retinaImage: true, + maxHeight: "100%", + maxWidth: "100%", + next: '', + previous: '', + close: '', + loop: false, + orientation: function() { + return parseInt($(this).children().first().parent().attr("data-orientation")); + }, + }); + } + setup_colorbox(); } - setup_colorbox(); - }); })(jQuery); -- cgit v1.2.3-24-g4f1b