File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
2- "name" : " my-sv " ,
2+ "name" : " tampermonkey-emoji-commit-github " ,
33 "private" : true ,
44 "version" : " 0.0.0" ,
55 "type" : " module" ,
Original file line number Diff line number Diff line change 11import App from './App.svelte' ;
2- import tailwindBase from './assets/tailwind.css' ;
2+ import tailwindBase from './assets/tailwind.css?inline ' ;
33// 创建顶层 document 环境的 dom 节点
44function createContainerInDocument ( ) {
55 const container = document . createElement ( 'div' ) ;
6- container . id = 'tempermonkey -app' ;
6+ container . id = 'tampermonkey -app' ;
77 container . style . zIndex = "2147483647" ;
88 container . style . position = "fixed" ;
99 return container ;
1010}
11- // 创建 shadowRoot 环境下的 container 节点(用于挂在 Vue 示例)
11+ // 创建 shadowRoot 环境下的 container 节点(用于挂载 Svelte 示例)
1212function containerInShadowRoot ( ) {
1313 const container = document . createElement ( 'div' ) ;
14- container . id = 'tempermonkey -app-shadow-container' ;
14+ container . id = 'tampermonkey -app-in -shadow-container' ;
1515 return container ;
1616}
1717function createDom ( ) {
@@ -23,6 +23,7 @@ function createDom() {
2323 return containerInShadow ;
2424}
2525function copyCssFromMainDocument ( container ) {
26+ // // 将 main document 中的 css 拷贝到 shadow document 中
2627 // [...document.querySelectorAll('style')].map((i)=>i.cloneNode(true)).forEach((i)=>container.appendChild(i));
2728 // [...document.querySelectorAll('link')].map(i=>i.cloneNode(true)).forEach(i=>container.appendChild(i));
2829 const styleDom = document . createElement ( 'style' ) ;
You can’t perform that action at this time.
0 commit comments