我正在为Wordpress开发一个插件,以启用blockquotes中的社交共享按钮(在社交网络Twitter和Facebook上共享引用的文本)。因此,网站将如下所示:
以下是当前的js:
jQuery(document).ready(function () {
var blockquotes = jQuery(\'blockquote\');
for (var i = 0; i < blockquotes.length; i++) {
var blockQuoteText = jQuery(blockquotes[i]).text();
var currentUrl = window.location;
var textColor = jQuery(blockquotes[i]).css(\'color\');
// add share buttons (change TwitterName to your Twitter handle for automatic mentions)
// change paths to the icons to suit your installation (download link below)
jQuery(blockquotes[i]).append(\'<div class="quote-share"><div class="wrapper">\' +
\'<a class="quote-twitter pop-up" style="color:\' + textColor + \'"\' +
\'href="http://twitter.com/intent/tweet?status=\' + blockQuoteText + \'+\' + currentUrl + \'+%40\' + data.twitter_id + \'">\' +
\'<span class="icon-twitter"/></a>\' +
\'<a class="quote-facebook pop-up" style="color:\' + textColor + \'"\' +
\'href="https://www.facebook.com/sharer/sharer.php?u=\' + currentUrl + \'&src=sdkpreparse&title=\' + blockQuoteText + \'">\' +
\'<span class="icon-facebook"/>\' +
\'</a></div></div>\');
}
// pop-up without being blocked by pop-up blockers
jQuery(\'a.pop-up\').live(\'click\', function () {
newwindow = window.open(jQuery(this).attr(\'href\'), \'\', \'height=640,width=600\');
if (window.focus) {
newwindow.focus()
}
return false;
});
});
但后来我发现了Facebook的Quote插件:
https://developers.facebook.com/docs/plugins/quote这将是完美的,但我不知道如何将插件脚本附加到图标,而不是他们通过突出显示文本来启用它的方式。有谁能帮我把Facebook新的“Quote”共享功能附加到一个按钮上,然后在blockquote中共享文本?