forked from ywzhaiqi/userscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
youku_调整显示列数.user.js
45 lines (39 loc) · 1.2 KB
/
youku_调整显示列数.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// ==UserScript==
// @name youku 调整显示列数
// @namespace https://github.com/ywzhaiqi
// @description 在 Firefox 上把优酷从2列改成3列,只适应于个人显示器尺寸。
// @include http://*.youku.com/*
// @version 2014.7.21
// @grant none
// @run-at document-start
// @noframes
// ==/UserScript==
(function(){
if (window.top != window.self) { // return in iframe
return;
}
var fn = function(){
var w = document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth
,r = 1230
,b = document.body
,classname = b.className;
if(w < r){
b.classList.add('yk-w970');
b.classList.remove('yk-w1190');
}else{
b.classList.add('yk-w1190');
b.classList.remove('yk-w970');
}
}
window.addEventListener('resize', function(){ fn(); });
function launch_ready(delayedNrTimes) {
if (!document.body && delayedNrTimes < 30) {
setTimeout(function() {
launch_ready(delayedNrTimes + 1);
}, 100);
return;
}
fn();
}
launch_ready(0);
})();