您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Animates thumbnails, inlines video loading, and cleans up sponsored content
当前为
// ==UserScript== // @name Xtube Enhancer - Animated Thumbnails, Inline Video Loading, and Sponsor/Premium-Free Videos // @description Animates thumbnails, inlines video loading, and cleans up sponsored content // @namespace xtube // @version 0.12 // @include http*://www.xtube.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/lodash-compat/3.10.1/lodash.min.js // @run-at document-end // ==/UserScript== $(document).ready(function() { $('div.advertisement').remove(); $('a.clearfix').remove(); $('li.pull-right').remove(); $('h2.h1').remove(); $('section.overviewPage>div:nth-child(5)').remove(); // Remove premium content in index. $('div.col-xs-24>ul>li').each(function() { if ($(this).find('article>a>span>span').text() === 'Premium') { $(this).remove(); } }); // Remove sponsored content in index. $('section.overviewPage>div>ul>li').each(function() { if ($(this).find('article>dl>dd>a').text() === 'xtube_sponsor') { $(this).remove(); } }); // Remove sponsored content in search results. $('section.row>div>div>ul>li').each(function() { if ($(this).find('article>dl>dd>a').text() === 'xtube_sponsor') { $(this).remove(); } }); // Remove premium content below query index. $('div.mainContent>ul>li').each(function() { if ($(this).find('article>a>span>span').text() === 'Premium' || $(this).find('article>a>div>span>span').text() === 'Premium') { $(this).remove(); } }); // Remove sponsored content beside video player. var relatedVideos = null; $('div#related_videos>div').each(function() { relatedVideos = $(this).text().split(' '); for (var i = relatedVideos.length - 1; i >= 0; i--) { if (relatedVideos[i] === '0:15') { $(this).prev().remove(); $(this).remove(); } } }); // Remove sponsored content below video player. $('div#watchPageLeft>div>div').each(function() { if ($(this).find('a>span:nth-child(3)').text() === '0:15') { $(this).remove(); } }); // Remove sponsored content in full related videos view. $('div.Card-list>article').each(function() { if ($(this).find('div>div>div:nth-child(3)').text() === '0:15') { $(this).remove(); } }); // New sponsored content formatting $('#mainSection > section > div > ul > li').each(function() { if ($(this).find('article > a:nth-child(1) > div > span.metaInfo > span.premiumLabel').text().includes('Premium')) { $(this).remove(); } }); $('#mainSection > section > div > div > ul > li').each(function() { if ($(this).find('article > a.userLink.ellipsis').text().includes('xtube_sponsor')) { $(this).remove(); } }); $('#mainSection > section > div.mainContent > ul > li').each(function() { if ($(this).find('article > a.userLink.ellipsis').text().includes('xtube_sponsor')) { $(this).remove(); } }); var cleanVidPage = function() { var spam = []; $('#related_videos > div').each(function() { if ($(this).find('a.username').text().includes('xtube_sponsor')) { $(this).prev().remove(); $(this).remove(); spam.push($(this).find('a.underline.font_b_12px').text()); } }); $('#watchPageLeft > div:nth-child(3)').children().each(function() { for (var x = 0; x < spam.length; x++) { if (spam[x] === $(this).find('a > span:nth-child(1)').text() || $(this).find('a > span:nth-child(1)').text().includes('.com')) { $(this).remove(); } } }); }; cleanVidPage(); var animateThumbnails = function(selector){ var content = $(selector); if (content.length > 0) { content.each(function(i, el) { var clone = $(el).clone(); clone.insertBefore($(el)); $(el).hide(); var animation = []; var images = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', '9.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg']; var src = $(this).attr('src').split('/'); if (_.last(src).length <= 6) { var src3 = _.without(src, _.last(src)); var imgSrc = src3.join('/') + '/'; for (var z = 0; z < images.length; z++) { animation.push(imgSrc + images[z]); } var n = -1; var animate = function() { clone.attr({ src: animation[++n] }); if (n === 14) { n = -1; } setTimeout(animate, 500); }.bind(this); animate(); } }); } }; // Animate thumbnails _.delay(function() { animateThumbnails('div.mainContent>ul>li>article>a>div>div>img'); animateThumbnails('[id*="vid_id_"]'); animateThumbnails('[id*="2_frame"]> a > img'); animateThumbnails('#related_videos > div > a > img'); animateThumbnails('#watchPageLeft > div > div > a > img'); }, 2000); var related = $('#related_videos > div > a.underline.font_b_12px'); var more = $('#watchPageLeft>div:nth-child(3)>div>a'); var inlineVids = function(opt) { if (opt.length > 0) { opt.each(function(i, el) { $(el).click(function(e) { e.preventDefault(); var vid = $('#watchPageLeft'); var pageLeftClone = $('#watchPageLeft > div:nth-child(3)').clone(); vid.empty(); $('<iframe />').attr({ 'src': $(el).attr('href'), 'frameborder': '0', 'width': window.innerWidth / 1.2, 'height': window.innerHeight }).appendTo(vid); var iframe = vid.find('iframe'); iframe.hide(); iframe.on('load', function() { iframe.contents().find('#watchPageLeft').appendTo(vid); pageLeftClone.children().appendTo('#watchPageLeft > div:nth-child(3)'); iframe.contents().find('#related_videos').children().prependTo('#related_videos'); iframe.remove(); animateWatchPageLeft(); animateRelatedVideos(); cleanVidPage(); inlineVids(related); inlineVids(more); }); }); }); } }; inlineVids(related); inlineVids(more); });