fix transparency
This commit is contained in:
parent
505e0187f6
commit
dbcf2f9cef
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,19 +11,7 @@ const BdApi = {
|
||||||
get React() { return BDV2.React; },
|
get React() { return BDV2.React; },
|
||||||
get ReactDOM() { return BDV2.ReactDom; },
|
get ReactDOM() { return BDV2.ReactDom; },
|
||||||
get ReactComponent() {return BDV2.ReactComponent;},
|
get ReactComponent() {return BDV2.ReactComponent;},
|
||||||
get WindowConfigFile() {
|
get WindowConfigFile() {return Utils.WindowConfigFile;},
|
||||||
if (this._windowConfigFile) return this._windowConfigFile;
|
|
||||||
const electron = require("electron").remote.app;
|
|
||||||
const path = require("path");
|
|
||||||
const base = electron.getAppPath();
|
|
||||||
const roamingBase = electron.getPath("userData");
|
|
||||||
const roamingLocation = path.resolve(roamingBase, electron.getVersion(), "modules", "discord_desktop_core", "injector", "config.json");
|
|
||||||
const location = path.resolve(base, "..", "app", "config.json");
|
|
||||||
const fs = require("fs");
|
|
||||||
const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;
|
|
||||||
if (!realLocation) return this._windowConfigFile = null;
|
|
||||||
return this._windowConfigFile = realLocation;
|
|
||||||
},
|
|
||||||
get settings() {return settings;},
|
get settings() {return settings;},
|
||||||
get emotes() {return bdEmotes;},
|
get emotes() {return bdEmotes;},
|
||||||
get screenWidth() { return Math.max(document.documentElement.clientWidth, window.innerWidth || 0); },
|
get screenWidth() { return Math.max(document.documentElement.clientWidth, window.innerWidth || 0); },
|
||||||
|
@ -31,22 +19,15 @@ const BdApi = {
|
||||||
};
|
};
|
||||||
|
|
||||||
BdApi.getAllWindowPreferences = function() {
|
BdApi.getAllWindowPreferences = function() {
|
||||||
if (!this.WindowConfigFile) return {}; // Tempfix until new injection on other platforms
|
return Utils.getAllWindowPreferences();
|
||||||
return __non_webpack_require__(this.WindowConfigFile);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BdApi.getWindowPreference = function(key) {
|
BdApi.getWindowPreference = function(key) {
|
||||||
if (!this.WindowConfigFile) return undefined; // Tempfix until new injection on other platforms
|
return Utils.getWindowPreference(key);
|
||||||
return this.getAllWindowPreferences()[key];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BdApi.setWindowPreference = function(key, value) {
|
BdApi.setWindowPreference = function(key, value) {
|
||||||
if (!this.WindowConfigFile) return; // Tempfix until new injection on other platforms
|
return Utils.setWindowPreference(key, value);
|
||||||
const fs = require("fs");
|
|
||||||
const prefs = this.getAllWindowPreferences();
|
|
||||||
prefs[key] = value;
|
|
||||||
delete __non_webpack_require__.cache[this.WindowConfigFile];
|
|
||||||
fs.writeFileSync(this.WindowConfigFile, JSON.stringify(prefs, null, 4));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Inject CSS to document head
|
//Inject CSS to document head
|
||||||
|
|
|
@ -170,9 +170,9 @@ export default new class V2_SettingsPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == "fork-wp-1") {
|
if (id == "fork-wp-1") {
|
||||||
// BdApi.setWindowPreference("transparent", enabled);
|
Utils.setWindowPreference("transparent", enabled);
|
||||||
// if (enabled) BdApi.setWindowPreference("backgroundColor", null);
|
if (enabled) Utils.setWindowPreference("backgroundColor", null);
|
||||||
// else BdApi.setWindowPreference("backgroundColor", "#2f3136");
|
else Utils.setWindowPreference("backgroundColor", "#2f3136");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (_c["fork-wp-2"]) {
|
/*if (_c["fork-wp-2"]) {
|
||||||
|
|
|
@ -8,6 +8,39 @@ export default class Utils {
|
||||||
/** Document/window height */
|
/** Document/window height */
|
||||||
static get screenHeight() { return Math.max(document.documentElement.clientHeight, window.innerHeight || 0); }
|
static get screenHeight() { return Math.max(document.documentElement.clientHeight, window.innerHeight || 0); }
|
||||||
|
|
||||||
|
static get WindowConfigFile() {
|
||||||
|
if (this._windowConfigFile) return this._windowConfigFile;
|
||||||
|
const electron = require("electron").remote.app;
|
||||||
|
const path = require("path");
|
||||||
|
const base = electron.getAppPath();
|
||||||
|
const roamingBase = electron.getPath("userData");
|
||||||
|
const roamingLocation = path.resolve(roamingBase, electron.getVersion(), "modules", "discord_desktop_core", "injector", "config.json");
|
||||||
|
const location = path.resolve(base, "..", "app", "config.json");
|
||||||
|
const fs = require("fs");
|
||||||
|
const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;
|
||||||
|
if (!realLocation) return this._windowConfigFile = null;
|
||||||
|
return this._windowConfigFile = realLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getAllWindowPreferences() {
|
||||||
|
if (!this.WindowConfigFile) return {}; // Tempfix until new injection on other platforms
|
||||||
|
return __non_webpack_require__(this.WindowConfigFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getWindowPreference(key) {
|
||||||
|
if (!this.WindowConfigFile) return undefined; // Tempfix until new injection on other platforms
|
||||||
|
return this.getAllWindowPreferences()[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
static setWindowPreference(key, value) {
|
||||||
|
if (!this.WindowConfigFile) return; // Tempfix until new injection on other platforms
|
||||||
|
const fs = require("fs");
|
||||||
|
const prefs = this.getAllWindowPreferences();
|
||||||
|
prefs[key] = value;
|
||||||
|
delete __non_webpack_require__.cache[this.WindowConfigFile];
|
||||||
|
fs.writeFileSync(this.WindowConfigFile, JSON.stringify(prefs, null, 4));
|
||||||
|
}
|
||||||
|
|
||||||
static stripBOM(content) {
|
static stripBOM(content) {
|
||||||
if (content.charCodeAt(0) === 0xFEFF) {
|
if (content.charCodeAt(0) === 0xFEFF) {
|
||||||
content = content.slice(1);
|
content = content.slice(1);
|
||||||
|
|
Loading…
Reference in New Issue