feat: add public video url copy interface (#32293)
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
}
|
||||
|
||||
_.bindAll(this, 'clickHandler');
|
||||
_.bindAll(this, 'copyHandler');
|
||||
_.bindAll(this, 'hideHandler');
|
||||
_.bindAll(this, 'showHandler');
|
||||
|
||||
this.container = element;
|
||||
|
||||
@@ -35,10 +38,19 @@
|
||||
// Initializes the module.
|
||||
initialize: function() {
|
||||
this.el = this.container.find('.wrapper-social-share');
|
||||
this.el.on('click', '.btn-link', this.clickHandler);
|
||||
this.baseVideoUrl = this.el.data('url');
|
||||
this.course_id = this.container.data('courseId');
|
||||
this.block_id = this.container.data('blockId');
|
||||
this.el.on('click', '.social-share-link', this.clickHandler);
|
||||
|
||||
this.closeBtn = this.el.find('.close-btn');
|
||||
this.toggleBtn = this.el.find('.social-toggle-btn');
|
||||
this.copyBtn = this.el.find('.public-video-copy-btn');
|
||||
this.shareContainer = this.el.find('.container-social-share');
|
||||
this.closeBtn.on('click', this.hideHandler);
|
||||
this.toggleBtn.on('click', this.showHandler);
|
||||
this.copyBtn.on('click', this.copyHandler);
|
||||
|
||||
},
|
||||
|
||||
// Fire an analytics event on share button click.
|
||||
@@ -48,6 +60,20 @@
|
||||
self.sendAnalyticsEvent(source);
|
||||
},
|
||||
|
||||
hideHandler: function(event) {
|
||||
this.shareContainer.hide();
|
||||
this.toggleBtn.show();
|
||||
},
|
||||
|
||||
showHandler: function(event) {
|
||||
this.shareContainer.show();
|
||||
this.toggleBtn.hide();
|
||||
},
|
||||
|
||||
copyHandler: function(event) {
|
||||
navigator.clipboard.writeText(this.copyBtn.data('url'));
|
||||
},
|
||||
|
||||
// Send an analytics event for share button tracking.
|
||||
sendAnalyticsEvent: function(source) {
|
||||
window.analytics.track(
|
||||
|
||||
Reference in New Issue
Block a user