Themeloader
This commit is contained in:
parent
02379bd5d2
commit
c369887d2b
7
splice
7
splice
|
@ -4,7 +4,6 @@
|
|||
|
||||
mainWindow.webContents.on('dom-ready', function() {
|
||||
var fs = require('fs');
|
||||
|
||||
if(!fs.existsSync(_dataPath)) {
|
||||
console.log('BetterDiscord: Creating BD Dir');
|
||||
fs.mkdirSync(_dataPath);
|
||||
|
@ -56,13 +55,15 @@
|
|||
var themeVar = meta.substring(meta.lastIndexOf('//META')+6, meta.lastIndexOf('*//'));
|
||||
var parse = JSON.parse(themeVar);
|
||||
var themeName = parse['name'];
|
||||
var themeAuthor = parse['author'];
|
||||
var themeDescription = parse['description'];
|
||||
var themeVersion = parse['version'];
|
||||
console.log('BetterDiscord: Loading Theme: ' + themeName);
|
||||
split.splice(0, 1);
|
||||
theme = split.join('\n');
|
||||
theme = theme.replace(/(\r\n|\n|\r)/gm,'');
|
||||
theme = theme.replace(/\s/g, '');
|
||||
mainWindow.webContents.executeJavaScript('var theme' + themeName + ' = "' + escape(theme) + '";');
|
||||
mainWindow.webContents.executeJavaScript('(function() { bdthemes[theme'+themeName+'] = false })();');
|
||||
mainWindow.webContents.executeJavaScript('(function() { bdthemes["'+themeName+'"] = { "enabled": false, "css": "'+escape(theme)+'", "description": "'+themeDescription+'", "author":"'+themeAuthor+'", "version":"'+themeVersion+'" } })();');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue