forked from leftypol/leftypol
Merge pull request 'Add user option for custom YouTube embed proxy' (#53) from youtube-embed-proxy-options into config
This commit is contained in:
commit
337114433f
|
@ -22,13 +22,31 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
// Adds Options panel item
|
||||
if (typeof localStorage.youtube_embed_proxy === 'undefined') {
|
||||
if (location.hostname.includes(".onion")){
|
||||
localStorage.youtube_embed_proxy = 'tuberyps2pn6dor6h47brof3w2asmauahhk4ei42krugybzzzo55klad.onion';
|
||||
} else {
|
||||
localStorage.youtube_embed_proxy = 'incogtube.com'; //default value
|
||||
}
|
||||
}
|
||||
|
||||
if (window.Options && Options.get_tab('general')) {
|
||||
Options.extend_tab("general", "<fieldset id='media-proxy-fs'><legend>"+_("Media Proxy (requires refresh)")+"</legend>"
|
||||
+ ('<label id="youtube-embed-proxy-url">' + _('YouTube embed proxy url ')+'<input type="text" size=30></label>')
|
||||
+ '</fieldset>');
|
||||
|
||||
$('#youtube-embed-proxy-url>input').val(localStorage.youtube_embed_proxy);
|
||||
$('#youtube-embed-proxy-url>input').on('input', function() {
|
||||
localStorage.youtube_embed_proxy = $('#youtube-embed-proxy-url>input').val();
|
||||
});
|
||||
}
|
||||
|
||||
const ON = "[Remove]";
|
||||
const OFF = "[Embed]";
|
||||
const YOUTUBE = 'www.youtube.com';
|
||||
const ONION = 'tuberyps2pn6dor6h47brof3w2asmauahhk4ei42krugybzzzo55klad.onion';
|
||||
const PROXY = 'incogtube.com'
|
||||
const YOUTUBE = 'www.youtube.com';
|
||||
const PROXY = localStorage.youtube_embed_proxy;
|
||||
function addEmbedButton(index, videoNode) {
|
||||
videoNode = $(videoNode);
|
||||
var contents = videoNode.contents();
|
||||
|
@ -41,7 +59,7 @@ $(document).ready(function(){
|
|||
'width="360" height="270" src="//' + embedHost + '/embed/' + videoId +
|
||||
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
||||
}
|
||||
var defaultEmbed = makeEmbedNode(location.hostname.includes("onion") ? ONION : YOUTUBE);
|
||||
var defaultEmbed = makeEmbedNode(location.hostname.includes(".onion") ? PROXY : YOUTUBE);
|
||||
var proxyEmbed = makeEmbedNode(PROXY);
|
||||
videoNode.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue
Block a user