【问题标题】:Youtube: Increase page load speed (Greasemonkey/jQuery)Youtube:提高页面加载速度(Greasemonkey/jQuery)
【发布时间】:2015-07-24 05:26:39
【问题描述】:
在速度较慢的计算机或笔记本电脑上加载 YouTube 视频页面的延迟确实很明显。诸如侧边栏、cmets、上传者图标和其他图像元素之类的东西。我的脚本将允许您单击页面的某些部分以按需加载这些元素。随意自定义。
使用:
- 火狐 33.0.3
- Greasemonkey 2.3
- 点击视频下方的标题,加载视频。
- 单击顶部标题中的任意位置会加载侧边栏、上传器图标、cmets 和标题内容。
【问题讨论】:
标签:
javascript
jquery
firefox
youtube
greasemonkey
【解决方案1】:
// ==UserScript==
// @name Youtube: Page load performace
// @namespace computerarea / twitter
// @description hide / shows elements to increase page load time
// @include https://www.youtube.com/watch?*
// @version 1
// @grant GM_addStyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// ==/UserScript==
///*Hides by defualt*///
$('#watch-discussion').hide(0);
$('#yt-masthead').hide(0);
$('.yt-user-photo.g-hovercard').hide(0);
$('#watch7-sidebar-contents').hide(0);
$('#footer-container').hide(0);
$('#player-api').hide(0);
///*Actions that change defualts*///
$("#masthead-positioner").click(function(){
$('#yt-masthead').delay(500).show(0);
$('.yt-user-photo.g-hovercard').delay(500).show(0);
$('#watch7-sidebar-contents').delay(500).show(0);
$('#footer-container').delay(500).show(0);
$('#watch-discussion').delay(500).show(0);
});
$("#eow-title").click(function(){
$('#player-api').delay(500).show(0);
});
///*DO NOT TOUCH*///
var script = unsafeWindow.document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js';
script.type = 'text/javascript';
unsafeWindow.document.getElementsByTagName("head")[0].appendChild(script);
script.addEventListener('load', function(){
jQuery = unsafeWindow['jQuery'];
unsafeWindow['$_'] = jQuery.noConflict(true);
}, false);