mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-04 08:34:07 +02:00
34 lines
875 B
JavaScript
34 lines
875 B
JavaScript
run(){
|
|
var extend = function(target, source){
|
|
for(let prop in source){
|
|
target[prop] = source[prop];
|
|
}
|
|
|
|
return target;
|
|
};
|
|
|
|
const configFile = "config.json";
|
|
|
|
$TDP.readFile(this.$token, configFile, true).then(contents => {
|
|
try{
|
|
loadConfigObject(extend(this.defaultConfig, JSON.parse(contents)));
|
|
}catch(err){
|
|
loadConfigObject(this.defaultConfig);
|
|
}
|
|
}).catch(err => {
|
|
loadConfigObject(this.defaultConfig);
|
|
});
|
|
|
|
// config handling
|
|
this.defaultConfig = {
|
|
fontSize: "12px",
|
|
avatarRadius: 10
|
|
};
|
|
|
|
var loadConfigObject = config => {
|
|
let css = window.TDPF_createCustomStyle(this);
|
|
css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+config.fontSize+" !important }");
|
|
css.insert(".avatar { border-radius: "+config.avatarRadius+"% !important }");
|
|
};
|
|
}
|