diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-10-03 14:12:12 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-10-03 14:22:34 +0200 |
commit | 5b9d0d0168d9356fc7d944fb565cdbed85d659a1 (patch) | |
tree | 326f1ed096c78d2c386b20fd44c8b6f7224e9beb /data/js/script.js | |
parent | 21ed4d5845fb5b2801639834ad7e9523eb9cadc2 (diff) |
Only use colorbox if it's loaded
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'data/js/script.js')
-rw-r--r-- | data/js/script.js | 41 |
1 files 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: '<span class="glyphicon glyphicon-chevron-right"></span>', - previous: '<span class="glyphicon glyphicon-chevron-left"></span>', - close: '<span class="glyphicon glyphicon-remove"></span>', - 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: '<span class="glyphicon glyphicon-chevron-right"></span>', + previous: '<span class="glyphicon glyphicon-chevron-left"></span>', + close: '<span class="glyphicon glyphicon-remove"></span>', + loop: false, + orientation: function() { + return parseInt($(this).children().first().parent().attr("data-orientation")); + }, + }); + } + setup_colorbox(); } - setup_colorbox(); - }); })(jQuery); |