Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Was Hรถrt Ihr Gerade Lagfrei
- // @namespace spongeforum
- // @include http://spongeforum.de/spieleforum/38-*
- // @include http://spongeforum.de/*form=PostAdd*&threadID=38*
- // @grant GM_xmlhttpRequest
- // ==/UserScript==
- function loadTitle(e, videoId)
- {
- requestURL = "http://gdata.youtube.com/feeds/api/videos/" + videoId;
- //if (text == null)
- GM_xmlhttpRequest({
- method: "GET",
- url: requestURL,
- onload: function(content) {
- var t = content.responseText;
- var title = t.match(/<title.*?>(.*?)<\/title>/);
- e.innerHTML = title != null ? title[1] : 'Zu wenig Mehl';
- }
- });
- }
- document.addEventListener('DOMContentLoaded',function(e){
- var videos = document.querySelectorAll('iframe.youtube-player');
- for (var i = 0; i < videos.length; ++i) {
- var index = videos[i].id;
- var url = videos[i].src;
- var videoId = url.substring(url.lastIndexOf('/')+1, url.indexOf('?'));
- var n = videos[i].parentNode;
- n.id = 'yt_' + videoId;
- n.style.display = 'none';
- var title = n.parentNode.firstChild.nextSibling; //.container-3
- title = title.firstChild.nextSibling.nextSibling.nextSibling; //.container-content
- title = title.firstChild.nextSibling.nextSibling.nextSibling.firstChild; //a
- title.video = n;
- title.onclick = function(e) {
- var v = e.target.video;
- if (v == null)
- return true;
- v.style.display = v.style.display == 'none' ? 'block' : 'none';
- return false;
- };
- loadTitle(title, videoId);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement