Skip to content

Instantly share code, notes, and snippets.

@JeanSebTr
Created February 1, 2012 00:31
Show Gist options
  • Save JeanSebTr/1714199 to your computer and use it in GitHub Desktop.
Save JeanSebTr/1714199 to your computer and use it in GitHub Desktop.
Bookmarklet for viewing spam video without liking them
var a=[]
,e=document.body.parentElement
,r=[
/https?:\/\/[a-z0-9_.-]*youtube\.com[\/a-z0-9_-]*/i,
/https?:\/\/[a-z0-9_.-]*dailymotion\.com[\/a-z0-9_-]*/i,
/https?:\/\/buzztwo\.com\/videos\.php\?vid=[a-z0-9]+/i
]
,m=[
/<embed .*\/>/i
]
,h='<head><title>Video</title></head><body><ul>'
,i,u;
var _gaq = [];
_gaq.push(['_setAccount', 'UA-28836817-1']);
_gaq.push(['_setDomainName', location.hostname]);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'hackpage', location.href]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
for(i=0;i<r.length;i++)
{
u = r[i].exec(e.innerHTML);
if(u && u.length)
{
a = a.concat(u);
}
}
for(i=0;i<a.length;i++)
{
_gaq.push(['_trackEvent', 'findvideo', a[i]]);
h+='<li><a onclick="_gaq.push([\'_trackEvent\', \'playvideo\', \''+a[i]+'\']);" href="'+a[i]+'" target="_blank">'+a[i]+'</a></li>';
}
a=[];
for(i=0;i<m.length;i++)
{
u=m[i].exec(e.innerHTML);
if(u && u.length)
{
a = a.concat(u);
}
}
for(i=0;i<a.length;i++)
{
_gaq.push(['_trackEvent', 'findplayer', a[i]]);
h+='<li id="embed-'+i+'"><a href="#" onclick="_gaq.push([\'_trackEvent\', \'showplayer\', \''+escape(a[i])+'\']);document.getElementById(\'embed-'+i+'\').innerHTML=unescape(\''+escape(a[i])+'\');return false;">Lire embed '+i+'</a></li>';
}
h+='</ul></body>';
e.innerHTML=h;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment