From 54c3a4c59b4c5ebbe75cfd62b772c97aa42c1d79 Mon Sep 17 00:00:00 2001 From: Ben Warzeski Date: Fri, 7 Apr 2023 11:02:39 -0400 Subject: [PATCH] feat: video block fb share (#32037) * feat: video block fb share * feat: video linkedin share --- lms/templates/video.html | 41 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lms/templates/video.html b/lms/templates/video.html index 75de10acda..86ac2e6509 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -61,13 +61,30 @@ from openedx.core.djangolib.js_utils import (
% endif % if public_video_url: + ${_('Share on:')} - ${_('Share on Twitter')} + ${_('Twitter')} + + + ${_('Facebook')} + + + ${_('Linkedin')} % endif @@ -146,5 +163,27 @@ from openedx.core.djangolib.js_utils import ( window.open(tweetUrl,'targetWindow','toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=400'); return false; }); + $("#facebook-share-button").click(function() { + var utmQuery = $.param({ + utm_source: 'facebook', + utm_medium: 'social', + utm_campaign: 'social-share-exp', + }); + var url = encodeURIComponent(this.href + "?" + utmQuery); + const facebookUrl = 'https://www.facebook.com/sharer/sharer.php?u' + url; + window.open(facebookUrl,'targetWindow','toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=400'); + return false; + }); + $("#linkedin-share-button").click(function() { + var utmQuery = $.param({ + utm_source: 'linkedin', + utm_medium: 'social', + utm_campaign: 'social-share-exp', + }); + var url = encodeURIComponent(this.href + "?" + utmQuery); + const linkedinUrl = 'https://www.linkedin.com/sharing/share-offsite/?url=' + url; + window.open(linkedinUrl,'targetWindow','toolbar=no,location=0,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=400'); + return false; + }); % endif