mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-20 03:15:47 +02:00
Add function to trigger video playback for plugins
This commit is contained in:
parent
1a8823f592
commit
110d41e393
Resources/Scripts
@ -928,9 +928,9 @@
|
|||||||
// Block: Setup video player hooks.
|
// Block: Setup video player hooks.
|
||||||
//
|
//
|
||||||
(function(){
|
(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(){
|
$('<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);
|
}).appendTo(app);
|
||||||
|
|
||||||
$TD.playVideo(url);
|
$TD.playVideo(url);
|
||||||
@ -947,7 +947,7 @@
|
|||||||
let src = !e.ctrlKey && $(this).closest(".js-media-gif-container").find("video").attr("src");
|
let src = !e.ctrlKey && $(this).closest(".js-media-gif-container").find("video").attr("src");
|
||||||
|
|
||||||
if (src){
|
if (src){
|
||||||
playVideo(src);
|
window.TDGF_playVideo(src);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$TD.openBrowser(getVideoTweetLink($(this)));
|
$TD.openBrowser(getVideoTweetLink($(this)));
|
||||||
@ -983,7 +983,7 @@
|
|||||||
let media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
let media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
||||||
|
|
||||||
if (media && media.isVideo && media.service === "twitter"){
|
if (media && media.isVideo && media.service === "twitter"){
|
||||||
playVideo(media.chooseVideoVariant().url);
|
window.TDGF_playVideo(media.chooseVideoVariant().url);
|
||||||
cancelModal = true;
|
cancelModal = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -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.TDPF_setPluginState = function(identifier, enable){
|
||||||
window.TD_PLUGINS.setState(window.TD_PLUGINS.findObject(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(){
|
window.TDPF_requestReload = function(){
|
||||||
if (!isReloading){
|
if (!isReloading){
|
||||||
@ -102,4 +102,9 @@
|
|||||||
isReloading = true;
|
isReloading = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Setup a function to allow plugins to play video.
|
||||||
|
//
|
||||||
|
window.TDPF_playVideo = window.TDGF_playVideo;
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user