修改窗口大小

This commit is contained in:
example 2019-07-03 12:10:18 +08:00
parent 9705c0573b
commit 1ec8468267
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name 划词翻译:多词典查询 // @name 划词翻译:多词典查询
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 6.0 // @version 6.1
// @description 划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、剑桥高阶、沪江小D、谷歌翻译” // @description 划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、剑桥高阶、沪江小D、谷歌翻译”
// @author https://github.com/barrer // @author https://github.com/barrer
// @match http://*/* // @match http://*/*
@ -24,6 +24,10 @@
// Your code here... // Your code here...
/**样式*/ /**样式*/
var style = document.createElement('style'); var style = document.createElement('style');
var iconWidth = 300;
var iconHeight = 400;
var trContentWidth = iconWidth - 16; // 最终宽度 - 边距间隔
var trContentHeight = iconHeight - 31; // 最终高度 - 边距间隔
style.textContent = ` style.textContent = `
/*组件样式*/ /*组件样式*/
:host{all:unset!important} :host{all:unset!important}
@ -43,7 +47,7 @@
tr-audio{display:block;margin-bottom:5px} tr-audio{display:block;margin-bottom:5px}
tr-audio a{margin-right:1em;font-size:80%} tr-audio a{margin-right:1em;font-size:80%}
tr-audio a:last-of-type{margin-right:auto} tr-audio a:last-of-type{margin-right:auto}
tr-content{display:block;width:374px;height:374px;overflow-x:hidden;overflow-y:scroll;background:white;padding:2px 8px;margin-top:5px;box-sizing:content-box;font-family:"Helvetica Neue","Helvetica","Arial","sans-serif";font-size:13px;font-weight:normal;line-height:normal;-webkit-font-smoothing:auto;font-smoothing:auto;text-rendering:auto} tr-content{display:block;width:${trContentWidth}px;height:${trContentHeight}px;overflow-x:hidden;overflow-y:scroll;background:white;padding:2px 8px;margin-top:5px;box-sizing:content-box;font-family:"Helvetica Neue","Helvetica","Arial","sans-serif";font-size:13px;font-weight:normal;line-height:normal;-webkit-font-smoothing:auto;font-smoothing:auto;text-rendering:auto}
tr-engine~tr-engine{margin-top:1em} tr-engine~tr-engine{margin-top:1em}
tr-engine .title{color:#00c;display:inline-block;font-weight:bold} tr-engine .title{color:#00c;display:inline-block;font-weight:bold}
tr-engine .title:hover{text-decoration:none} tr-engine .title:hover{text-decoration:none}
@ -659,8 +663,8 @@
} }
/**显示内容面板*/ /**显示内容面板*/
function displayContent() { function displayContent() {
var panelWidth = 390 + 8; // icon 展开后总宽度(8:冗余距离) var panelWidth = iconWidth + 8; // icon 展开后总宽度(8:冗余距离)
var panelHeight = 405 + 8; // icon 展开后总高度(8:冗余距离) var panelHeight = iconHeight + 8; // icon 展开后总高度(8:冗余距离)
// 计算位置 // 计算位置
log('content position:', log('content position:',
'window.scrollY', window.scrollY, 'window.scrollY', window.scrollY,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 85 KiB