-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
321 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules/ | ||
.vscode/ | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
* Star problems | ||
*/ | ||
|
||
import * as AV from 'leancloud-storage'; | ||
|
||
/** | ||
* Provides data storage | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,67 @@ | ||
import ConfigWindow from '../utils/config'; | ||
import ControlCSS from '../utils/ccss'; | ||
|
||
import html from '../utils/html'; | ||
import style from './style.useable.scss'; | ||
|
||
|
||
const languages = { | ||
'zh_CN': { | ||
'bgi': '背景图片', | ||
'opc': '卡片透明度', | ||
'thm': '使用特色主题' | ||
} | ||
} | ||
|
||
const language = languages.zh_CN; | ||
|
||
const configs = []; | ||
|
||
configs.push({ | ||
'key': 'Background Image URL' | ||
, 'type': 'text' | ||
, 'value': 'https://gallery.swwind.me/2018-12/15.jpg' | ||
'key': language.bgi, | ||
'type': 'text', | ||
'value': 'https://gallery.swwind.me/2018-08/12.jpg' | ||
}); | ||
configs.push({ | ||
'key': 'Use Custom Theme' | ||
, 'type': 'checkbox' | ||
, 'value': true | ||
'key': language.thm, | ||
'type': 'checkbox', | ||
'value': true | ||
}); | ||
configs.push({ | ||
'key': language.opc, | ||
'type': 'number', | ||
'value': 0.75 | ||
}); | ||
|
||
const ccss = new ControlCSS(new Map()); | ||
|
||
new ConfigWindow(configs, (e) => { | ||
console.log(e); | ||
const configWindow = new ConfigWindow(configs, (data) => { | ||
if (data.get(language.thm)) { | ||
style.use(); | ||
} else { | ||
style.unuse(); | ||
} | ||
ccss.set('--lg-wallpaper', `url(${<string> data.get(language.bgi)})`); | ||
const opacity = <number> data.get(language.opc); | ||
ccss.set('--lg-opacity', opacity.toString()); | ||
}); | ||
|
||
export default () => { | ||
const a = html('a.icon-btn.color-none'); | ||
const i = html('i.fas.fa-cog'); | ||
a.appendChild(i); | ||
a.addEventListener('click', () => { | ||
configWindow.show(); | ||
}); | ||
|
||
const call = () => { | ||
const nav = document.querySelector('.user-nav'); | ||
if (nav) { | ||
const as = nav.querySelectorAll('a.icon-btn'); | ||
nav.insertBefore(a, as[1].nextElementSibling); | ||
} else { | ||
setTimeout(call, 500); | ||
} | ||
} | ||
setTimeout(call, 500); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import html from './html'; | ||
|
||
/** | ||
* Dynamic control your css global variables | ||
*/ | ||
export default class ControlCSS { | ||
map: Map<string, string>; | ||
|
||
style: HTMLStyleElement; | ||
|
||
constructor (map: Map<string, string>) { | ||
this.map = map; | ||
this.style = <HTMLStyleElement> html('style'); | ||
document.addEventListener('DOMContentLoaded', () => { | ||
document.head.appendChild(this.style); | ||
}); | ||
this.flush(); | ||
} | ||
|
||
flush () { | ||
const v = Array.from(this.map).map((a) => a.join(':')) | ||
.join(';'); | ||
this.style.innerHTML = `:root{${v}}`; | ||
} | ||
|
||
set (type: string, value: string) { | ||
this.map.set(type, value); | ||
this.flush(); | ||
} | ||
} | ||
|
Oops, something went wrong.