自动根据浏览器宽度调整网页文字,相当于文字重排。
// ==UserScript==
// @name 自动调整网页宽度
// @namespace http://tampermonkey.dianzishu.online
// @version 0.0.1
// @description 自动根据浏览器宽度调整网页文字,相当于文字重排。
// @copyright kongfu
// @match *://*
// @grant none
// @license MIT
// ==/UserScript==
//获取当前网页地址
(function() {
'use strict';
(function(){function t(f){var a=d.createNodeIterator(d,1,f,false);while(a.nextNode()){}}var d=document;t(function(e){var x=e.offsetLeft;var l=e.offsetParent;while(l!=null){x+=l.offsetLeft;l=l.offsetParent}var w=d.documentElement.clientWidth-x;var s=e.style;if(s.marginLeft)w-=s.marginLeft;if(s.marginRight)w-=s.marginRight;if(s.paddingLeft)w-=s.paddingLeft;if(s.paddingRight)w-=s.paddingRight;if(s.borderSize)w-=s.borderSize;w-=d.defaultView.innerWidth-d.documentElement.offsetWidth;if(e.tagName=='IMG'){var h=e.clientHeight*w/e.clientWidth;s.maxHeight=h}s.maxWidth=w+'px'})})();
})();