您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Animates thumbnails and cleans up sponsored content
当前为
// ==UserScript== // @name Xtube Enhancer - Animated Thumbnails and Sponsor/Premium-Free Videos // @description Animates thumbnails and cleans up sponsored content // @namespace xtube // @version 0.7 // @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 > 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(); } }); // Animate thumbnails _.delay(function(){ var mainContent = $('div.mainContent>ul>li>article>a>div>div>img'); if (mainContent.length > 0) { mainContent.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(); } }); } var relatedVideos = $('#related_videos > div > a > img'); if (relatedVideos.length > 0) { relatedVideos.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(); } }); } var watchPageLeft = $('#watchPageLeft > div > div > a > img'); if (watchPageLeft.length > 0) { watchPageLeft.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(); } }); } var userPage = $('[id*="vid_id_"]'); if (userPage.length > 0) { userPage.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(); } }); } var userFavorites = $('[id*="2_frame"]> a > img'); if (userFavorites.length > 0) { userFavorites.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(); } }); } },4000); });