User:KurwaAntics/common.js: Difference between revisions
From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
KurwaAntics (talk | contribs) No edit summary |
KurwaAntics (talk | contribs) No edit summary |
||
Line 7: | Line 7: | ||
return false; | return false; | ||
} else { | } else { | ||
var url = $(this).attr('href'); | var url = $(this).attr('href'); | ||
var id = url.substring(url.indexOf(".be/") + 4, url.indexOf("?")); | var id = url.substring(url.indexOf(".be/") + 4, url.indexOf("?")); | ||
if(your_string.indexOf('?') === -1) | |||
{ | |||
var cond = "&" + url.substring(url.indexOf("?") + 1); | |||
} | |||
$('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>'); | $('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>'); | ||
$('.close-modal').on('click', function() { | $('.close-modal').on('click', function() { | ||
Line 30: | Line 20: | ||
}); | }); | ||
return false; | return false; | ||
} | } | ||
}); | }); | ||
Line 40: | Line 29: | ||
var url = $(this).attr('href'); | var url = $(this).attr('href'); | ||
var id = url.substring(url.indexOf("v=") + 2, url.indexOf("&")); | var id = url.substring(url.indexOf("v=") + 2, url.indexOf("&")); | ||
if(your_string.indexOf('&') === -1) | |||
{ | |||
var cond = url.substring(url.indexOf("&")); | |||
} | |||
$('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>'); | $('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>'); | ||
$('.close-modal').on('click', function() { | $('.close-modal').on('click', function() { |
Revision as of 20:51, March 27, 2016
if( window.location.href.indexOf('T:') > -1) window.location.href = window.location.href.replace('T:','Template:');
if( window.location.href.indexOf('Css') > -1) window.location.href = window.location.href.replace('Css','User:UntergangerPlus/vector.css');
if( window.location.href.indexOf('Js') > -1) window.location.href = window.location.href.replace('Js','User:UntergangerPlus/common.js');
$('a[href*="youtu.be/"]').on('click', function(){
if ($(".greyout")[0]){
return false;
} else {
var url = $(this).attr('href');
var id = url.substring(url.indexOf(".be/") + 4, url.indexOf("?"));
if(your_string.indexOf('?') === -1)
{
var cond = "&" + url.substring(url.indexOf("?") + 1);
}
$('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>');
$('.close-modal').on('click', function() {
$(".greyout, .mymodal").remove();
});
return false;
}
});
$('a[href*="youtube.com/watch"]').on('click', function(){
if ($(".greyout")[0]){
return false;
} else {
var url = $(this).attr('href');
var id = url.substring(url.indexOf("v=") + 2, url.indexOf("&"));
if(your_string.indexOf('&') === -1)
{
var cond = url.substring(url.indexOf("&"));
}
$('body').prepend('<div class="greyout"><span class="close-modal">✕</span></div><div class="mymodal" style="width: 800px; height: 450px;"><iframe style="width:100%; height:100%" src="http://www.youtube.com/embed/' + id + '?autoplay=1' + cond + '"></iframe></div>');
$('.close-modal').on('click', function() {
$(".greyout, .mymodal").remove();
});
return false;
}
});