Cleanup project root and update package-lock.json

This commit is contained in:
Samuel Elliott 2018-03-20 23:29:00 +00:00
parent b4bd9e9c7b
commit 1772edd37c
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
31 changed files with 750 additions and 1401 deletions

View File

@ -2,6 +2,7 @@ root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space

2
.gitattributes vendored
View File

@ -1 +1 @@
*.sh text=auto
*.sh text=auto

32
.gitignore vendored
View File

@ -1,27 +1,9 @@
.idea/*
*.name
devjs/.idea/devjs.iml
*.bak
*.bak.*
*.xpi
Firefox/data/js/jquery-2.1.4.min.js
*.dev.*
/nbproject/private/
# Generated files
node_modules
.sass-cache
/*.jiiks
Installers/dotNet/bin/
Installers/dotNet/packages/
Installers/dotNet/dlls/
v2/dist/vendor/
v2/lib/static.js
**/*.suo
Installers/**/*/bin
Installers/**/*/obj
Installers/**/*/packages
.vs
dist/
user.config.json
dist
etc
release
# User data
tests/data
/tests/themes/SimplerFlat
release
user.config.json

View File

@ -3,4 +3,4 @@ node_js:
- stable
branches:
only:
- master
- master

View File

@ -6,4 +6,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,3 +1,4 @@
# BetterDiscordApp [![Travis][build-badge]][build]
[build-badge]: https://img.shields.io/travis/JsSucks/BetterDiscordApp/master.svg
[build]: https://travis-ci.org/JsSucks/BetterDiscordApp
[build]: https://travis-ci.org/JsSucks/BetterDiscordApp

View File

@ -5,7 +5,7 @@
"version": "2.0.0b",
"homepage": "https://betterdiscord.net",
"license": "MIT",
"main": "index.js",
"main": "dist/betterdiscord.client.js",
"contributors": [
"Jiiks",
"Pohky"

View File

@ -7,4 +7,4 @@
"debug": true
}]
]
}
}

View File

@ -5,7 +5,7 @@ const
plumber = require('gulp-plumber'),
watch = require('gulp-watch');
const task_babel = function () {
const task_build = function () {
return pump([
gulp.src('src/**/*js'),
plumber(),
@ -14,7 +14,7 @@ const task_babel = function () {
]);
}
const watch_babel = function () {
const task_watch = function () {
return pump([
watch('src/**/*js'),
plumber(),
@ -23,5 +23,5 @@ const watch_babel = function () {
]);
}
gulp.task('build', task_babel);
gulp.task('watch', watch_babel);
gulp.task('build', task_build);
gulp.task('watch', task_watch);

View File

@ -1 +0,0 @@
module.exports = require('./main.js');

View File

@ -5,7 +5,7 @@
"version": "2.0.0b",
"homepage": "https://betterdiscord.net",
"license": "MIT",
"main": "index.js",
"main": "dist/main.js",
"contributors": [
"Jiiks",
"Pohky"
@ -15,11 +15,8 @@
"url": "https://github.com/Jiiks/BetterDiscordApp.git"
},
"private": false,
"devDependencies": {
},
"scripts": {
"build": "gulp build",
"watch": "gulp watch"
"watch": "gulp watch"
}
}

View File

@ -5,7 +5,7 @@
"version": "0.4.0",
"homepage": "https://betterdiscord.net",
"license": "MIT",
"main": "index.js",
"main": "dist/csseditor.js",
"contributors": [
"Jiiks",
"Pohky"
@ -15,9 +15,6 @@
"url": "https://github.com/Jiiks/BetterDiscordApp.git"
},
"private": false,
"devDependencies": {
},
"scripts": {
"build": "webpack --progress --colors",
"watch": "webpack --progress --colors --watch"

View File

@ -1,16 +1,16 @@
const
path = require('path'),
webpack = require('webpack');
const path = require('path');
const webpack = require('webpack');
const vueLoader = {
test: /\.(vue)$/,
exclude: /node_modules/,
loader: 'vue-loader'
}
};
const scssLoader = {
test: /\.(css|scss)$/,
loader: ['css-loader', 'sass-loader']
}
};
module.exports = {
entry: './src/index.js',
@ -21,9 +21,17 @@ module.exports = {
module: {
loaders: [vueLoader, scssLoader]
},
externals: {
electron: 'window.require("electron")',
fs: 'window.require("fs")'
},
resolve: {
alias: {
vue$: path.resolve('..', 'node_modules', 'vue', 'dist', 'vue.esm.js')
}
},
modules: [
path.resolve('..', 'node_modules'),
path.resolve('..', 'common', 'modules')
]
}
};

View File

@ -18,52 +18,52 @@ const client = function() {
rename(`client.${clientpkg.version}.js`),
gulp.dest('./release')
]);
}
};
const core = function() {
return pump([
gulp.src('./core/dist/modules/**/*'),
copy('release/', { prefix: 2 })
]);
}
const core2 = function() {
return pump([
gulp.src('./core/dist/main.js'),
rename(`core.${corepkg.version}.js`),
gulp.dest('./release')
]);
}
const core3 = function() {
return fs.writeFileSync('./release/index.js', `module.exports = require('./core.${corepkg.version}.js');`);
}
};
const sparkplug = function() {
return pump([
gulp.src('./core/dist/sparkplug.js'),
gulp.dest('./release')
]);
}
};
const core_modules = function() {
return pump([
gulp.src('./core/dist/modules/**/*'),
copy('release/', { prefix: 2 })
]);
};
const index = function() {
return fs.writeFileSync('./release/index.js', `module.exports = require('./core.${corepkg.version}.js');`);
};
const cssEditor = function() {
return pump([
gulp.src('./csseditor/dist/**/*'),
copy('release/csseditor', { prefix: 2 })
]);
}
};
const deps = function() {
return copydeps('./', './release');
}
};
const bindings = function() {
const node_sass_bindings = function() {
return pump([
gulp.src('./other/node_sass_bindings/**/*'),
copy('release/node_modules/node-sass/vendor', { prefix: 2 })
]);
}
};
gulp.task('release', function () {
del(['./release/**/*']).then(() => merge(client(), core(), core2(), core3(), sparkplug(), cssEditor(), deps(), bindings()));
del(['./release/**/*']).then(() => merge(client(), core(), sparkplug(), core_modules(), index(), cssEditor(), deps(), node_sass_bindings()));
});

View File

@ -5,7 +5,7 @@
"version": "2.0.0",
"homepage": "https://betterdiscord.net",
"license": "MIT",
"main": "index.js",
"main": "dist/installer.js",
"contributors": [
"Jiiks",
"Pohky"
@ -15,9 +15,6 @@
"url": "https://github.com/Jiiks/BetterDiscordApp.git"
},
"private": false,
"devDependencies": {
},
"scripts": {
"build": "webpack --progress --colors",
"watch": "webpack --progress --colors --watch"

View File

@ -2,16 +2,17 @@ const
path = require('path'),
webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin');
const vueLoader = {
test: /\.(vue)$/,
exclude: /node_modules/,
loader: 'vue-loader'
}
};
const scssLoader = {
test: /\.(css|scss)$/,
loader: ['css-loader', 'sass-loader']
}
};
module.exports = {
entry: './src/index.js',

1024
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -46,9 +46,7 @@
"html-webpack-plugin": "^3.0.6",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"nedb": "^1.8.0",
"node-gyp": "^3.6.2",
"node-sass": "^4.7.2",
"pump": "^2.0.0",
"sass-loader": "^6.0.6",
"v-tooltip": "^2.0.0-rc.30",

View File

@ -1 +1 @@
npm run build
npm run build

View File

@ -4,11 +4,11 @@ set "ELECTRON=1.6.15"
set "PLATFORM=win32"
set "ARCH=ia32"
set "VER=53"
set "VENDOR_PATH=..\node_modules\node-sass\vendor"
set "BUILD_PATH=..\node_modules\node-sass\build\Release\binding.node"
set "VENDOR_PATH=.\node_modules\node-sass\vendor"
set "BUILD_PATH=.\node_modules\node-sass\build\Release\binding.node"
echo Building %PLATFORM%-%ARCH% bindings
call ../node_modules/.bin/electron-rebuild -v=%ELECTRON% -a=%ARCH% -m ../node_modules/node-sass
call ./node_modules/.bin/electron-rebuild -v=%ELECTRON% -a=%ARCH% -m ./node_modules/node-sass
if exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node (
echo Deleting old %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node
@ -17,7 +17,7 @@ if exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node (
if not exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER% (
echo Dir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER% does not exist, creating.
mkdir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%
mkdir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%
)
if not exist %BUILD_PATH% (
@ -30,7 +30,7 @@ if not exist %BUILD_PATH% (
set "ARCH=x64"
echo Building %PLATFORM%-%ARCH% bindings
call ../node_modules/.bin/electron-rebuild -v=%ELECTRON% -a=%ARCH% -m ../node_modules/node-sass
call ./node_modules/.bin/electron-rebuild -v=%ELECTRON% -a=%ARCH% -m ./node_modules/node-sass
if exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node (
echo Deleting old %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node
@ -39,7 +39,7 @@ if exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%\binding.node (
if not exist %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER% (
echo Dir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER% does not exist, creating.
mkdir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%
mkdir %VENDOR_PATH%\%PLATFORM%-%ARCH%-%VER%
)
if not exist %BUILD_PATH% (

View File

@ -1 +1 @@
npm run watch_client
npm run watch_client

View File

@ -1 +1 @@
npm run watch_core
npm run watch_core

View File

@ -1,4 +0,0 @@
{
"version": "0.3.2",
"paths": []
}

View File

@ -1,50 +0,0 @@
<html>
<head>
<title>CSS Editor</title>
<link rel="stylesheet" href="../../node_modules/codemirror/lib/codemirror.css" />
<link rel="stylesheet" href="../../node_modules/codemirror/theme/material.css" />
<link rel="stylesheet" href="../../node_modules/codemirror/addon/scroll/simplescrollbars.css" />
<link rel="stylesheet" href="../../node_modules/codemirror/addon/dialog/dialog.css" />
<link rel="stylesheet" href="../../node_modules/codemirror/addon/hint/show-hint.css" />
<link rel="stylesheet" href="./main.css" />
</head>
<body>
<div class="container">
<div class="titlebar">
<div class="draggable"></div>
<div class="icon">
<div class="inner"></div>
</div>
<div class="title">CSS Editor</div>
<div class="flex-spacer"></div>
<div class="controls">
<button title="Toggle always on top" id="toggleaot">P</button>
<button title="Close CSS Editor" id="closeeditor">X</button>
</div>
</div>
<div id="spinner"><div class="valign">Loading Please Wait...</div></div>
<div class="editor" id="editor">
</div>
<div class="tools">
<div class="flex-row">
<button id="btnSave">Save</button>
<button id="btnUpdate">Update</button>
<div class="flex-spacer"></div>
<div id="chkboxLiveUpdate"><input type="checkbox"><span>Live Update</span></div>
</div>
</div>
</div>
<script>const $ = require('../../node_modules/jquery/dist/jquery.min.js');</script>
<script src="../../node_modules/codemirror/lib/codemirror.js"></script>
<script src="../../node_modules/codemirror/mode/css/css.js"></script>
<script src="../../node_modules/codemirror/addon/scroll/simplescrollbars.js"></script>
<script src="../../node_modules/codemirror/addon/search/search.js"></script>
<script src="../../node_modules/codemirror/addon/search/searchcursor.js"></script>
<script src="../../node_modules/codemirror/addon/search/jump-to-line.js"></script>
<script src="../../node_modules/codemirror/addon/dialog/dialog.js"></script>
<script src="../../node_modules/codemirror/addon/hint/show-hint.js"></script>
<script src="../../node_modules/codemirror/addon/hint/css-hint.js"></script>
<script src="./main.js"></script>
</body>
</html>

View File

@ -1,294 +0,0 @@
html, body {
margin: 0;
padding: 0;
max-height: 100%;
height: 100%;
background: #2c383e;
min-width: 700px;
min-height: 400px;
}
* {
outline: none;
}
.flex-spacer {
flex-grow: 1;
}
.flex-row {
display: flex;
flex-direction: row;
}
.valign {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.container {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
}
.titlebar {
display: flex;
height: 25px;
padding: 4px 5px;
background: #292b2f;
border-bottom: 1px solid hsla(218,5%,47%,.3);
user-select: none;
cursor: default;
}
.titlebar .icon {
width: 31px;
height: 25px;
}
.titlebar .icon .inner {
width: 25px;
height: 25px;
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjAwMCAyMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyMDAwIDIwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGZpbGw9IiMzRTgyRTUiIGQ9Ik0xNDAyLjIsNjMxLjdjLTkuNy0zNTMuNC0yODYuMi00OTYtNjQyLjYtNDk2SDY4LjR2NzE0LjFsNDQyLDM5OFY0OTAuN2gyNTdjMjc0LjUsMCwyNzQuNSwzNDQuOSwwLDM0NC45SDU5Ny42djMyOS41aDE2OS44YzI3NC41LDAsMjc0LjUsMzQ0LjgsMCwzNDQuOGgtNjk5djM1NC45aDY5MS4yYzM1Ni4zLDAsNjMyLjgtMTQyLjYsNjQyLjYtNDk2YzAtMTYyLjYtNDQuNS0yODQuMS0xMjIuOS0zNjguNkMxMzU3LjcsOTE1LjgsMTQwMi4yLDc5NC4zLDE0MDIuMiw2MzEuN3oiLz48cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMTI2Mi41LDEzNS4yTDEyNjIuNSwxMzUuMmwtNzYuOCwwYzI2LjYsMTMuMyw1MS43LDI4LjEsNzUsNDQuM2M3MC43LDQ5LjEsMTI2LjEsMTExLjUsMTY0LjYsMTg1LjNjMzkuOSw3Ni42LDYxLjUsMTY1LjYsNjQuMywyNjQuNmwwLDEuMnYxLjJjMCwxNDEuMSwwLDU5Ni4xLDAsNzM3LjF2MS4ybDAsMS4yYy0yLjcsOTktMjQuMywxODgtNjQuMywyNjQuNmMtMzguNSw3My44LTkzLjgsMTM2LjItMTY0LjYsMTg1LjNjLTIyLjYsMTUuNy00Ni45LDMwLjEtNzIuNiw0My4xaDcyLjVjMzQ2LjIsMS45LDY3MS0xNzEuMiw2NzEtNTY3LjlWNzE2LjdDMTkzMy41LDMxMi4yLDE2MDguNywxMzUuMiwxMjYyLjUsMTM1LjJ6Ii8+PC9nPjwvc3ZnPg==);
background-size: 22px 22px;
background-repeat: no-repeat;
background-position: center;
}
.titlebar .title {
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
line-height: 25px;
font-size: 15px;
}
.titlebar .controls {
margin: 0 0 0 2px;
font-size: 0;
}
.titlebar .controls button {
-webkit-app-region: no-drag;
border-radius: 3px;
width: 25px;
font-size: 12px;
font-weight: 600;
/*background: #263238;*/
background: #36393f;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
transition: background-color .2s ease;
cursor: default;
border: 0;
height: 25px;
z-index: 900062;
padding: 0;
margin: 0 0 0 4px;
}
.titlebar .controls button:hover {
background: #44474e;
color: #FFF;
}
.titlebar .controls button.active {
background: #3a71c1;
}
.titlebar .draggable {
top: 0;
left: 0;
right: 63px;
position: absolute;
height: 33px;
-webkit-app-region: drag;
}
#spinner {
background: rgba(51, 48, 48, 0.41);
position: absolute;
top: 34px;
left: 0;
right: 0;
bottom: 0;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
font-weight: 600;
font-size: 2em;
z-index: 90000;
user-select: none;
}
.editor {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;
}
.editor .CodeMirror {
flex-grow: 1;
}
.tools {
height: 36px;
background: #292b2f;
border-top: 1px solid hsla(218,5%,47%,.3);
display: flex;
flex-direction: column;
user-select: none;
}
.tools .flex-row {
flex-grow: 1;
padding: 4px 5px;
}
.tools button {
border-radius: 3px;
width: 100px;
padding: 3px 10px;
font-size: 12px;
font-weight: 600;
background: #36393f;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
transition: background-color .2s ease;
cursor: pointer;
border: 0;
margin-right: 4px;
}
.tools button:hover {
background: #44474e;
color: #FFF;
}
.tools #chkboxLiveUpdate {
padding: 3px 10px;
line-height: 22px;
}
.tools #chkboxLiveUpdate input[type="checkbox"] {
margin: 0 6px 0 0;
cursor: pointer;
}
.tools #chkboxLiveUpdate span {
font-size: 12px;
font-weight: 500;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
cursor: default;
}
/*CodeMirror styling*/
.CodeMirror-scroll {
cursor: text;
}
.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler {
background: #38444a;
}
.CodeMirror-overlayscroll-horizontal div,
.CodeMirror-overlayscroll-vertical div {
background: rgb(41, 43, 47);
}
.CodeMirror-overlayscroll-horizontal,
.CodeMirror-overlayscroll-horizontal div {
height: 10px;
}
.CodeMirror-overlayscroll-vertical,
.CodeMirror-overlayscroll-vertical div {
width: 10px;
}
.CodeMirror-scrollbar-filler {
width: 10px;
height: 10px;
background: rgb(41, 43, 47);
}
.cm-s-material.CodeMirror {
background: #36393f;
}
.CodeMirror-scroll {
cursor: text;
}
.cm-s-material .CodeMirror-gutters {
background: #292b2f;
}
.CodeMirror-gutter {
min-width: 34px;
border-right: 1px solid hsla(218,5%,47%,.3);
cursor: default;
}
.CodeMirror-hints {
/*background: #1e262a;*/
background: #292b2f;
box-shadow: 2px 3px 5px rgba(4, 4, 4, 0.22);
border: 1px solid #262f33;
}
.CodeMirror-hints::-webkit-scrollbar {
background: transparent;
}
.CodeMirror-hints::-webkit-scrollbar-thumb {
background-color: rgba(0,0,0,.4);
border-color: transparent;
}
.CodeMirror-hints::-webkit-scrollbar-thumb,
.CodeMirror-hints::-webkit-scrollbar-track {
background-clip: padding-box;
border-width: 3px;
border-style: solid;
border-radius: 7px;
}
.CodeMirror-hints::-webkit-scrollbar-track {
background-color: transparent;
border-color: transparent;
}
.CodeMirror-linenumber,
.CodeMirror-line {
padding: 0 5px !important;
}
.CodeMirror-linenumber {
cursor: text;
}
.cm-s-material .CodeMirror-linenumber {
color: #f6f6f7;
}
.CodeMirror-hint {
color: #bac9d2;
}
li.CodeMirror-hint-active {
color: #bac9d2;
/*background: #3b4950;*/
background: #36393f;
}
.CodeMirror-dialog-top {
bottom: 0;
top: auto;
border: none;
background: #1e262a;
}

View File

@ -1,123 +0,0 @@
const { remote, ipcRenderer } = require('electron');
const { BDIpc } = require('../frontend/main.js');
//Options
const options = {
alwaysOnTop: false,
liveUpdate: false
};
function sendToDiscord(channel, message) {
BDIpc.send('bd-sendToDiscord', {channel, message});
}
//Elements
const
$spinner = $('#spinner'),
$toggleaot = $('#toggleaot'),
$closeeditor = $('#closeeditor'),
$editor = $('#editor'),
$btnSave = $('#btnSave'),
$btnUpdate = $('#btnUpdate'),
$chkboxLiveUpdate = $("#chkboxLiveUpdate input");
$toggleaot.on('click', e => {
$toggleaot.toggleClass("active");
remote.getCurrentWindow().setAlwaysOnTop(options.alwaysOnTop = !options.alwaysOnTop);
});
$closeeditor.on('click', e => window.close());
$btnSave.on('click', () => sendToDiscord("save-css", codeMirror.getValue()));
$btnUpdate.on('click', () => sendToDiscord("update-css", codeMirror.getValue()));
$chkboxLiveUpdate.on('change', () => options.liveUpdate = $chkboxLiveUpdate[0].checked);
BDIpc.on("set-css", (_, data) => {
if (data.error) {
alert(data.error);
return;
}
setCss(data.css);
$spinner.hide();
});
function setCss(css) {
codeMirror.setValue(css);
}
function alert(message) {}
const codeMirror = CodeMirror($editor[0], {
lineNumbers: true,
mode: 'css',
indentUnit: 4,
theme: 'material',
scrollbarStyle: 'overlay',
extraKeys: { 'Ctrl-Space': 'autocomplete' },
dialog: { 'position': 'bottom' }
});
codeMirror.on('change', () => {
if (options.liveUpdate)
sendToDiscord("update-css", codeMirror.getValue());
});
codeMirror.on('keyup', function (editor, event) {
if (window.controlDown) return;
if (ExcludedIntelliSenseTriggerKeys[event.keyCode]) return;
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false });
});
const ExcludedIntelliSenseTriggerKeys = {
'8': 'backspace',
'9': 'tab',
'13': 'enter',
'16': 'shift',
'17': 'ctrl',
'18': 'alt',
'19': 'pause',
'20': 'capslock',
'27': 'escape',
'33': 'pageup',
'34': 'pagedown',
'35': 'end',
'36': 'home',
'37': 'left',
'38': 'up',
'39': 'right',
'40': 'down',
'45': 'insert',
'46': 'delete',
'91': 'left window key',
'92': 'right window key',
'93': 'select',
'107': 'add',
'109': 'subtract',
'110': 'decimal point',
'111': 'divide',
'112': 'f1',
'113': 'f2',
'114': 'f3',
'115': 'f4',
'116': 'f5',
'117': 'f6',
'118': 'f7',
'119': 'f8',
'120': 'f9',
'121': 'f10',
'122': 'f11',
'123': 'f12',
'144': 'numlock',
'145': 'scrolllock',
'186': 'semicolon',
'187': 'equalsign',
'188': 'comma',
'189': 'dash',
'190': 'period',
'191': 'slash',
'192': 'graveaccent',
'220': 'backslash',
'222': 'quote'
};
BDIpc.send('bd-get-css');

File diff suppressed because one or more lines are too long

View File

@ -1,5 +0,0 @@
<html>
<head>
<script src="main.js"></script>
</head>
</html>

View File

@ -1,26 +0,0 @@
const { ipcRenderer } = require('electron');
class BDIpc {
static on(channel, cb) {
ipcRenderer.on(channel, (event, args) => cb(event, args));
}
static async send(channel, message) {
const __eid = Date.now().toString();
ipcRenderer.send(
channel.startsWith('bd-') ? channel: `bd-${channel}`,
message === undefined ? { __eid } : Object.assign(message, { __eid })
);
return new Promise((resolve, reject) => {
ipcRenderer.once(__eid, (event, arg) => {
if (arg.err) return reject(arg);
resolve(arg);
});
});
}
}
module.exports = { BDIpc };

View File

@ -1,21 +0,0 @@
const { app, BrowserWindow } = require('electron');
const { BetterDiscord } = require('../core/dist/main.js');
const path = require('path');
const url = require('url');
const config = require('./config.json');
let bw;
const bd = new BetterDiscord(Object.assign(config));
app.on('ready', () => {
bw = new BrowserWindow({ width: 1920, height: 1080 });
bw.webContents.openDevTools();
bw.loadURL(url.format({
pathname: path.join(__dirname, 'frontend', 'index.html'),
protocol: 'file',
slashes: true
}));
bw.on('closed', () => app.quit());
});

View File

@ -1 +0,0 @@
..\core\node_modules\.bin\electron.cmd .\