Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/PhieF/CarnetElectron.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhie <phie@phie.ovh>2018-10-28 00:27:46 +0300
committerPhie <phie@phie.ovh>2018-10-28 00:27:46 +0300
commit1474cc5c3065133ed07074c49c04a9081cd51a74 (patch)
tree127f1c1cb1801847ec899e9c73a4021cbfad0cf8 /settings
parentacaefc1133ce2e3fc088bb716062e3bb09762bc3 (diff)
fixing settings
Diffstat (limited to 'settings')
-rw-r--r--settings/index.html111
-rw-r--r--settings/settings.js47
2 files changed, 32 insertions, 126 deletions
diff --git a/settings/index.html b/settings/index.html
deleted file mode 100644
index 07a2c5e..0000000
--- a/settings/index.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<html>
-
-<head>
-
- <script>
- window.jQuery = window.$ = require('jquery');
- </script>
- <link rel="stylesheet" href="browsers/design.css">
- <script src="libs/polyfill.js"></script>
- <script src="libs/material.js"></script>
- <script src="compatibility.js"></script>
- <script src="requests/request_builder.js"></script>
-
- <script src="reader/assets/scripts/jquery-ui.min.js"></script>
- <link rel="stylesheet" href="libs/material.indigo-pink.min.css">
- <link rel="stylesheet" href="libs/polyfill.css">
-
- <!-- Material Design icon font -->
- <link rel="stylesheet" href="libs/material-icons.css">
- <script src="recent/recent_db_manager.js"></script>
-
- <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
- <!-- Material Design icon font -->
- <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
-</head>
-
-<body>
- <style>
- .settings-button {
- cursor: pointer;
- }
-
- .settings-box {
- margin-top: 15px;
- margin-left: calc(50% - 200px);
- width: 400px;
- }
- </style>
-
- <!-- The drawer is always open in large screens. The header is always shown,
- even in small screens. -->
- <div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer
- mdl-layout--fixed-header">
- <header class="mdl-layout__header">
- <div class="mdl-layout__header-row">
-
- <span class="mdl-layout-title">Settings</span>
- <div class="mdl-layout-spacer"></div>
- <div style="position:absolute; right:0px;" id="right-bar">
- </div>
-
- </header>
- <div class="mdl-layout__drawer">
- <nav class="mdl-navigation">
- <a class="mdl-navigation__link" href="./" id="recent-button">Recent</a>
- <a class="mdl-navigation__link" href="./" id="browser-button">Browser</a>
- <a class="mdl-navigation__link">Settings</a>
- </nav>
- </div>
- <main class="mdl-layout__content" id="page-container" style="text-align:center;">
-
- <table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp settings-box"
- style="">
-
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="select_note_path_button">
- Select note path
- <br />
- <span id="current_root_path"></span>
- </td>
- </tr>
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="cloudsync">
- Cloud sync with mobile and desktop
- </td>
- </tr>
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="import">
- Import from Google Keep (only on desktop client)
- </td>
- </tr>
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="export">
- Export all notes
- </td>
- </tr>
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="liberapay">
- Donation - LiberaPay
- </td>
- </tr>
- <tr>
- <td class="mdl-data-table__cell--non-numeric carnet-settings-button" id="paypal">
- Donation - PayPal
- </td>
- </tr>
- </table>
-
-
- </main>
- <script src="settings/settings.js">
- </script>
- </div>
- <div id="restarting" style="display:none;position: absolute; z-index:3;width:100%; height:100%; background: rgba(92, 120, 165,.9); ">
- <div style="position: relative;top:50%;text-align:center;font-size:30px; color:white;">QuickDoc will now
- restart</div>
- </div>
-</body>
-
-</html> \ No newline at end of file
diff --git a/settings/settings.js b/settings/settings.js
index f3fe706..1a6f3e4 100644
--- a/settings/settings.js
+++ b/settings/settings.js
@@ -1,18 +1,19 @@
var currentPath;
document.getElementById("select_note_path_button").onclick = function () {
- if (isElectron) {
+ if (compatibility.isElectron) {
+ const {
+ remote
+ } = require('electron');
var dialog = remote.dialog;
dialog.showOpenDialog({
properties: ['openDirectory']
}, function (path) {
if (path != undefined) {
- settingsHelper.setNotePath(path)
-
- document.getElementById("restarting").style.display = "block";
- setTimeout(function () {
- remote.app.relaunch();
- remote.app.exit(0);
- }, 3000)
+ RequestBuilder.sRequestBuilder.post("/settings/note_path", {
+ path: path
+ }, function (error, data) {
+ window.location.reload(true)
+ });
}
})
@@ -38,7 +39,7 @@ RequestBuilder.sRequestBuilder.get("/settings/note_path", function (error, data)
document.getElementById("cloudsync").onclick = function () {
console.log("pet")
const url = 'https://github.com/PhieF/QuickDocDocumentation/blob/master/README.md';
- if (isElectron) {
+ if (compatibility.isElectron) {
var {
shell
} = require('electron');
@@ -57,17 +58,32 @@ document.getElementById("export").onclick = function () {
}
document.getElementById("liberapay").onclick = function () {
- var win = window.open("https://liberapay.com/~34946", '_blank');
- win.focus();
+ const url = 'https://liberapay.com/~34946';
+ if (compatibility.isElectron) {
+ var {
+ shell
+ } = require('electron');
+ shell.openExternal(url);
+ } else {
+ var win = window.open(url, '_blank');
+ win.focus();
+ }
}
document.getElementById("paypal").onclick = function () {
- var win = window.open("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YMHT55NSCLER6", '_blank');
- win.focus();
+ const url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YMHT55NSCLER6";
+ if (compatibility.isElectron) {
+ var {
+ shell
+ } = require('electron');
+ shell.openExternal(url);
+ } else {
+ var win = window.open(url, '_blank');
+ win.focus();
+ }
}
document.getElementById("import").onclick = function () {
- var settingsHelper = new SettingsHelper();
var {
remote
} = require('electron');
@@ -81,11 +97,12 @@ document.getElementById("import").onclick = function () {
const url = require('url')
const path = require('path')
win.loadURL(url.format({
- pathname: path.join(__dirname, '../importer/importer.html'),
+ pathname: path.join(__dirname, 'importer/importer.html'),
protocol: 'file:',
slashes: true
}))
win.setMenu(null)
+
}
const isWeb = true;
if (isWeb) {