forked from leftypol/leftypol
Add option for custom YouTube embed proxy
This commit is contained in:
parent
67232c5c41
commit
59e614a8f0
|
@ -22,13 +22,31 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(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 ON = "[Remove]";
|
||||||
const OFF = "[Embed]";
|
const OFF = "[Embed]";
|
||||||
const YOUTUBE = 'www.youtube.com';
|
const YOUTUBE = 'www.youtube.com';
|
||||||
const ONION = 'tuberyps2pn6dor6h47brof3w2asmauahhk4ei42krugybzzzo55klad.onion';
|
const PROXY = localStorage.youtube_embed_proxy;
|
||||||
const PROXY = 'incogtube.com'
|
|
||||||
function addEmbedButton(index, videoNode) {
|
function addEmbedButton(index, videoNode) {
|
||||||
videoNode = $(videoNode);
|
videoNode = $(videoNode);
|
||||||
var contents = videoNode.contents();
|
var contents = videoNode.contents();
|
||||||
|
@ -41,7 +59,7 @@ $(document).ready(function(){
|
||||||
'width="360" height="270" src="//' + embedHost + '/embed/' + videoId +
|
'width="360" height="270" src="//' + embedHost + '/embed/' + videoId +
|
||||||
'?autoplay=1&html5=1" allowfullscreen frameborder="0"/>');
|
'?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);
|
var proxyEmbed = makeEmbedNode(PROXY);
|
||||||
videoNode.click(function(e) {
|
videoNode.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user