File tree Expand file tree Collapse file tree 7 files changed +14
-17
lines changed
Expand file tree Collapse file tree 7 files changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import each from 'src/utils/each.js';
77import * as fnUser from 'src/utils/user.js' ;
88import ignoreUser from 'src/utils/ignoreUser.js' ;
99import decode from 'src/utils/decode.js' ;
10- import css from 'src/utils/css.js' ;
1110import { buttonCSS , window } from 'src/utils/1.variables.js' ;
1211import Translation from 'src/structures/constants/translation' ;
1312
@@ -17,7 +16,7 @@ const setting = settings.register({
1716 page : 'Chat' ,
1817} ) ;
1918
20- style . add ( css `
19+ style . add ( `
2120 .chatContext {
2221 background-color: #F4F4F4;
2322 margin: 10px;
Original file line number Diff line number Diff line change 1- import css from 'src/utils/css.js' ;
21import style from 'src/utils/style.js' ;
32
4- style . add ( css `
3+ style . add ( `
54 #AlertToast {
65 height: 0;
76 }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import axios from 'axios';
33import { scriptVersion } from 'src/utils/1.variables.js' ;
44import style from 'src/utils/style.js' ;
55import * as menu from 'src/utils/menu.js' ;
6- import css from 'src/utils/css.js' ;
76import Translation from 'src/structures/constants/translation' ;
87
98const changelog = { } ;
@@ -17,7 +16,7 @@ const keys = {
1716} ;
1817
1918// Change log :O
20- style . add ( css `
19+ style . add ( `
2120 .us-changelog h2 {
2221 font-size: 24px;
2322 }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import wrap from 'src/utils/2.pokemon.js';
33import { noop , scriptVersion } from 'src/utils/1.variables.js' ;
44import style from 'src/utils/style.js' ;
55import { toast } from 'src/utils/2.toasts.js' ;
6- import css from 'src/utils/css.js' ;
76import Translation from 'src/structures/constants/translation' ;
87import eventManager from 'src/utils/eventManager' ;
98import * as changelog from './changelog.js' ;
@@ -33,7 +32,7 @@ wrap(function patchNotes() {
3332 installed . value ( ) === scriptVersion
3433 ) return ;
3534
36- style . add ( css `
35+ style . add ( `
3736 #AlertToast div.uschangelog span:nth-of-type(2) {
3837 max-height: 300px;
3938 overflow-y: auto;
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import debugToast from 'src/utils/debugToast';
44import { toast as Toast } from 'src/utils/2.toasts.js' ;
55import semver from 'src/utils/version.js' ;
66import { buttonCSS , scriptVersion , window } from 'src/utils/1.variables.js' ;
7- import css from 'src/utils/css.js' ;
87import createParser from 'src/utils/parser' ;
98import eventManager from 'src/utils/eventManager' ;
109import {
@@ -18,7 +17,7 @@ import Translation from 'src/structures/constants/translation';
1817
1918// Check for script updates
2019wrap ( ( ) => {
21- style . add ( css `
20+ style . add ( `
2221 #AlertToast h2,
2322 #AlertToast h3 {
2423 margin: 0;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import DialogHelper from '../DialogHelper.js';
1717
1818const defaultSetting = new RegisteredSetting ( ) ;
1919
20- style . add ( styles . split ( '\n\n' ) ) ;
20+ style . add ( styles ) ;
2121
2222/**
2323 * @type {{[key: string]: RegisteredSetting} }
Original file line number Diff line number Diff line change 11import eventManager from './eventManager.js' ;
2+ import last from './last.js' ;
23
34// Custom CSS classes are great.
45export function newStyle ( plugin = false ) {
@@ -15,17 +16,18 @@ export function newStyle(plugin = false) {
1516 } ) ;
1617
1718 function add ( ...styles ) {
18- const hasChildren = styles . length || el . children . length ;
19- if ( loaded && hasChildren ) appendStyle ( ) ;
20- else if ( ! loaded ) eventManager . once ( ':preload' , ( ) => appendStyle ( ) ) ;
19+ const hasChildren = styles . length + el . children . length ;
20+ if ( hasChildren ) {
21+ if ( loaded ) appendStyle ( ) ;
22+ else eventManager . once ( ':preload' , ( ) => appendStyle ( ) ) ;
23+ }
2124 return wrapper ( append ( styles ) ) ;
2225 }
2326
2427 function append ( styles = [ ] , nodes = [ ] ) {
2528 styles . flat ( ) . forEach ( ( s ) => {
26- const node = document . createTextNode ( s ) ;
27- nodes . push ( node ) ;
28- el . appendChild ( node ) ;
29+ el . append ( s ) ;
30+ nodes . push ( last ( el . childNodes ) ) ;
2931 } ) ;
3032 return nodes ;
3133 }
You can’t perform that action at this time.
0 commit comments