From ed3a1b47bd634aed67139d668ca6227c80e7bac0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 30 Mar 2014 19:17:48 -0400 Subject: [PATCH] category changes --- public/language/en_GB/category.json | 3 ++- public/src/forum/category.js | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/public/language/en_GB/category.json b/public/language/en_GB/category.json index 861c7b4ec6..7a900353e2 100644 --- a/public/language/en_GB/category.json +++ b/public/language/en_GB/category.json @@ -7,5 +7,6 @@ "browsing": "browsing", "no_replies": "No one has replied", "replied": "replied", - "last_edited_by": "last edited by" + "last_edited_by": "last edited by", + "share_this_category": "Share this category" } diff --git a/public/src/forum/category.js b/public/src/forum/category.js index fdcfe3ec90..f493df08ed 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -10,21 +10,34 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { app.enterRoom('category_' + cid); - $('#twitter-share').on('click', function () { + $('.twitter-share').on('click', function () { window.open('https://twitter.com/intent/tweet?url=' + encodeURIComponent(window.location.href) + '&text=' + encodeURIComponent(ajaxify.variables.get('category_name')), '_blank', 'width=550,height=420,scrollbars=no,status=no'); return false; }); - $('#facebook-share').on('click', function () { + $('.facebook-share').on('click', function () { window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(window.location.href), '_blank', 'width=626,height=436,scrollbars=no,status=no'); return false; }); - $('#google-share').on('click', function () { + $('.google-share').on('click', function () { window.open('https://plus.google.com/share?url=' + encodeURIComponent(window.location.href), '_blank', 'width=500,height=570,scrollbars=no,status=no'); return false; }); + $('.share-dropdown').on('shown.bs.dropdown', function() { + $('#category-link').val(window.location.protocol + '//' + window.location.host + window.location.pathname); + // without the setTimeout can't select the text in the input + setTimeout(function() { + $('#category-link').putCursorAtEnd().select(); + }, 50); + }); + + $('.post-link').on('click', function(e) { + e.preventDefault(); + return false; + }); + $('#new_post').on('click', function () { composer.newTopic(cid); });