您需要先安装一个扩展,例如 篡改猴、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 3.0.1 // @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() { _.delay(function(){ $('div.advertisement').remove(); $('a.clearfix').remove(); $('li.pull-right').remove(); $('h2.h1').remove(); $('section.overviewPage>div:nth-child(5)').remove(); $('body > div > div.container > div > div').remove(); },500); var selectors = [ '#mainSection > section > div > ul > li', '#tabVideos > ul > li', '#mainSection > ul > li', '#mainSection > section > div.mainContent > ul > li', '#mainSection > section > div > div > ul > li', 'section.row>div>div>ul>li' ]; // v2 - Remove videos that have similar title and author strings for (var i = selectors.length - 1; i >= 0; i--) { $(selectors[i]).each(function() { try { if ($(this).find('article > a:nth-child(1) > h3').text().trim().indexOf($(this).find('article > a.userLink.ellipsis').text().trim().split('by ')[1]) !== -1) { $(this).remove(); } else { if ($(this).find('article > a:nth-child(1) > h3').text().trim().indexOf('*****') !== -1) { var titleBegin = $(this).find('article > a:nth-child(1) > h3').text().trim().split('*****')[0]; if (titleBegin === $(this).find('article > a.userLink.ellipsis').text().trim().split('by ')[1].substring(0, titleBegin.length)) { $(this).remove(); } } } if ($(this).find('article > a.userLink.ellipsis').text().includes('xtube_sponsor')) { $(this).remove(); } if ($(this).find('article > a > div > span.metaInfo > span').text().includes('Premium')) { $(this).remove(); } if ($(this).find('article>a>span>span').text() === 'Premium' || $(this).find('article>a>div>span>span').text() === 'Premium') { $(this).remove(); } if ($(this).find('article>dl>dd>a').text() === 'xtube_sponsor') { $(this).remove(); } if ($(this).find('article>a>span>span').text() === 'Premium') { $(this).remove(); } } catch (e) {} }); } $('#mainSection > div > div > section.cntPanel > article.box.contentInfo.hasButtonFooter').insertAfter('#mainSection > div > div > section.cntPanel > div.playerWrapper.videoWrapper'); $('body > div > div.container > div').remove(); var cleanVidPage = function() { $('#mainSection > div > aside > div.cntPanel').remove(); $('#mainSection > div > div > section.cntPanel > div.onderSellamPlayer').remove(); 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(); } }); // Remove footer ad. $('#mainSection > div > div > div.onderSellamPlayer').remove(); // Remove "Ads by Traffic Junky" $('#mainSection > div > div > div.expandStage > div.playerWrapper > div > div > div.header').remove(); $('body.desktopView.hasFooterAd .mainSection').css({paddingBottom: '0px'}); $('#playerWrapper > div > p').remove(); $('#playerWrapper > div > a').unwrap() }; cleanVidPage(); var animateThumbnails = function(selector){ var content = $(selector); if (content.length > 0) { try { content.each(function(i, el) { var setAnimations = function(){ var clone = $(el).clone(); clone.insertBefore($(el)); $(el).hide(); var animation = []; var images; var _src = $(this).attr('src'); var src = _src.split('/'); var isSearch = _src.indexOf('0011') !== -1; if (_.last(src).length <= 6 || isSearch) { var imgSrc; if (isSearch) { images = ['00.jpg', '01.jpg', '02.jpg', '03.jpg', '04.jpg', '05.jpg', '06.jpg', '07.jpg', '08.jpg', '09.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg']; imgSrc = _src.split('0011')[0] + '00'; } else { 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 src3 = _.without(src, _.last(src)); 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(); } }.bind(this); if (selector === '#tabMorefromthisuser > ul > li > article > a > div > div > img') { $(el).parent().on('mouseenter', function(e){ setAnimations(); }.bind(this)); } else { setAnimations(); } }); } catch (e) {} } }; // Animate thumbnails _.delay(function() { animateThumbnails('#mainSection > section > div > ul > li > article > a > div > div > img'); animateThumbnails('#mainSection > ul > li > article > a > div > div > img'); animateThumbnails('#tabVideos > ul > li > article > a > div > div > img'); animateThumbnails('#mainSection > section > div > ul > li > article > a > div > div > img'); animateThumbnails('div.mainContent>ul>li>article>a>div>div>img'); animateThumbnails('[id*="vid_id_"]'); animateThumbnails('[id*="2_frame"]> a > img'); animateThumbnails('#tabMorefromthisuser > ul > li > article > a > div > div > img'); animateThumbnails('#mainSection > div > div > div > ul > li > article > a > div > div > img'); animateThumbnails('#contentVideos > div > div > ul > li > article > a > div > div.imageWrapper.video > img'); animateThumbnails('#tabVideos > div > ul > li > article > a > div > div.imageWrapper.video > img'); animateThumbnails('#contentActivities > div > div > ul > li > article > a > img'); // Order each page by best score var __videos = []; var orderByScore = function(selector1, selector2){ $(selector1).each(function(i, el){ var score = parseInt($(el).find('article > a:nth-child(1) > div > span.metaInfo > span').text().trim().split('%')[0]); __videos.push({ score: isNaN(score) ? 0 : score, el: el }); $(el).remove(); }); __videos = _.chain(__videos).sortBy('score').uniq().value().reverse(); $(selector2).each(function(el){ $(el).remove(); }); _.each(__videos, function(vid){ $(selector2).eq(0).append($(vid.el)); }); }; var scoreArchiveSelectors = [ ['#mainSection > section > div > ul > li', '#mainSection > section > div > ul'], ['#mainSection > section > div.mainContent > ul > li', '#mainSection > section > div.mainContent > ul'], ['#mainSection > section > div > div > ul > li', '#mainSection > section > div > div > ul'], ['#tabVideos > div > ul > li', '#tabVideos > div > ul'], ['#tabVideos > ul > li', '#tabVideos > ul'], ['#mainSection > ul > li', '#mainSection > ul'] ]; for (var z = scoreArchiveSelectors.length - 1; z >= 0; z--) { orderByScore(scoreArchiveSelectors[z][0], scoreArchiveSelectors[z][1]); } }, 1800); $('#mainSection > div > aside > div > menu > ul > li:nth-child(2) > a').on('click', function(){ animateThumbnails('#tabRelatedVideos > ul > li > article > a > div > div > img'); }); });