mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
added pid to share links, removed unused vars
This commit is contained in:
@@ -6,17 +6,12 @@ define(function() {
|
|||||||
Topic.init = function() {
|
Topic.init = function() {
|
||||||
var expose_tools = templates.get('expose_tools'),
|
var expose_tools = templates.get('expose_tools'),
|
||||||
tid = templates.get('topic_id'),
|
tid = templates.get('topic_id'),
|
||||||
postListEl = document.getElementById('post-container'),
|
|
||||||
editBtns = document.querySelectorAll('#post-container .post-buttons .edit, #post-container .post-buttons .edit i'),
|
|
||||||
thread_state = {
|
thread_state = {
|
||||||
locked: templates.get('locked'),
|
locked: templates.get('locked'),
|
||||||
deleted: templates.get('deleted'),
|
deleted: templates.get('deleted'),
|
||||||
pinned: templates.get('pinned')
|
pinned: templates.get('pinned')
|
||||||
},
|
},
|
||||||
topic_name = templates.get('topic_name'),
|
topic_name = templates.get('topic_name');
|
||||||
twitter_url = templates.get('twitter-intent-url'),
|
|
||||||
facebook_url = templates.get('facebook-share-url'),
|
|
||||||
google_url = templates.get('google-share-url');
|
|
||||||
|
|
||||||
|
|
||||||
function fixDeleteStateForPosts() {
|
function fixDeleteStateForPosts() {
|
||||||
@@ -40,21 +35,6 @@ define(function() {
|
|||||||
$('.topic-main-buttons').removeClass('hide').parent().removeClass('hide');
|
$('.topic-main-buttons').removeClass('hide').parent().removeClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.twitter-share').on('click', function () {
|
|
||||||
window.open(twitter_url, '_blank', 'width=550,height=420,scrollbars=no,status=no');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.facebook-share').on('click', function () {
|
|
||||||
window.open(facebook_url, '_blank', 'width=626,height=436,scrollbars=no,status=no');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.google-share').on('click', function () {
|
|
||||||
window.open(google_url, '_blank', 'width=500,height=570,scrollbars=no,status=no');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Resetting thread state
|
// Resetting thread state
|
||||||
if (thread_state.locked === '1') set_locked_state(true);
|
if (thread_state.locked === '1') set_locked_state(true);
|
||||||
if (thread_state.deleted === '1') set_delete_state(true);
|
if (thread_state.deleted === '1') set_delete_state(true);
|
||||||
@@ -333,6 +313,24 @@ define(function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#post-container').on('click', '.twitter-share', function () {
|
||||||
|
var pid = $(this).parents('li').attr('data-pid');
|
||||||
|
window.open('https://twitter.com/intent/tweet?url=' + encodeURIComponent(window.location.href + '#' + pid) + '&text=' + topic_name, '_blank', 'width=550,height=420,scrollbars=no,status=no');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#post-container').on('click', '.facebook-share', function () {
|
||||||
|
var pid = $(this).parents('li').attr('data-pid');
|
||||||
|
window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(window.location.href + '#' + pid), '_blank', 'width=626,height=436,scrollbars=no,status=no');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#post-container').on('click', '.google-share', function () {
|
||||||
|
var pid = $(this).parents('li').attr('data-pid');
|
||||||
|
window.open('https://plus.google.com/share?url=' + encodeURIComponent(window.location.href + '#' + pid), '_blank', 'width=500,height=570,scrollbars=no,status=no');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$('#post-container').delegate('.edit', 'click', function(e) {
|
$('#post-container').delegate('.edit', 'click', function(e) {
|
||||||
var pid = $(this).parents('li').attr('data-pid'),
|
var pid = $(this).parents('li').attr('data-pid'),
|
||||||
main = $(this).parents('.posts');
|
main = $(this).parents('.posts');
|
||||||
|
|||||||
@@ -534,10 +534,7 @@ var RDB = require('./redis'),
|
|||||||
'unreplied': topicData.postcount > 1,
|
'unreplied': topicData.postcount > 1,
|
||||||
'topic_id': tid,
|
'topic_id': tid,
|
||||||
'expose_tools': privileges.editable ? 1 : 0,
|
'expose_tools': privileges.editable ? 1 : 0,
|
||||||
'posts': topicPosts,
|
'posts': topicPosts
|
||||||
'twitter-intent-url': 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(nconf.get('url') + 'topic/' + topicData.slug) + '&text=' + encodeURIComponent(topicData.title),
|
|
||||||
'facebook-share-url': 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(nconf.get('url') + 'topic/' + topicData.slug),
|
|
||||||
'google-share-url': 'https://plus.google.com/share?url=' + encodeURIComponent(nconf.get('url') + 'topic/' + topicData.slug)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user