mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
no more facebook or twitter (except tweet widget, for now)
This commit is contained in:
parent
73908fc6ac
commit
a1c6e645eb
3 changed files with 1 additions and 81 deletions
|
@ -6,7 +6,6 @@
|
||||||
download
|
download
|
||||||
href="<?php echo $downloadUrl ?>"
|
href="<?php echo $downloadUrl ?>"
|
||||||
id="get-download-btn"
|
id="get-download-btn"
|
||||||
data-facebook-track="1"
|
|
||||||
data-analytics-category="Sign Up"
|
data-analytics-category="Sign Up"
|
||||||
data-analytics-action="Download"
|
data-analytics-action="Download"
|
||||||
data-analytics-label="<?php echo $analyticsLabel ?>"
|
data-analytics-label="<?php echo $analyticsLabel ?>"
|
||||||
|
|
|
@ -98,8 +98,6 @@
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
|
|
||||||
<div id="js">
|
<div id="js">
|
||||||
<script id="facebook-jssdk" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1477813539180850"></script>
|
|
||||||
<script id="twitter-oct" src="https://platform.twitter.com/oct.js"></script>
|
|
||||||
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script>
|
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script>
|
||||||
|
|
||||||
<?php foreach (Response::getJsAssets() as $src): ?>
|
<?php foreach (Response::getJsAssets() as $src): ?>
|
||||||
|
|
|
@ -1,94 +1,17 @@
|
||||||
window.lbry = {};
|
window.lbry = {};
|
||||||
|
|
||||||
jQuery.fn.extend({
|
|
||||||
jFor: function() {
|
|
||||||
var self = $(this),
|
|
||||||
target = self.data('for') || self.attr('for');
|
|
||||||
|
|
||||||
if (!target)
|
|
||||||
return $();
|
|
||||||
|
|
||||||
if (target instanceof jQuery)
|
|
||||||
return target;
|
|
||||||
|
|
||||||
return $(target.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var body = $('body');
|
var body = $('body');
|
||||||
|
|
||||||
body.on('click', 'a', onAnchorClick);
|
body.on('click', 'a', onAnchorClick);
|
||||||
|
|
||||||
if (window.twttr) {
|
|
||||||
twttr.events.bind('follow', onTwitterFollow);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.fbAsyncInit = function() {
|
|
||||||
window.FB.Event.subscribe('edge.create', onFacebookLike);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAnchorClick() {
|
function onAnchorClick() {
|
||||||
var anchor = $(this),
|
var anchor = $(this);
|
||||||
action = anchor.data('action');
|
|
||||||
|
|
||||||
if (action == 'toggle') {
|
|
||||||
anchor.jFor().toggle();
|
|
||||||
anchor.data('toggle-count', 1 + (anchor.data('toggle-count') ? anchor.data('toggle-count') : 0));
|
|
||||||
anchor.find('.toggle-even, .toggle-odd').hide();
|
|
||||||
anchor.find(anchor.data('toggle-count') % 2 == 1 ? '.toggle-odd' : '.toggle-even').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action == 'toggle-class') {
|
|
||||||
anchor.jFor().toggleClass(anchor.data('class'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchor.data('facebook-track') && window.fbq) {
|
|
||||||
fbq('track', "Lead");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchor.data('twitter-track-id') && window.twttr) {
|
|
||||||
twttr.conversion.trackPid(anchor.data('twitter-track-id'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (anchor.data('analytics-category') && anchor.data('analytics-action') && anchor.data('analytics-label') && window.ga) {
|
if (anchor.data('analytics-category') && anchor.data('analytics-action') && anchor.data('analytics-label') && window.ga) {
|
||||||
ga('send', 'event', anchor.data('analytics-category'), anchor.data('analytics-action'), anchor.data('analytics-label'));
|
ga('send', 'event', anchor.data('analytics-category'), anchor.data('analytics-action'), anchor.data('analytics-label'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeVideo(iframe) {
|
|
||||||
var maxWidth = Math.min(iframe.offsetParent().width(), iframe.data('maxWidth')),
|
|
||||||
maxHeight = iframe.data('maxHeight'),
|
|
||||||
ratio = iframe.data('aspectRatio');
|
|
||||||
|
|
||||||
if (ratio && maxWidth && maxHeight) {
|
|
||||||
var height = maxWidth * ratio,
|
|
||||||
width = maxWidth;
|
|
||||||
|
|
||||||
if (height > maxHeight) {
|
|
||||||
height = maxHeight;
|
|
||||||
width = maxHeight * 1 / ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
iframe
|
|
||||||
.width(width)
|
|
||||||
.height(width * ratio);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTwitterFollow(intentEvent) {
|
|
||||||
if (!intentEvent || !ga)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ga('send', 'social', 'Twitter', 'follow', window.location.href);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onFacebookLike() {
|
|
||||||
if (!ga)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ga('send', 'social', 'Facebook', 'like', window.location.href);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue