解决 host 节点样式继承问题

This commit is contained in:
example 2019-03-22 19:43:10 +08:00
parent f96071c966
commit e6a29fbd56
4 changed files with 6 additions and 4 deletions

View File

@ -1,13 +1,13 @@
// ==UserScript== // ==UserScript==
// @name 划词翻译:多词典查询 // @name 划词翻译:多词典查询
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 3.5 // @version 3.6
// @description 划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、剑桥高阶、沪江小D、谷歌翻译” // @description 划词翻译调用“有道词典有道翻译、金山词霸、Bing 词典必应词典、剑桥高阶、沪江小D、谷歌翻译”
// @author https://github.com/barrer // @author https://github.com/barrer
// @match http://*/* // @match http://*/*
// @include https://*/* // @include https://*/*
// @include file:///* // @include file:///*
// @run-at document-end // @run-at document-start
// @connect youdao.com // @connect youdao.com
// @connect iciba.com // @connect iciba.com
// @connect translate.google.cn // @connect translate.google.cn
@ -26,6 +26,7 @@
var style = document.createElement('style'); var style = document.createElement('style');
style.textContent = ` style.textContent = `
/*组件样式*/ /*组件样式*/
:host{all:initial!important}
*{word-wrap:break-word!important;word-break:break-word!important} *{word-wrap:break-word!important;word-break:break-word!important}
a{color:#36f;text-decoration:none;cursor:pointer} a{color:#36f;text-decoration:none;cursor:pointer}
a:hover{text-decoration:underline} a:hover{text-decoration:underline}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -1,13 +1,13 @@
// ==UserScript== // ==UserScript==
// @name Translate // @name Translate
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 4.9 // @version 5.0
// @description 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译、Google Search、Bing Search必应搜索、百度搜索、Wikipedia Search维基百科搜索”网页翻译 // @description 划词翻译调用“金山词霸、有道词典有道翻译、Google Translate谷歌翻译、沪江小D、搜狗翻译、必应词典必应翻译、Microsoft Translator必应在线翻译、海词词典、百度翻译、Oxford Learner's Dictionaries、Oxford Dictionaries、Merriam-Webster、汉典、PDF 划词翻译、Google Search、Bing Search必应搜索、百度搜索、Wikipedia Search维基百科搜索”网页翻译
// @author https://github.com/barrer // @author https://github.com/barrer
// @match http://*/* // @match http://*/*
// @include https://*/* // @include https://*/*
// @include file:///* // @include file:///*
// @run-at document-end // @run-at document-start
// @grant GM_setValue // @grant GM_setValue
// @grant GM_getValue // @grant GM_getValue
// @grant GM_deleteValue // @grant GM_deleteValue
@ -20,6 +20,7 @@
/**样式*/ /**样式*/
var style = document.createElement('style'); var style = document.createElement('style');
style.textContent = ` style.textContent = `
:host{all:initial!important}
*{word-wrap:break-word!important} *{word-wrap:break-word!important}
img{cursor:pointer;display:inline-block;width:16px;height:16px;border:1px solid #dfe1e5;background-color:rgba(255,255,255,1);padding:2px;margin:0;margin-right:5px;box-sizing:content-box;vertical-align:middle} img{cursor:pointer;display:inline-block;width:16px;height:16px;border:1px solid #dfe1e5;background-color:rgba(255,255,255,1);padding:2px;margin:0;margin-right:5px;box-sizing:content-box;vertical-align:middle}
img:last-of-type{margin-right:auto} img:last-of-type{margin-right:auto}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB