VozResponsive

Help You Surf VozForums in limited-width window

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name VozResponsive
// @description Help You Surf VozForums in limited-width window
// @grant none
// @include *://*vozforums.com/showthread.php?t=*
// @version 0.0.1.20150827132010
// @namespace https://greasyfork.org/users/14513
// ==/UserScript==

posts = [].slice.call(document.querySelectorAll('[id^=post_message_]'));
bg = [].slice.call(document.querySelectorAll('table[id^=post]'));
function changeWidth(e,size){
	e.style.width = size;
	e.style.marginLeft = "0px";
}
function recalc(){
bg.forEach(function(b){
	changeWidth(b,"95vw");
});
posts.forEach(function(post,index,array){
	changeWidth(post,"88vw");
	//sig
	sigComment = post.nextSibling.nextSibling.nextSibling.nextSibling;
	//sig for first post
	if(index == 0){
	sigComment = sigComment.nextSibling.nextSibling.nextSibling.nextSibling;
	}
	if(sigComment.data ==  " sig "){
		sigNode = sigComment.nextElementSibling;
		changeWidth(sigNode,"88vw");
	}
});
}
//For Chrome,Safari
window.addEventListener("resize",recalc);
//onload
recalc();