1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-14 12:15:48 +02:00

Add function to trigger video playback for plugins

This commit is contained in:
chylex 2017-10-17 13:16:19 +02:00
parent 1a8823f592
commit 110d41e393
2 changed files with 11 additions and 6 deletions
Resources/Scripts

View File

@ -928,9 +928,9 @@
// Block: Setup video player hooks.
//
(function(){
var playVideo = function(url){
window.TDGF_playVideo = function(url){
$('<div id="td-video-player-overlay" class="ovl" style="display:block"></div>').on("click contextmenu", function(){
$TD.playVideo(null);
$TD.playVideo(null, null);
}).appendTo(app);
$TD.playVideo(url);
@ -947,7 +947,7 @@
let src = !e.ctrlKey && $(this).closest(".js-media-gif-container").find("video").attr("src");
if (src){
playVideo(src);
window.TDGF_playVideo(src);
}
else{
$TD.openBrowser(getVideoTweetLink($(this)));
@ -983,7 +983,7 @@
let media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
if (media && media.isVideo && media.service === "twitter"){
playVideo(media.chooseVideoVariant().url);
window.TDGF_playVideo(media.chooseVideoVariant().url);
cancelModal = true;
}
});

View File

@ -87,14 +87,14 @@
};
//
// Block: Setup global function to change plugin state.
// Block: Setup a function to change plugin state.
//
window.TDPF_setPluginState = function(identifier, enable){
window.TD_PLUGINS.setState(window.TD_PLUGINS.findObject(identifier), enable);
};
//
// Block: Setup global function to reload the page.
// Block: Setup a function to reload the page.
//
window.TDPF_requestReload = function(){
if (!isReloading){
@ -102,4 +102,9 @@
isReloading = true;
}
};
//
// Block: Setup a function to allow plugins to play video.
//
window.TDPF_playVideo = window.TDGF_playVideo;
})();