diff --git a/src/mods/ui.js b/src/mods/ui.js index 6173217..fd764e2 100644 --- a/src/mods/ui.js +++ b/src/mods/ui.js @@ -236,32 +236,23 @@ idrinth.ui = { mod.children.push ( { css: 'buttons' } ); - var closeFunc = 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'; + var makeButton = function ( text, func ) { + return { + type: 'button', + content: idrinth.text.get ( "ui.button." + text ), + attributes: [ { + name: 'onclick', + value: 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);' + func + } ] + }; + }; if ( typeof altFunc === 'string' ) { - mod.children[mod.children.length - 1].children = [ { - type: 'button', - content: idrinth.text.get ( "ui.button.ok" ), - attributes: [ { - name: 'onclick', - value: closeFunc + altFunc - } ] - }, { - type: 'button', - content: idrinth.text.get ( "ui.button.cancel" ), - attributes: [ { - name: 'onclick', - value: closeFunc - } ] - } ]; + mod.children[mod.children.length - 1].children = [ + makeButton ( 'ok', altFunc ), + makeButton ( 'cancel', '' ) + ]; } else { - mod.children[mod.children.length - 1].children = [ { - type: 'button', - content: idrinth.text.get ( "ui.button.ok" ), - attributes: [ { - name: 'onclick', - value: closeFunc - } ] - } ]; + mod.children[mod.children.length - 1].children = [ makeButton ( 'ok', '' ) ]; } idrinth.ui.body.appendChild ( idrinth.ui.buildElement ( mod ) ); }, @@ -804,7 +795,7 @@ idrinth.ui = { value: 'stylesheet' }, { name: 'href', - value: 'https://dotd.idrinth.de###PATH###/script-styles.css?###VERSION###' + value: 'https://dotd.idrinth.de/static/userscript-styles/###RELOAD-VERSION###/' } ] } ) ); build (); diff --git a/src/script-styles.css b/src/root.scss similarity index 96% rename from src/script-styles.css rename to src/root.scss index f9a39a6..c07136b 100644 --- a/src/script-styles.css +++ b/src/root.scss @@ -1,3 +1,8 @@ +@mixin simple-square($size) { + width:$size; + height:$size; +} +@import "styles/mutik.scss"; /** * These styles modify pages changed by the script of IDotD **/ @@ -26,14 +31,12 @@ .idrinth-emoticon { display: inline-block; - width: 16px; - height: 16px; + @include simple-square(16px); } .idrinth-emoticon > span { display: none; - width: 64px; - height: 64px; + @include simple-square(64px); position: absolute; } @@ -516,14 +519,12 @@ } .idrinth-central-box td.traffic > span { - width: 2em; - height: 2em; + @include simple-square(2em); display: block; } .idrinth-central-box td.traffic > span { - width: 2em; - height: 2em; + @include simple-square(2em); border-radius: 1em; display: block; overflow: hidden; @@ -563,23 +564,6 @@ width: auto; } -#DRMng_main { - margin-right: 5em; - display: block; - border-right: solid 1px #444; -} - -#DRMng_status { - float: right; - text-align: right; -} - -#DRMng_onoff { - float: left; - border-left-width: 0; - border-right: solid 1px #444; -} - td.is-os { background: #f000; background: rgba(255, 0, 0, 0.5); @@ -625,14 +609,12 @@ td.is-os { .idrinth-join-frame { position:absolute; left:0; - width:1px; - height:1px; + @include simple-square(1px); z-index:-100; } .idrinth-circle { padding:0.2em; - width:1em; - height:1em; + @include simple-square(1em); float:right; cursor:pointer; background:#000; diff --git a/src/styles/mutik.scss b/src/styles/mutik.scss new file mode 100644 index 0000000..a1671ed --- /dev/null +++ b/src/styles/mutik.scss @@ -0,0 +1,19 @@ +/** + * Adjustments to make sure mutik's new script is not broken by us +**/ +#DRMng_main { + margin-right: 5em; + display: block; + border-right: solid 1px #444; +} + +#DRMng_status { + float: right; + text-align: right; +} + +#DRMng_onoff { + float: left; + border-left-width: 0; + border-right: solid 1px #444; +} \ No newline at end of file