diff options
author | Olivier Paroz <github@oparoz.com> | 2015-01-30 02:50:55 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-01-30 02:50:55 +0300 |
commit | d3de665cd057849e21d4f3dfe9d8a556eb20d7f6 (patch) | |
tree | 5227841a4e34b5a7f4eb85bd7c0fe649a096a9ee /js | |
parent | 3ac7500bec249ac29bd39415c4a89526de91666e (diff) |
Only generate gallery links on folders
Diffstat (limited to 'js')
-rw-r--r-- | js/gallerybutton.js | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/js/gallerybutton.js b/js/gallerybutton.js index 4fc071dd..461b931e 100644 --- a/js/gallerybutton.js +++ b/js/gallerybutton.js @@ -50,32 +50,33 @@ GalleryButton.hijackShare = function () { var target = OC.Share.showLink; OC.Share.showLink = function () { var r = target.apply(this, arguments); + if ($('#dropdown.drop.shareDropDown').data('item-type') === "folder") { + + if (!$('#linkSwitchButton').length) { + var linkSwitchButton = '<a class="button" id="linkSwitchButton">' + + t(GalleryButton.appName, 'Show Gallery link') + '</a>'; + $('#linkCheckbox+label').after(linkSwitchButton); + } - if (!$('#linkSwitchButton').length) { - var linkSwitchButton = '<a class="button" id="linkSwitchButton">' + - t(GalleryButton.appName, 'Show Gallery link') + '</a>'; - $('#linkCheckbox+label').after(linkSwitchButton); - } + $("#linkSwitchButton").toggle(function () { + $(this).text("Show Files link"); + $('#linkText').val($('#linkText').val().replace('index.php/s/', 'index.php/apps/' + + GalleryButton.appName + '/s/')); + }, function () { + $(this).text("Show Gallery link"); + $('#linkText').val($('#linkText').val().replace('index.php/apps/' + + GalleryButton.appName + '/s/', 'index.php/s/')); - $("#linkSwitchButton").toggle(function () { - $(this).text("Show Files link"); - $('#linkText').val($('#linkText').val().replace('index.php/s/', 'index.php/apps/' + - GalleryButton.appName + '/s/')); - }, function () { - $(this).text("Show Gallery link"); - $('#linkText').val($('#linkText').val().replace('index.php/apps/' + - GalleryButton.appName + '/s/', 'index.php/s/')); - - }); - - $('#linkCheckbox').change(function () { - if (this.checked) { - $('#linkSwitchButton').show(); - } else { - $('#linkSwitchButton').hide(); - } - }); + }); + $('#linkCheckbox').change(function () { + if (this.checked) { + $('#linkSwitchButton').show(); + } else { + $('#linkSwitchButton').hide(); + } + }); + } return r; }; }; |