Use Babel to convert ES6 classes for older Android devices
This commit is contained in:
parent
457960aa86
commit
0415de945f
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,3 +5,6 @@
|
||||
/plugins
|
||||
npm-debug.log
|
||||
nbproject/private/
|
||||
/www/js
|
||||
/yarn-error.log
|
||||
/www/yarn-error.log
|
||||
|
@ -19,6 +19,7 @@
|
||||
<allow-intent href="mailto:*" />
|
||||
<allow-intent href="geo:*" />
|
||||
<platform name="android">
|
||||
<preference name="android-minSdkVersion" value="21" />
|
||||
<preference name="android-targetSdkVersion" value="27" />
|
||||
<allow-intent href="market:*" />
|
||||
<preference name="HeaderColor" value="#F44336" />
|
||||
|
13
www/babel.config.js
Normal file
13
www/babel.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
const presets = [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
targets: {
|
||||
chrome: "33",
|
||||
},
|
||||
useBuiltIns: "usage",
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
module.exports = { presets };
|
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
class NotePostNotes extends Notes {
|
||||
|
||||
constructor(server, username, password) {
|
||||
super();
|
||||
this.server = server;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
del(noteid, success, error) {
|
||||
super.del(noteid);
|
||||
var self = this;
|
||||
return $.ajax({
|
||||
url: this.server + "/api/deletenote",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: noteid
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
}, success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
self.notes = val.notes;
|
||||
}
|
||||
if (typeof success == 'function') {
|
||||
success();
|
||||
}
|
||||
}, error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
add(note, success, error) {
|
||||
note.norealid = true;
|
||||
this.saveNote(note, success, error);
|
||||
}
|
||||
|
||||
getNote(noteid, success, error) {
|
||||
return $.ajax({
|
||||
url: this.server + "/api/getnote",
|
||||
dataType: "json",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: noteid
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
}, success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
if (typeof success == 'function') {
|
||||
success(val.note);
|
||||
}
|
||||
} else {
|
||||
if (typeof error == 'function') {
|
||||
error(val.msg);
|
||||
}
|
||||
}
|
||||
}, error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
saveNote(note, success, error) {
|
||||
var self = this;
|
||||
var data = {
|
||||
text: note.content,
|
||||
color: note.color,
|
||||
modified: note.modified,
|
||||
favorite: (note.favorite ? "1" : "0")
|
||||
};
|
||||
// Don't send ID if it's a locally-made note
|
||||
if (note.norealid != true) {
|
||||
data.id = note.noteid;
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
url: this.server + "/api/savenote",
|
||||
dataType: "json",
|
||||
method: "POST",
|
||||
data: data,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
}, success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
if (typeof success == 'function') {
|
||||
success(val.note);
|
||||
}
|
||||
} else {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
}, error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync notes with the NotePost server, resolving conflicts in the process.
|
||||
*
|
||||
* @param {function} success(notes) called when everything's synced up.
|
||||
* @param {function} error
|
||||
* @returns {undefined}
|
||||
*/
|
||||
sync(success, error) {
|
||||
super.sync();
|
||||
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: this.server + "/api/getnotes",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
}, success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
|
||||
console.log("Comparing notes...");
|
||||
console.log("Local copy:", self.notes);
|
||||
console.log("Remote copy:", val.notes);
|
||||
var delta = getDelta(self.notes, val.notes);
|
||||
console.log("Comparison: ", delta);
|
||||
|
||||
var notes = delta.noChange;
|
||||
notes = notes.concat(delta.addedRemote);
|
||||
notes = notes.concat(delta.changedRemote);
|
||||
|
||||
// Sync locally-created or modified notes
|
||||
var notesToUpload = delta.addedLocal;
|
||||
notesToUpload = notesToUpload.concat(delta.changedLocal);
|
||||
var addedOrChangedLocallyAjax = [];
|
||||
for (var i = 0; i < notesToUpload.length; i++) {
|
||||
addedOrChangedLocallyAjax.push(self.saveNote(self.fix(notesToUpload[i]), function (n) {
|
||||
notes.push(n);
|
||||
}));
|
||||
}
|
||||
$.when(addedOrChangedLocallyAjax).then(function () {
|
||||
self.notes = notes;
|
||||
self.fixAll();
|
||||
localStorage.setItem("notes", JSON.stringify(notes));
|
||||
console.log(JSON.parse(localStorage.getItem("notes")));
|
||||
if (typeof success == 'function') {
|
||||
success(notes);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,155 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
class Notes {
|
||||
|
||||
constructor() {
|
||||
this.notes = [];
|
||||
}
|
||||
|
||||
get(noteid) {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid == noteid) {
|
||||
return this.notes[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return this.notes;
|
||||
}
|
||||
|
||||
set(note) {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid == note.noteid) {
|
||||
// Refresh HTML rendering
|
||||
note.html = marked(note.content);
|
||||
|
||||
this.notes[i] = note;
|
||||
this.save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.notes.push(note);
|
||||
this.save();
|
||||
}
|
||||
|
||||
del(noteid, success, error) {
|
||||
var newnotearr = [];
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid != noteid) {
|
||||
newnotearr.push(this.notes[i]);
|
||||
}
|
||||
}
|
||||
this.notes = newnotearr;
|
||||
this.save();
|
||||
if (typeof success == 'function') {
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
add(note, success, error) {
|
||||
var noteid = null;
|
||||
do {
|
||||
noteid = Math.floor(Math.random() * (9999999999 - 1000000000) + 1000000000);
|
||||
console.log("Generating random note ID: " + noteid);
|
||||
} while (this.get(noteid) != null);
|
||||
note["noteid"] = noteid;
|
||||
this.notes.push(note);
|
||||
this.save();
|
||||
if (typeof success == 'function') {
|
||||
success(note);
|
||||
}
|
||||
}
|
||||
|
||||
fix(note) {
|
||||
if (typeof note.noteid !== 'number') {
|
||||
note.noteid = null;
|
||||
}
|
||||
// Set background color
|
||||
if (typeof note.color !== 'string') {
|
||||
note.color = "FFF59D";
|
||||
}
|
||||
// Set text color based on background
|
||||
if (typeof note.textcolor !== 'string') {
|
||||
var r = parseInt(note.color.substring(0, 2), 16);
|
||||
var g = parseInt(note.color.substring(2, 4), 16);
|
||||
var b = parseInt(note.color.substring(4, 6), 16);
|
||||
var contrast = Math.sqrt(
|
||||
r * r * 0.241 +
|
||||
g * g * 0.691 +
|
||||
b * b * 0.068
|
||||
);
|
||||
if (contrast > 130) {
|
||||
note.textcolor = "000000";
|
||||
} else {
|
||||
note.textcolor = "FFFFFF";
|
||||
}
|
||||
}
|
||||
// Just in case
|
||||
if (typeof note.content !== 'string') {
|
||||
note.content = "";
|
||||
}
|
||||
// Set title
|
||||
if (typeof note.title !== 'string') {
|
||||
note.title = note.content.split('\n')[0].replace(/[#\-]+/gi, "").trim();
|
||||
}
|
||||
if (typeof note.modified !== 'number') {
|
||||
note.modified = Math.round((new Date()).getTime() / 1000);
|
||||
}
|
||||
// Render Markdown to HTML
|
||||
if (typeof note.html !== 'string') {
|
||||
note.html = marked(note.content);
|
||||
}
|
||||
// Save
|
||||
return note;
|
||||
}
|
||||
|
||||
fixAll() {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
this.notes[i] = this.fix(this.notes[i]);
|
||||
}
|
||||
this.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync notes with the storage backend.
|
||||
*
|
||||
* @param {type} success
|
||||
* @param {type} error
|
||||
* @returns {undefined}
|
||||
*/
|
||||
sync(success, error) {
|
||||
if (localStorage.getItem("notes") !== null) { // There is localstorage
|
||||
var storage = JSON.parse(localStorage.getItem("notes"));
|
||||
|
||||
console.log("Memory copy:", this.notes);
|
||||
console.log("Storage copy:", storage);
|
||||
var delta = getDelta(this.notes, storage);
|
||||
console.log("Comparison: ", delta);
|
||||
|
||||
var notes = delta.noChange;
|
||||
notes = notes.concat(delta.addedRemote);
|
||||
notes = notes.concat(delta.changedRemote);
|
||||
notes = notes.concat(delta.addedLocal);
|
||||
notes = notes.concat(delta.changedLocal);
|
||||
// If localStorage is missing something, we still want it
|
||||
notes = notes.concat(delta.deletedRemote);
|
||||
|
||||
this.notes = notes;
|
||||
this.fixAll();
|
||||
}
|
||||
this.save();
|
||||
if (typeof success == 'function') {
|
||||
success(this.notes);
|
||||
}
|
||||
}
|
||||
|
||||
save() {
|
||||
localStorage.setItem("notes", JSON.stringify(this.notes));
|
||||
}
|
||||
}
|
121
www/js/delta.js
121
www/js/delta.js
@ -1,10 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* The code in this file is by StackOverflow user Juan Mendes.
|
||||
* License: Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0).
|
||||
* Source: https://stackoverflow.com/a/14966749
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a map out of an array be choosing what property to key by
|
||||
* @param {object[]} array Array that will be converted into a map
|
||||
@ -14,70 +15,82 @@
|
||||
* returns {1: {a:1,b:2}, 3: {a:3,b:4}}
|
||||
*/
|
||||
function mapFromArray(array, prop) {
|
||||
var map = {};
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
map[ array[i][prop] ] = array[i];
|
||||
}
|
||||
return map;
|
||||
}
|
||||
var map = {};
|
||||
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
map[array[i][prop]] = array[i];
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* @param {object[]} o old array of notes (local copy)
|
||||
* @param {object[]} n new array of notes (remote copy)
|
||||
* @param {object} An object with changes
|
||||
*/
|
||||
|
||||
|
||||
function getDelta(o, n) {
|
||||
var delta = {
|
||||
addedRemote: [],
|
||||
addedLocal: [],
|
||||
deletedRemote: [],
|
||||
deletedLocal: [],
|
||||
changedRemote: [],
|
||||
changedLocal: [],
|
||||
noChange: []
|
||||
};
|
||||
oSane = [];
|
||||
for (var i = 0; i < o.length; i++) {
|
||||
if (o[i].noteid == null) { // Note has no real `noteid`
|
||||
delta.addedLocal.push(o[i]);
|
||||
var delta = {
|
||||
addedRemote: [],
|
||||
addedLocal: [],
|
||||
deletedRemote: [],
|
||||
deletedLocal: [],
|
||||
changedRemote: [],
|
||||
changedLocal: [],
|
||||
noChange: []
|
||||
};
|
||||
oSane = [];
|
||||
|
||||
for (var i = 0; i < o.length; i++) {
|
||||
if (o[i].noteid == null) {
|
||||
// Note has no real `noteid`
|
||||
delta.addedLocal.push(o[i]);
|
||||
} else {
|
||||
oSane.push(o[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var local = mapFromArray(oSane, 'noteid');
|
||||
var remote = mapFromArray(n, 'noteid');
|
||||
|
||||
for (var id in local) {
|
||||
if (!remote.hasOwnProperty(id)) {
|
||||
// Notes that are only present locally
|
||||
delta.addedLocal.push(local[id]); // TODO: Figure out which notes were actually added locally and which were deleted on the server
|
||||
|
||||
/*if (local[id].norealid) { // Note hasn't been synced to the remote yet
|
||||
delta.addedLocal.push(local[id]);
|
||||
} else { // Note has been synced to remote but isn't there anymore
|
||||
delta.deletedRemote.push(local[id]);
|
||||
}*/
|
||||
} else {
|
||||
// Notes that are present on both
|
||||
if (local[id].modified > remote[id].modified) {
|
||||
// Local copy is newer
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else if (local[id].modified < remote[id].modified) {
|
||||
// Remote copy is newer
|
||||
delta.changedRemote.push(remote[id]);
|
||||
} else {
|
||||
// Modified date is same, let's check content
|
||||
if (local[id].content == remote[id].content) {
|
||||
delta.noChange.push(local[id]);
|
||||
} else if (local[id].content.length > remote[id].content.length) {
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else {
|
||||
oSane.push(o[i]);
|
||||
delta.changedRemote.push(remote[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var local = mapFromArray(oSane, 'noteid');
|
||||
var remote = mapFromArray(n, 'noteid');
|
||||
} // Add notes that are only on the remote
|
||||
|
||||
for (var id in local) {
|
||||
if (!remote.hasOwnProperty(id)) { // Notes that are only present locally
|
||||
delta.addedLocal.push(local[id]);
|
||||
// TODO: Figure out which notes were actually added locally and which were deleted on the server
|
||||
/*if (local[id].norealid) { // Note hasn't been synced to the remote yet
|
||||
delta.addedLocal.push(local[id]);
|
||||
} else { // Note has been synced to remote but isn't there anymore
|
||||
delta.deletedRemote.push(local[id]);
|
||||
}*/
|
||||
} else { // Notes that are present on both
|
||||
if (local[id].modified > remote[id].modified) { // Local copy is newer
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else if (local[id].modified < remote[id].modified) { // Remote copy is newer
|
||||
delta.changedRemote.push(remote[id]);
|
||||
} else { // Modified date is same, let's check content
|
||||
if (local[id].content == remote[id].content) {
|
||||
delta.noChange.push(local[id]);
|
||||
} else if (local[id].content.length > remote[id].content.length) {
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else {
|
||||
delta.changedRemote.push(remote[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add notes that are only on the remote
|
||||
for (var id in remote) {
|
||||
if (!local.hasOwnProperty(id)) {
|
||||
delta.addedRemote.push(remote[id]);
|
||||
}
|
||||
for (var id in remote) {
|
||||
if (!local.hasOwnProperty(id)) {
|
||||
delta.addedRemote.push(remote[id]);
|
||||
}
|
||||
return delta;
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
@ -1,49 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function saveme(callback) {
|
||||
function finishSave(note, callback) {
|
||||
NOTES.fixAll();
|
||||
NOTES.sync(function () {
|
||||
app.toast.create({
|
||||
text: 'Note saved.',
|
||||
closeTimeout: 2000
|
||||
}).open();
|
||||
$("#orig_content").val(note.content);
|
||||
});
|
||||
if (typeof callback == "function") {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
function finishSave(note, callback) {
|
||||
NOTES.fixAll();
|
||||
NOTES.sync(function () {
|
||||
app.toast.create({
|
||||
text: 'Note saved.',
|
||||
closeTimeout: 2000
|
||||
}).open();
|
||||
$("#orig_content").val(note.content);
|
||||
});
|
||||
|
||||
var noteid = $("#note_content").data("noteid");
|
||||
if (noteid == "") {
|
||||
var note = {
|
||||
content: $("#note_content").val(),
|
||||
modified: Math.round((new Date()).getTime() / 1000)
|
||||
};
|
||||
NOTES.add(note, function (n) {
|
||||
$("#note_content").data("noteid", n.noteid);
|
||||
finishSave(n, callback);
|
||||
});
|
||||
} else {
|
||||
var note = NOTES.get(noteid);
|
||||
note.content = $("#note_content").val();
|
||||
note.modified = Math.round((new Date()).getTime() / 1000);
|
||||
NOTES.set(note);
|
||||
finishSave(note, callback);
|
||||
if (typeof callback == "function") {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
var noteid = $("#note_content").data("noteid");
|
||||
|
||||
if (noteid == "") {
|
||||
var note = {
|
||||
content: $("#note_content").val(),
|
||||
modified: Math.round(new Date().getTime() / 1000)
|
||||
};
|
||||
NOTES.add(note, function (n) {
|
||||
$("#note_content").data("noteid", n.noteid);
|
||||
finishSave(n, callback);
|
||||
});
|
||||
} else {
|
||||
var note = NOTES.get(noteid);
|
||||
note.content = $("#note_content").val();
|
||||
note.modified = Math.round(new Date().getTime() / 1000);
|
||||
NOTES.set(note);
|
||||
finishSave(note, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function exiteditor() {
|
||||
if ($("#note_content").val() == "" || $("#note_content").val() === $("#orig_content").val()) {
|
||||
router.back({force: true, ignoreCache: true, reload: true});
|
||||
} else {
|
||||
saveme(function () {
|
||||
router.back({force: true, ignoreCache: true, reload: true});
|
||||
});
|
||||
}
|
||||
if ($("#note_content").val() == "" || $("#note_content").val() === $("#orig_content").val()) {
|
||||
router.back({
|
||||
force: true,
|
||||
ignoreCache: true,
|
||||
reload: true
|
||||
});
|
||||
} else {
|
||||
saveme(function () {
|
||||
router.back({
|
||||
force: true,
|
||||
ignoreCache: true,
|
||||
reload: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
161
www/js/home.js
161
www/js/home.js
@ -1,126 +1,105 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
||||
restartApplication();
|
||||
restartApplication();
|
||||
});
|
||||
|
||||
function editNote(id) {
|
||||
var note = NOTES.get(id);
|
||||
router.navigate("/editnote", {
|
||||
context: {
|
||||
noteid: id,
|
||||
content: note.content,
|
||||
notetitle: note.title,
|
||||
}
|
||||
});
|
||||
console.log("Editing " + id);
|
||||
var note = NOTES.get(id);
|
||||
router.navigate("/editnote", {
|
||||
context: {
|
||||
noteid: id,
|
||||
content: note.content,
|
||||
notetitle: note.title
|
||||
}
|
||||
});
|
||||
console.log("Editing " + id);
|
||||
}
|
||||
|
||||
function favoriteNote(id) {
|
||||
function favoriteNote(id) {}
|
||||
|
||||
}
|
||||
|
||||
function makeList(id) {
|
||||
|
||||
}
|
||||
function makeList(id) {}
|
||||
|
||||
function deleteNote(id) {
|
||||
app.dialog.confirm('Are you sure?', 'Delete Note', function () {
|
||||
NOTES.del(id, function () {
|
||||
app.ptr.refresh();
|
||||
});
|
||||
app.dialog.confirm('Are you sure?', 'Delete Note', function () {
|
||||
NOTES.del(id, function () {
|
||||
app.ptr.refresh();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("#app").on("click", ".edit-note-btn", function () {
|
||||
editNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
editNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".favorite-note-btn", function () {
|
||||
favoriteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
favoriteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".listify-note-btn", function () {
|
||||
makeList($(this).data("note"));
|
||||
app.popover.close();
|
||||
makeList($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".delete-note-btn", function () {
|
||||
deleteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
deleteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
function openNoteActionMenu(notecard) {
|
||||
var noteid = notecard.data("id");
|
||||
if (window.innerWidth < 768) {
|
||||
var actionsheet = app.actions.create({
|
||||
buttons: [
|
||||
{
|
||||
text: "Edit",
|
||||
bold: true,
|
||||
icon: '<i class="fas fa-edit fa-fw"></i>',
|
||||
onClick: function () {
|
||||
editNote(noteid);
|
||||
}
|
||||
},
|
||||
// {
|
||||
// text: "Favorite",
|
||||
// icon: '<i class="fas fa-star fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// favoriteNote(noteid);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// text: "Make a List",
|
||||
// icon: '<i class="fas fa-tasks fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// makeList(noteid);
|
||||
// }
|
||||
// },
|
||||
{
|
||||
text: "Delete",
|
||||
icon: '<i class="fas fa-trash fa-fw"></i>',
|
||||
onClick: function () {
|
||||
deleteNote(noteid);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
var noteid = notecard.data("id");
|
||||
|
||||
actionsheet.open();
|
||||
return false;
|
||||
} else {
|
||||
var contextPopover = app.popover.create({
|
||||
targetEl: notecard.children(".menubtn"),
|
||||
content: '<div class="popover">' +
|
||||
'<div class="popover-inner">' +
|
||||
'<div class="list">' +
|
||||
'<ul>' +
|
||||
'<li><a class="list-button item-link edit-note-btn" data-note="' + noteid + '"><i class="fas fa-edit fa-fw"></i> Edit</a></li>' +
|
||||
'<li><a class="list-button item-link favorite-note-btn" data-note="' + noteid + '"><i class="fas fa-star fa-fw"></i> Favorite</a></li>' +
|
||||
'<li><a class="list-button item-link listify-note-btn" data-note="' + noteid + '"><i class="fas fa-tasks fa-fw"></i> Make a List</a></li>' +
|
||||
'<li><a class="list-button item-link delete-note-btn" data-note="' + noteid + '"><i class="fas fa-trash fa-fw"></i> Delete</a></li>' +
|
||||
'</ul>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
});
|
||||
contextPopover.open();
|
||||
}
|
||||
if (window.innerWidth < 768) {
|
||||
var actionsheet = app.actions.create({
|
||||
buttons: [{
|
||||
text: "Edit",
|
||||
bold: true,
|
||||
icon: '<i class="fas fa-edit fa-fw"></i>',
|
||||
onClick: function onClick() {
|
||||
editNote(noteid);
|
||||
}
|
||||
}, // {
|
||||
// text: "Favorite",
|
||||
// icon: '<i class="fas fa-star fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// favoriteNote(noteid);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// text: "Make a List",
|
||||
// icon: '<i class="fas fa-tasks fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// makeList(noteid);
|
||||
// }
|
||||
// },
|
||||
{
|
||||
text: "Delete",
|
||||
icon: '<i class="fas fa-trash fa-fw"></i>',
|
||||
onClick: function onClick() {
|
||||
deleteNote(noteid);
|
||||
}
|
||||
}]
|
||||
});
|
||||
actionsheet.open();
|
||||
return false;
|
||||
} else {
|
||||
var contextPopover = app.popover.create({
|
||||
targetEl: notecard.children(".menubtn"),
|
||||
content: '<div class="popover">' + '<div class="popover-inner">' + '<div class="list">' + '<ul>' + '<li><a class="list-button item-link edit-note-btn" data-note="' + noteid + '"><i class="fas fa-edit fa-fw"></i> Edit</a></li>' + '<li><a class="list-button item-link favorite-note-btn" data-note="' + noteid + '"><i class="fas fa-star fa-fw"></i> Favorite</a></li>' + '<li><a class="list-button item-link listify-note-btn" data-note="' + noteid + '"><i class="fas fa-tasks fa-fw"></i> Make a List</a></li>' + '<li><a class="list-button item-link delete-note-btn" data-note="' + noteid + '"><i class="fas fa-trash fa-fw"></i> Delete</a></li>' + '</ul>' + '</div>' + '</div>' + '</div>'
|
||||
});
|
||||
contextPopover.open();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$(".view-main").on("click", ".notecard .menubtn", function () {
|
||||
return openNoteActionMenu($(this).parent());
|
||||
return openNoteActionMenu($(this).parent());
|
||||
});
|
||||
|
||||
$(".view-main").on("contextmenu", ".notecard", function () {
|
||||
return openNoteActionMenu($(this));
|
||||
return openNoteActionMenu($(this));
|
||||
});
|
@ -1,70 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
require("core-js/modules/es6.array.find");
|
||||
|
||||
require("core-js/modules/es6.regexp.to-string");
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var $$ = Dom7;
|
||||
|
||||
var app = new Framework7({
|
||||
root: "#app",
|
||||
name: "NotePost",
|
||||
id: "com.netsyms.NotePostApp",
|
||||
init: true,
|
||||
initOnDeviceReady: false,
|
||||
routes: routes
|
||||
root: "#app",
|
||||
name: "NotePost",
|
||||
id: "com.netsyms.NotePostApp",
|
||||
init: true,
|
||||
initOnDeviceReady: false,
|
||||
routes: routes
|
||||
});
|
||||
|
||||
var mainView = app.views.create('.view-main', {
|
||||
url: "/"
|
||||
url: "/"
|
||||
});
|
||||
|
||||
var router = mainView.router;
|
||||
|
||||
var NOTES = null;
|
||||
|
||||
var OFFLINE = false;
|
||||
|
||||
/**
|
||||
* Thanks to https://stackoverflow.com/a/13542669
|
||||
* @param {type} color
|
||||
* @param {type} percent
|
||||
* @returns {String}
|
||||
*/
|
||||
|
||||
function shadeColor2(color, percent) {
|
||||
var f = parseInt(color.slice(1), 16), t = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R = f >> 16, G = f >> 8 & 0x00FF, B = f & 0x0000FF;
|
||||
return "#" + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1);
|
||||
var f = parseInt(color.slice(1), 16),
|
||||
t = percent < 0 ? 0 : 255,
|
||||
p = percent < 0 ? percent * -1 : percent,
|
||||
R = f >> 16,
|
||||
G = f >> 8 & 0x00FF,
|
||||
B = f & 0x0000FF;
|
||||
return "#" + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1);
|
||||
}
|
||||
|
||||
function restartApplication() {
|
||||
window.location = "index.html";
|
||||
window.location = "index.html";
|
||||
}
|
||||
|
||||
router.on("pageInit", function (pagedata) {
|
||||
pagedata.$el.find('script').each(function (el) {
|
||||
if ($$(this).attr('src')) {
|
||||
var s = document.createElement('script');
|
||||
s.src = $$(this).attr('src');
|
||||
$$('head').append(s);
|
||||
} else {
|
||||
eval($$(this).text());
|
||||
}
|
||||
});
|
||||
switch (pagedata.name) {
|
||||
case "settings":
|
||||
updateSettingsData();
|
||||
break;
|
||||
pagedata.$el.find('script').each(function (el) {
|
||||
if ($$(this).attr('src')) {
|
||||
var s = document.createElement('script');
|
||||
s.src = $$(this).attr('src');
|
||||
$$('head').append(s);
|
||||
} else {
|
||||
eval($$(this).text());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
switch (pagedata.name) {
|
||||
case "settings":
|
||||
updateSettingsData();
|
||||
break;
|
||||
}
|
||||
}); // Run platform-specific setup code for Cordova or NW.js
|
||||
|
||||
// Run platform-specific setup code for Cordova or NW.js
|
||||
initPlatform();
|
||||
|
||||
|
||||
if (localStorage.getItem("configured") == null) {
|
||||
// Open the setup page
|
||||
router.navigate("/setup/0");
|
||||
// Open the setup page
|
||||
router.navigate("/setup/0");
|
||||
} else {
|
||||
createNotesObject(function (n) {
|
||||
NOTES = n;
|
||||
router.navigate("/home");
|
||||
});
|
||||
createNotesObject(function (n) {
|
||||
NOTES = n;
|
||||
router.navigate("/home");
|
||||
});
|
||||
}
|
@ -1,36 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function createNotesObject(callback) {
|
||||
if (localStorage.getItem("serverurl") == null) {
|
||||
if (localStorage.getItem("serverurl") == null) {
|
||||
callback(new Notes());
|
||||
} else {
|
||||
var checkurl = localStorage.getItem("serverurl") + "/api/ping";
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function beforeSend(xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(localStorage.getItem("username") + ":" + localStorage.getItem("password")));
|
||||
},
|
||||
success: function success(data) {
|
||||
if (data.status == "OK") {
|
||||
callback(new NotePostNotes(localStorage.getItem("serverurl"), localStorage.getItem("username"), localStorage.getItem("password")));
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
} else {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
}
|
||||
},
|
||||
error: function error() {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
} else {
|
||||
var checkurl = localStorage.getItem("serverurl") + "/api/ping";
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(localStorage.getItem("username") + ":" + localStorage.getItem("password")));
|
||||
}, success: function (data) {
|
||||
if (data.status == "OK") {
|
||||
callback(new NotePostNotes(localStorage.getItem("serverurl"), localStorage.getItem("username"), localStorage.getItem("password")));
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
} else {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
}
|
||||
}, error: function () {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,71 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
var platform_type = "";
|
||||
|
||||
var openBrowser = function (url) {
|
||||
|
||||
}
|
||||
var openBrowser = function openBrowser(url) {};
|
||||
|
||||
function initCordova() {
|
||||
platform_type = "cordova";
|
||||
platform_type = "cordova"; // Handle back button to close things
|
||||
|
||||
// Handle back button to close things
|
||||
document.addEventListener("backbutton", function (event) {
|
||||
router.navigate("/home");
|
||||
}, false);
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#D32F2F");
|
||||
StatusBar.styleLightContent();
|
||||
}
|
||||
}, false);
|
||||
|
||||
openBrowser = function (url) {
|
||||
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
||||
document.addEventListener("backbutton", function (event) {
|
||||
router.navigate("/home");
|
||||
}, false);
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#D32F2F");
|
||||
StatusBar.styleLightContent();
|
||||
}
|
||||
}, false);
|
||||
|
||||
openBrowser = function openBrowser(url) {
|
||||
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
||||
};
|
||||
}
|
||||
|
||||
function initNW() {
|
||||
platform_type = "nw";
|
||||
platform_type = "nw";
|
||||
|
||||
openBrowser = function (url) {
|
||||
nw.Window.open(url, {
|
||||
id: url
|
||||
}, function (browserwin) {
|
||||
// Add menubar so the user can navigate around if they click a link
|
||||
var browsermenu = new nw.Menu({type: 'menubar'});
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Back",
|
||||
click: function () {
|
||||
browserwin.window.history.back();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Forward",
|
||||
click: function () {
|
||||
browserwin.window.history.forward();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Home",
|
||||
click: function () {
|
||||
browserwin.window.location.href = url;
|
||||
}
|
||||
}));
|
||||
browserwin.menu = browsermenu;
|
||||
});
|
||||
}
|
||||
openBrowser = function openBrowser(url) {
|
||||
nw.Window.open(url, {
|
||||
id: url
|
||||
}, function (browserwin) {
|
||||
// Add menubar so the user can navigate around if they click a link
|
||||
var browsermenu = new nw.Menu({
|
||||
type: 'menubar'
|
||||
});
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Back",
|
||||
click: function click() {
|
||||
browserwin.window.history.back();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Forward",
|
||||
click: function click() {
|
||||
browserwin.window.history.forward();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Home",
|
||||
click: function click() {
|
||||
browserwin.window.location.href = url;
|
||||
}
|
||||
}));
|
||||
browserwin.menu = browsermenu;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function initPlatform() {
|
||||
if (typeof cordova !== 'undefined') {
|
||||
initCordova();
|
||||
} else if (typeof nw !== 'undefined') {
|
||||
initNW();
|
||||
}
|
||||
if (typeof cordova !== 'undefined') {
|
||||
initCordova();
|
||||
} else if (typeof nw !== 'undefined') {
|
||||
initNW();
|
||||
}
|
||||
}
|
166
www/js/setup1.js
166
www/js/setup1.js
@ -1,103 +1,109 @@
|
||||
"use strict";
|
||||
|
||||
require("core-js/modules/es6.regexp.replace");
|
||||
|
||||
require("core-js/modules/es6.string.starts-with");
|
||||
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
netsymscomurl = "https://apps.netsyms.com/notepost";
|
||||
netsymsbizurl = "https://BIZID.netsyms.biz/notepost";
|
||||
|
||||
|
||||
$('#use-security-checkbox-li').click(function () {
|
||||
// Event fires before the checkbox is changed, so we need to do the opposite
|
||||
if ($("#use-security").prop("checked")) {
|
||||
$('#protocol-select').text("https://");
|
||||
} else {
|
||||
$('#protocol-select').text("http://");
|
||||
}
|
||||
// Event fires before the checkbox is changed, so we need to do the opposite
|
||||
if ($("#use-security").prop("checked")) {
|
||||
$('#protocol-select').text("https://");
|
||||
} else {
|
||||
$('#protocol-select').text("http://");
|
||||
}
|
||||
});
|
||||
|
||||
/* Detect if the user typed "http[s]://" into the URL box and correct for it */
|
||||
$("#url").blur(function () {
|
||||
if ($('#url').val().toLowerCase().startsWith("https://")) {
|
||||
$('#url').val($('#url').val().replace(/https\:\/\//ig, ""));
|
||||
$('#protocol-select').text("https://");
|
||||
$('#use-security').prop('checked', true);
|
||||
} else if ($('#url').val().toLowerCase().startsWith("http://")) {
|
||||
$('#url').val($('#url').val().replace(/http\:\/\//ig, ""));
|
||||
$('#protocol-select').text("http://");
|
||||
$('#use-security').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#url").blur(function () {
|
||||
if ($('#url').val().toLowerCase().startsWith("https://")) {
|
||||
$('#url').val($('#url').val().replace(/https\:\/\//ig, ""));
|
||||
$('#protocol-select').text("https://");
|
||||
$('#use-security').prop('checked', true);
|
||||
} else if ($('#url').val().toLowerCase().startsWith("http://")) {
|
||||
$('#url').val($('#url').val().replace(/http\:\/\//ig, ""));
|
||||
$('#protocol-select').text("http://");
|
||||
$('#use-security').prop('checked', false);
|
||||
}
|
||||
});
|
||||
$('#username').on("keyup", function () {
|
||||
$('#username').val($('#username').val().toLowerCase());
|
||||
$('#username').val($('#username').val().toLowerCase());
|
||||
});
|
||||
|
||||
function checkAndSave(url, username, password, nextcloud) {
|
||||
app.preloader.show();
|
||||
app.preloader.show();
|
||||
|
||||
if (typeof nextcloud === 'undefined') {
|
||||
nextcloud = false;
|
||||
if (typeof nextcloud === 'undefined') {
|
||||
nextcloud = false;
|
||||
}
|
||||
|
||||
var checkurl = url + "/api/ping";
|
||||
|
||||
if (nextcloud) {// TODO
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function beforeSend(xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
|
||||
},
|
||||
success: function success(data) {
|
||||
app.preloader.hide();
|
||||
|
||||
if (data.status == "OK") {
|
||||
localStorage.setItem("username", username);
|
||||
localStorage.setItem("password", password);
|
||||
localStorage.setItem("serverurl", url);
|
||||
localStorage.setItem("configured", true); // Restart the app to re-read the config
|
||||
|
||||
restartApplication();
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
} else {
|
||||
app.dialog.alert("", "Error");
|
||||
}
|
||||
},
|
||||
error: function error() {
|
||||
app.preloader.hide();
|
||||
app.dialog.alert("Could not sign in. Check your credentials and connection.", "Error");
|
||||
}
|
||||
|
||||
var checkurl = url + "/api/ping";
|
||||
|
||||
if (nextcloud) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
|
||||
}, success: function (data) {
|
||||
app.preloader.hide();
|
||||
if (data.status == "OK") {
|
||||
localStorage.setItem("username", username);
|
||||
localStorage.setItem("password", password);
|
||||
localStorage.setItem("serverurl", url);
|
||||
localStorage.setItem("configured", true);
|
||||
// Restart the app to re-read the config
|
||||
restartApplication();
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
} else {
|
||||
app.dialog.alert("", "Error");
|
||||
}
|
||||
}, error: function () {
|
||||
app.preloader.hide();
|
||||
app.dialog.alert("Could not sign in. Check your credentials and connection.", "Error");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setupAccount() {
|
||||
var type = $("#accttype").val();
|
||||
var type = $("#accttype").val();
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
switch (type) {
|
||||
case "personal":
|
||||
checkAndSave(netsymscomurl, username, password);
|
||||
break;
|
||||
|
||||
switch (type) {
|
||||
case "personal":
|
||||
checkAndSave(netsymscomurl, username, password);
|
||||
break;
|
||||
case "business":
|
||||
var url = netsymsbizurl.replace("BIZID", $("#bizid").val());
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
case "selfhosted":
|
||||
if (/^(https?:\/\/)/.test($('#url').val())) {
|
||||
var url = $('#url').val();
|
||||
} else {
|
||||
var url = $('#protocol-select').text() + $('#url').val();
|
||||
}
|
||||
url = url.replace(/\/$/, ""); // Remove trailing slash
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
}
|
||||
case "business":
|
||||
var url = netsymsbizurl.replace("BIZID", $("#bizid").val());
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
|
||||
case "selfhosted":
|
||||
if (/^(https?:\/\/)/.test($('#url').val())) {
|
||||
var url = $('#url').val();
|
||||
} else {
|
||||
var url = $('#protocol-select').text() + $('#url').val();
|
||||
}
|
||||
|
||||
url = url.replace(/\/$/, ""); // Remove trailing slash
|
||||
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
}
|
||||
}
|
180
www/js_src/NotePostNotes.class.js
Normal file
180
www/js_src/NotePostNotes.class.js
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
class NotePostNotes extends Notes {
|
||||
constructor(server, username, password) {
|
||||
super();
|
||||
this.server = server;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
del(noteid, success, error) {
|
||||
super.del(noteid);
|
||||
var self = this;
|
||||
return $.ajax({
|
||||
url: this.server + "/api/deletenote",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: noteid
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
},
|
||||
success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
self.notes = val.notes;
|
||||
}
|
||||
|
||||
if (typeof success == 'function') {
|
||||
success();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
add(note, success, error) {
|
||||
note.norealid = true;
|
||||
this.saveNote(note, success, error);
|
||||
}
|
||||
|
||||
getNote(noteid, success, error) {
|
||||
return $.ajax({
|
||||
url: this.server + "/api/getnote",
|
||||
dataType: "json",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: noteid
|
||||
},
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
},
|
||||
success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
if (typeof success == 'function') {
|
||||
success(val.note);
|
||||
}
|
||||
} else {
|
||||
if (typeof error == 'function') {
|
||||
error(val.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
saveNote(note, success, error) {
|
||||
var self = this;
|
||||
var data = {
|
||||
text: note.content,
|
||||
color: note.color,
|
||||
modified: note.modified,
|
||||
favorite: note.favorite ? "1" : "0"
|
||||
}; // Don't send ID if it's a locally-made note
|
||||
|
||||
if (note.norealid != true) {
|
||||
data.id = note.noteid;
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
url: this.server + "/api/savenote",
|
||||
dataType: "json",
|
||||
method: "POST",
|
||||
data: data,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
},
|
||||
success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
if (typeof success == 'function') {
|
||||
success(val.note);
|
||||
}
|
||||
} else {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Sync notes with the NotePost server, resolving conflicts in the process.
|
||||
*
|
||||
* @param {function} success(notes) called when everything's synced up.
|
||||
* @param {function} error
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
sync(success, error) {
|
||||
super.sync();
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: this.server + "/api/getnotes",
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(self.username + ":" + self.password));
|
||||
},
|
||||
success: function (val) {
|
||||
if (val.status == "OK") {
|
||||
console.log("Comparing notes...");
|
||||
console.log("Local copy:", self.notes);
|
||||
console.log("Remote copy:", val.notes);
|
||||
var delta = getDelta(self.notes, val.notes);
|
||||
console.log("Comparison: ", delta);
|
||||
var notes = delta.noChange;
|
||||
notes = notes.concat(delta.addedRemote);
|
||||
notes = notes.concat(delta.changedRemote); // Sync locally-created or modified notes
|
||||
|
||||
var notesToUpload = delta.addedLocal;
|
||||
notesToUpload = notesToUpload.concat(delta.changedLocal);
|
||||
var addedOrChangedLocallyAjax = [];
|
||||
|
||||
for (var i = 0; i < notesToUpload.length; i++) {
|
||||
addedOrChangedLocallyAjax.push(self.saveNote(self.fix(notesToUpload[i]), function (n) {
|
||||
notes.push(n);
|
||||
}));
|
||||
}
|
||||
|
||||
$.when(addedOrChangedLocallyAjax).then(function () {
|
||||
self.notes = notes;
|
||||
self.fixAll();
|
||||
localStorage.setItem("notes", JSON.stringify(notes));
|
||||
console.log(JSON.parse(localStorage.getItem("notes")));
|
||||
|
||||
if (typeof success == 'function') {
|
||||
success(notes);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
if (typeof error == 'function') {
|
||||
error();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
167
www/js_src/Notes.class.js
Normal file
167
www/js_src/Notes.class.js
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
class Notes {
|
||||
constructor() {
|
||||
this.notes = [];
|
||||
}
|
||||
|
||||
get(noteid) {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid == noteid) {
|
||||
return this.notes[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getAll() {
|
||||
return this.notes;
|
||||
}
|
||||
|
||||
set(note) {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid == note.noteid) {
|
||||
// Refresh HTML rendering
|
||||
note.html = marked(note.content);
|
||||
this.notes[i] = note;
|
||||
this.save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.notes.push(note);
|
||||
this.save();
|
||||
}
|
||||
|
||||
del(noteid, success, error) {
|
||||
var newnotearr = [];
|
||||
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
if (this.notes[i].noteid != noteid) {
|
||||
newnotearr.push(this.notes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.notes = newnotearr;
|
||||
this.save();
|
||||
|
||||
if (typeof success == 'function') {
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
add(note, success, error) {
|
||||
var noteid = null;
|
||||
|
||||
do {
|
||||
noteid = Math.floor(Math.random() * (9999999999 - 1000000000) + 1000000000);
|
||||
console.log("Generating random note ID: " + noteid);
|
||||
} while (this.get(noteid) != null);
|
||||
|
||||
note["noteid"] = noteid;
|
||||
this.notes.push(note);
|
||||
this.save();
|
||||
|
||||
if (typeof success == 'function') {
|
||||
success(note);
|
||||
}
|
||||
}
|
||||
|
||||
fix(note) {
|
||||
if (typeof note.noteid !== 'number') {
|
||||
note.noteid = null;
|
||||
} // Set background color
|
||||
|
||||
|
||||
if (typeof note.color !== 'string') {
|
||||
note.color = "FFF59D";
|
||||
} // Set text color based on background
|
||||
|
||||
|
||||
if (typeof note.textcolor !== 'string') {
|
||||
var r = parseInt(note.color.substring(0, 2), 16);
|
||||
var g = parseInt(note.color.substring(2, 4), 16);
|
||||
var b = parseInt(note.color.substring(4, 6), 16);
|
||||
var contrast = Math.sqrt(r * r * 0.241 + g * g * 0.691 + b * b * 0.068);
|
||||
|
||||
if (contrast > 130) {
|
||||
note.textcolor = "000000";
|
||||
} else {
|
||||
note.textcolor = "FFFFFF";
|
||||
}
|
||||
} // Just in case
|
||||
|
||||
|
||||
if (typeof note.content !== 'string') {
|
||||
note.content = "";
|
||||
} // Set title
|
||||
|
||||
|
||||
if (typeof note.title !== 'string') {
|
||||
note.title = note.content.split('\n')[0].replace(/[#\-]+/gi, "").trim();
|
||||
}
|
||||
|
||||
if (typeof note.modified !== 'number') {
|
||||
note.modified = Math.round(new Date().getTime() / 1000);
|
||||
} // Render Markdown to HTML
|
||||
|
||||
|
||||
if (typeof note.html !== 'string') {
|
||||
note.html = marked(note.content);
|
||||
} // Save
|
||||
|
||||
|
||||
return note;
|
||||
}
|
||||
|
||||
fixAll() {
|
||||
for (var i = 0; i < this.notes.length; i++) {
|
||||
this.notes[i] = this.fix(this.notes[i]);
|
||||
}
|
||||
|
||||
this.save();
|
||||
}
|
||||
/**
|
||||
* Sync notes with the storage backend.
|
||||
*
|
||||
* @param {type} success
|
||||
* @param {type} error
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
sync(success, error) {
|
||||
if (localStorage.getItem("notes") !== null) {
|
||||
// There is localstorage
|
||||
var storage = JSON.parse(localStorage.getItem("notes"));
|
||||
console.log("Memory copy:", this.notes);
|
||||
console.log("Storage copy:", storage);
|
||||
var delta = getDelta(this.notes, storage);
|
||||
console.log("Comparison: ", delta);
|
||||
var notes = delta.noChange;
|
||||
notes = notes.concat(delta.addedRemote);
|
||||
notes = notes.concat(delta.changedRemote);
|
||||
notes = notes.concat(delta.addedLocal);
|
||||
notes = notes.concat(delta.changedLocal); // If localStorage is missing something, we still want it
|
||||
|
||||
notes = notes.concat(delta.deletedRemote);
|
||||
this.notes = notes;
|
||||
this.fixAll();
|
||||
}
|
||||
|
||||
this.save();
|
||||
|
||||
if (typeof success == 'function') {
|
||||
success(this.notes);
|
||||
}
|
||||
}
|
||||
|
||||
save() {
|
||||
localStorage.setItem("notes", JSON.stringify(this.notes));
|
||||
}
|
||||
|
||||
}
|
83
www/js_src/delta.js
Normal file
83
www/js_src/delta.js
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* The code in this file is by StackOverflow user Juan Mendes.
|
||||
* License: Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0).
|
||||
* Source: https://stackoverflow.com/a/14966749
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a map out of an array be choosing what property to key by
|
||||
* @param {object[]} array Array that will be converted into a map
|
||||
* @param {string} prop Name of property to key by
|
||||
* @return {object} The mapped array. Example:
|
||||
* mapFromArray([{a:1,b:2}, {a:3,b:4}], 'a')
|
||||
* returns {1: {a:1,b:2}, 3: {a:3,b:4}}
|
||||
*/
|
||||
function mapFromArray(array, prop) {
|
||||
var map = {};
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
map[ array[i][prop] ] = array[i];
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object[]} o old array of notes (local copy)
|
||||
* @param {object[]} n new array of notes (remote copy)
|
||||
* @param {object} An object with changes
|
||||
*/
|
||||
function getDelta(o, n) {
|
||||
var delta = {
|
||||
addedRemote: [],
|
||||
addedLocal: [],
|
||||
deletedRemote: [],
|
||||
deletedLocal: [],
|
||||
changedRemote: [],
|
||||
changedLocal: [],
|
||||
noChange: []
|
||||
};
|
||||
oSane = [];
|
||||
for (var i = 0; i < o.length; i++) {
|
||||
if (o[i].noteid == null) { // Note has no real `noteid`
|
||||
delta.addedLocal.push(o[i]);
|
||||
} else {
|
||||
oSane.push(o[i]);
|
||||
}
|
||||
}
|
||||
var local = mapFromArray(oSane, 'noteid');
|
||||
var remote = mapFromArray(n, 'noteid');
|
||||
|
||||
for (var id in local) {
|
||||
if (!remote.hasOwnProperty(id)) { // Notes that are only present locally
|
||||
delta.addedLocal.push(local[id]);
|
||||
// TODO: Figure out which notes were actually added locally and which were deleted on the server
|
||||
/*if (local[id].norealid) { // Note hasn't been synced to the remote yet
|
||||
delta.addedLocal.push(local[id]);
|
||||
} else { // Note has been synced to remote but isn't there anymore
|
||||
delta.deletedRemote.push(local[id]);
|
||||
}*/
|
||||
} else { // Notes that are present on both
|
||||
if (local[id].modified > remote[id].modified) { // Local copy is newer
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else if (local[id].modified < remote[id].modified) { // Remote copy is newer
|
||||
delta.changedRemote.push(remote[id]);
|
||||
} else { // Modified date is same, let's check content
|
||||
if (local[id].content == remote[id].content) {
|
||||
delta.noChange.push(local[id]);
|
||||
} else if (local[id].content.length > remote[id].content.length) {
|
||||
delta.changedLocal.push(local[id]);
|
||||
} else {
|
||||
delta.changedRemote.push(remote[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add notes that are only on the remote
|
||||
for (var id in remote) {
|
||||
if (!local.hasOwnProperty(id)) {
|
||||
delta.addedRemote.push(remote[id]);
|
||||
}
|
||||
}
|
||||
return delta;
|
||||
}
|
49
www/js_src/editnote.js
Normal file
49
www/js_src/editnote.js
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function saveme(callback) {
|
||||
function finishSave(note, callback) {
|
||||
NOTES.fixAll();
|
||||
NOTES.sync(function () {
|
||||
app.toast.create({
|
||||
text: 'Note saved.',
|
||||
closeTimeout: 2000
|
||||
}).open();
|
||||
$("#orig_content").val(note.content);
|
||||
});
|
||||
if (typeof callback == "function") {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
var noteid = $("#note_content").data("noteid");
|
||||
if (noteid == "") {
|
||||
var note = {
|
||||
content: $("#note_content").val(),
|
||||
modified: Math.round((new Date()).getTime() / 1000)
|
||||
};
|
||||
NOTES.add(note, function (n) {
|
||||
$("#note_content").data("noteid", n.noteid);
|
||||
finishSave(n, callback);
|
||||
});
|
||||
} else {
|
||||
var note = NOTES.get(noteid);
|
||||
note.content = $("#note_content").val();
|
||||
note.modified = Math.round((new Date()).getTime() / 1000);
|
||||
NOTES.set(note);
|
||||
finishSave(note, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function exiteditor() {
|
||||
if ($("#note_content").val() == "" || $("#note_content").val() === $("#orig_content").val()) {
|
||||
router.back({force: true, ignoreCache: true, reload: true});
|
||||
} else {
|
||||
saveme(function () {
|
||||
router.back({force: true, ignoreCache: true, reload: true});
|
||||
});
|
||||
}
|
||||
}
|
126
www/js_src/home.js
Normal file
126
www/js_src/home.js
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
$(".view-main").on("ptr:refresh", ".ptr-content", function () {
|
||||
restartApplication();
|
||||
});
|
||||
|
||||
function editNote(id) {
|
||||
var note = NOTES.get(id);
|
||||
router.navigate("/editnote", {
|
||||
context: {
|
||||
noteid: id,
|
||||
content: note.content,
|
||||
notetitle: note.title,
|
||||
}
|
||||
});
|
||||
console.log("Editing " + id);
|
||||
}
|
||||
|
||||
function favoriteNote(id) {
|
||||
|
||||
}
|
||||
|
||||
function makeList(id) {
|
||||
|
||||
}
|
||||
|
||||
function deleteNote(id) {
|
||||
app.dialog.confirm('Are you sure?', 'Delete Note', function () {
|
||||
NOTES.del(id, function () {
|
||||
app.ptr.refresh();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("#app").on("click", ".edit-note-btn", function () {
|
||||
editNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".favorite-note-btn", function () {
|
||||
favoriteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".listify-note-btn", function () {
|
||||
makeList($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
$("#app").on("click", ".delete-note-btn", function () {
|
||||
deleteNote($(this).data("note"));
|
||||
app.popover.close();
|
||||
});
|
||||
|
||||
function openNoteActionMenu(notecard) {
|
||||
var noteid = notecard.data("id");
|
||||
if (window.innerWidth < 768) {
|
||||
var actionsheet = app.actions.create({
|
||||
buttons: [
|
||||
{
|
||||
text: "Edit",
|
||||
bold: true,
|
||||
icon: '<i class="fas fa-edit fa-fw"></i>',
|
||||
onClick: function () {
|
||||
editNote(noteid);
|
||||
}
|
||||
},
|
||||
// {
|
||||
// text: "Favorite",
|
||||
// icon: '<i class="fas fa-star fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// favoriteNote(noteid);
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// text: "Make a List",
|
||||
// icon: '<i class="fas fa-tasks fa-fw"></i>',
|
||||
// onClick: function () {
|
||||
// makeList(noteid);
|
||||
// }
|
||||
// },
|
||||
{
|
||||
text: "Delete",
|
||||
icon: '<i class="fas fa-trash fa-fw"></i>',
|
||||
onClick: function () {
|
||||
deleteNote(noteid);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
actionsheet.open();
|
||||
return false;
|
||||
} else {
|
||||
var contextPopover = app.popover.create({
|
||||
targetEl: notecard.children(".menubtn"),
|
||||
content: '<div class="popover">' +
|
||||
'<div class="popover-inner">' +
|
||||
'<div class="list">' +
|
||||
'<ul>' +
|
||||
'<li><a class="list-button item-link edit-note-btn" data-note="' + noteid + '"><i class="fas fa-edit fa-fw"></i> Edit</a></li>' +
|
||||
'<li><a class="list-button item-link favorite-note-btn" data-note="' + noteid + '"><i class="fas fa-star fa-fw"></i> Favorite</a></li>' +
|
||||
'<li><a class="list-button item-link listify-note-btn" data-note="' + noteid + '"><i class="fas fa-tasks fa-fw"></i> Make a List</a></li>' +
|
||||
'<li><a class="list-button item-link delete-note-btn" data-note="' + noteid + '"><i class="fas fa-trash fa-fw"></i> Delete</a></li>' +
|
||||
'</ul>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
});
|
||||
contextPopover.open();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$(".view-main").on("click", ".notecard .menubtn", function () {
|
||||
return openNoteActionMenu($(this).parent());
|
||||
});
|
||||
|
||||
$(".view-main").on("contextmenu", ".notecard", function () {
|
||||
return openNoteActionMenu($(this));
|
||||
});
|
70
www/js_src/main.js
Normal file
70
www/js_src/main.js
Normal file
@ -0,0 +1,70 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var $$ = Dom7;
|
||||
|
||||
var app = new Framework7({
|
||||
root: "#app",
|
||||
name: "NotePost",
|
||||
id: "com.netsyms.NotePostApp",
|
||||
init: true,
|
||||
initOnDeviceReady: false,
|
||||
routes: routes
|
||||
});
|
||||
|
||||
var mainView = app.views.create('.view-main', {
|
||||
url: "/"
|
||||
});
|
||||
|
||||
var router = mainView.router;
|
||||
|
||||
var NOTES = null;
|
||||
|
||||
var OFFLINE = false;
|
||||
|
||||
/**
|
||||
* Thanks to https://stackoverflow.com/a/13542669
|
||||
* @param {type} color
|
||||
* @param {type} percent
|
||||
* @returns {String}
|
||||
*/
|
||||
function shadeColor2(color, percent) {
|
||||
var f = parseInt(color.slice(1), 16), t = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent, R = f >> 16, G = f >> 8 & 0x00FF, B = f & 0x0000FF;
|
||||
return "#" + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1);
|
||||
}
|
||||
|
||||
function restartApplication() {
|
||||
window.location = "index.html";
|
||||
}
|
||||
|
||||
router.on("pageInit", function (pagedata) {
|
||||
pagedata.$el.find('script').each(function (el) {
|
||||
if ($$(this).attr('src')) {
|
||||
var s = document.createElement('script');
|
||||
s.src = $$(this).attr('src');
|
||||
$$('head').append(s);
|
||||
} else {
|
||||
eval($$(this).text());
|
||||
}
|
||||
});
|
||||
switch (pagedata.name) {
|
||||
case "settings":
|
||||
updateSettingsData();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// Run platform-specific setup code for Cordova or NW.js
|
||||
initPlatform();
|
||||
|
||||
|
||||
if (localStorage.getItem("configured") == null) {
|
||||
// Open the setup page
|
||||
router.navigate("/setup/0");
|
||||
} else {
|
||||
createNotesObject(function (n) {
|
||||
NOTES = n;
|
||||
router.navigate("/home");
|
||||
});
|
||||
}
|
36
www/js_src/notes.js
Normal file
36
www/js_src/notes.js
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
function createNotesObject(callback) {
|
||||
if (localStorage.getItem("serverurl") == null) {
|
||||
callback(new Notes());
|
||||
} else {
|
||||
var checkurl = localStorage.getItem("serverurl") + "/api/ping";
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(localStorage.getItem("username") + ":" + localStorage.getItem("password")));
|
||||
}, success: function (data) {
|
||||
if (data.status == "OK") {
|
||||
callback(new NotePostNotes(localStorage.getItem("serverurl"), localStorage.getItem("username"), localStorage.getItem("password")));
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
} else {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
}
|
||||
}, error: function () {
|
||||
OFFLINE = true;
|
||||
callback(new Notes());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
71
www/js_src/platform.js
Normal file
71
www/js_src/platform.js
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
var platform_type = "";
|
||||
|
||||
var openBrowser = function (url) {
|
||||
|
||||
}
|
||||
|
||||
function initCordova() {
|
||||
platform_type = "cordova";
|
||||
|
||||
// Handle back button to close things
|
||||
document.addEventListener("backbutton", function (event) {
|
||||
router.navigate("/home");
|
||||
}, false);
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#D32F2F");
|
||||
StatusBar.styleLightContent();
|
||||
}
|
||||
}, false);
|
||||
|
||||
openBrowser = function (url) {
|
||||
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
||||
}
|
||||
}
|
||||
|
||||
function initNW() {
|
||||
platform_type = "nw";
|
||||
|
||||
openBrowser = function (url) {
|
||||
nw.Window.open(url, {
|
||||
id: url
|
||||
}, function (browserwin) {
|
||||
// Add menubar so the user can navigate around if they click a link
|
||||
var browsermenu = new nw.Menu({type: 'menubar'});
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Back",
|
||||
click: function () {
|
||||
browserwin.window.history.back();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Forward",
|
||||
click: function () {
|
||||
browserwin.window.history.forward();
|
||||
}
|
||||
}));
|
||||
browsermenu.append(new nw.MenuItem({
|
||||
label: "Home",
|
||||
click: function () {
|
||||
browserwin.window.location.href = url;
|
||||
}
|
||||
}));
|
||||
browserwin.menu = browsermenu;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initPlatform() {
|
||||
if (typeof cordova !== 'undefined') {
|
||||
initCordova();
|
||||
} else if (typeof nw !== 'undefined') {
|
||||
initNW();
|
||||
}
|
||||
}
|
103
www/js_src/setup1.js
Normal file
103
www/js_src/setup1.js
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
netsymscomurl = "https://apps.netsyms.com/notepost";
|
||||
netsymsbizurl = "https://BIZID.netsyms.biz/notepost";
|
||||
|
||||
|
||||
$('#use-security-checkbox-li').click(function () {
|
||||
// Event fires before the checkbox is changed, so we need to do the opposite
|
||||
if ($("#use-security").prop("checked")) {
|
||||
$('#protocol-select').text("https://");
|
||||
} else {
|
||||
$('#protocol-select').text("http://");
|
||||
}
|
||||
});
|
||||
|
||||
/* Detect if the user typed "http[s]://" into the URL box and correct for it */
|
||||
$("#url").blur(function () {
|
||||
if ($('#url').val().toLowerCase().startsWith("https://")) {
|
||||
$('#url').val($('#url').val().replace(/https\:\/\//ig, ""));
|
||||
$('#protocol-select').text("https://");
|
||||
$('#use-security').prop('checked', true);
|
||||
} else if ($('#url').val().toLowerCase().startsWith("http://")) {
|
||||
$('#url').val($('#url').val().replace(/http\:\/\//ig, ""));
|
||||
$('#protocol-select').text("http://");
|
||||
$('#use-security').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#username').on("keyup", function () {
|
||||
$('#username').val($('#username').val().toLowerCase());
|
||||
});
|
||||
|
||||
function checkAndSave(url, username, password, nextcloud) {
|
||||
app.preloader.show();
|
||||
|
||||
if (typeof nextcloud === 'undefined') {
|
||||
nextcloud = false;
|
||||
}
|
||||
|
||||
var checkurl = url + "/api/ping";
|
||||
|
||||
if (nextcloud) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: checkurl,
|
||||
dataType: "json",
|
||||
cache: false,
|
||||
method: "POST",
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password));
|
||||
}, success: function (data) {
|
||||
app.preloader.hide();
|
||||
if (data.status == "OK") {
|
||||
localStorage.setItem("username", username);
|
||||
localStorage.setItem("password", password);
|
||||
localStorage.setItem("serverurl", url);
|
||||
localStorage.setItem("configured", true);
|
||||
// Restart the app to re-read the config
|
||||
restartApplication();
|
||||
} else if (data.status == "ERROR") {
|
||||
app.dialog.alert(data.msg, "Error");
|
||||
} else {
|
||||
app.dialog.alert("", "Error");
|
||||
}
|
||||
}, error: function () {
|
||||
app.preloader.hide();
|
||||
app.dialog.alert("Could not sign in. Check your credentials and connection.", "Error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setupAccount() {
|
||||
var type = $("#accttype").val();
|
||||
|
||||
var username = $("#username").val();
|
||||
var password = $("#password").val();
|
||||
|
||||
switch (type) {
|
||||
case "personal":
|
||||
checkAndSave(netsymscomurl, username, password);
|
||||
break;
|
||||
case "business":
|
||||
var url = netsymsbizurl.replace("BIZID", $("#bizid").val());
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
case "selfhosted":
|
||||
if (/^(https?:\/\/)/.test($('#url').val())) {
|
||||
var url = $('#url').val();
|
||||
} else {
|
||||
var url = $('#protocol-select').text() + $('#url').val();
|
||||
}
|
||||
url = url.replace(/\/$/, ""); // Remove trailing slash
|
||||
checkAndSave(url, username, password);
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,16 +1,25 @@
|
||||
{
|
||||
"name": "com.netsyms.NotePostApp",
|
||||
"scripts": {
|
||||
"build": "babel js_src -d js"
|
||||
},
|
||||
"displayName": "NotePost",
|
||||
"version": "1.0.0",
|
||||
"description": "A cross-platform client app for NotePost.",
|
||||
"author": "Netsyms Technologies",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@fortawesome/fontawesome-free": "^5.6.3",
|
||||
"easymde": "^2.4.2",
|
||||
"framework7": "^3.6.5",
|
||||
"jquery": "^3.3.1",
|
||||
"marked": "^0.6.0",
|
||||
"shufflejs": "^5.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.2.2",
|
||||
"@babel/preset-env": "^7.2.3"
|
||||
}
|
||||
}
|
||||
|
2083
www/yarn.lock
2083
www/yarn.lock
File diff suppressed because it is too large
Load Diff
142
yarn.lock
142
yarn.lock
@ -2,12 +2,12 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
abbrev@*, abbrev@1:
|
||||
abbrev@1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
|
||||
|
||||
accepts@*, accepts@~1.3.4, accepts@~1.3.5:
|
||||
accepts@~1.3.4, accepts@~1.3.5:
|
||||
version "1.3.5"
|
||||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2"
|
||||
integrity sha1-63d99gEXI6OxTopywIBcjoZ0a9I=
|
||||
@ -32,7 +32,7 @@ ansi-styles@2.2.1, ansi-styles@^2.2.1:
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
||||
integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
|
||||
|
||||
ansi@*, ansi@^0.3.1:
|
||||
ansi@^0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi/-/ansi-0.3.1.tgz#0c42d4fb17160d5a9af1e484bace1c66922c1b21"
|
||||
integrity sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=
|
||||
@ -42,7 +42,7 @@ array-flatten@1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
||||
integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=
|
||||
|
||||
balanced-match@*, balanced-match@^1.0.0:
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
|
||||
@ -52,16 +52,16 @@ base64-js@1.2.0:
|
||||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1"
|
||||
integrity sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=
|
||||
|
||||
big-integer@*, big-integer@^1.6.7:
|
||||
version "1.6.40"
|
||||
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.40.tgz#02e4cd4d6e266c4d9ece2469c05cb6439149fc78"
|
||||
integrity sha512-CjhtJp0BViLzP1ZkEnoywjgtFQXS2pomKjAJtIISTCnuHILkLcAXLdFLG/nxsHc4s9kJfc+82Xpg8WNyhfACzQ==
|
||||
|
||||
big-integer@1.6.32:
|
||||
version "1.6.32"
|
||||
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.32.tgz#5867458b25ecd5bcb36b627c30bb501a13c07e89"
|
||||
integrity sha512-ljKJdR3wk9thHfLj4DtrNiOSTxvGFaMjWrG4pW75juXC4j7+XuKJVFdg4kgFMYp85PVkO05dFMj2dk2xVsH4xw==
|
||||
|
||||
big-integer@^1.6.7:
|
||||
version "1.6.40"
|
||||
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.40.tgz#02e4cd4d6e266c4d9ece2469c05cb6439149fc78"
|
||||
integrity sha512-CjhtJp0BViLzP1ZkEnoywjgtFQXS2pomKjAJtIISTCnuHILkLcAXLdFLG/nxsHc4s9kJfc+82Xpg8WNyhfACzQ==
|
||||
|
||||
body-parser@1.18.2:
|
||||
version "1.18.2"
|
||||
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454"
|
||||
@ -94,14 +94,14 @@ body-parser@1.18.3:
|
||||
raw-body "2.3.3"
|
||||
type-is "~1.6.16"
|
||||
|
||||
bplist-parser@*, bplist-parser@^0.1.0:
|
||||
bplist-parser@^0.1.0:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.1.1.tgz#d60d5dcc20cba6dc7e1f299b35d3e1f95dafbae6"
|
||||
integrity sha1-1g1dzCDLptx+HymbNdPh+V2vuuY=
|
||||
dependencies:
|
||||
big-integer "^1.6.7"
|
||||
|
||||
brace-expansion@*, brace-expansion@^1.1.7:
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
|
||||
@ -109,7 +109,7 @@ brace-expansion@*, brace-expansion@^1.1.7:
|
||||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
bytes@*, bytes@3.0.0:
|
||||
bytes@3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
|
||||
integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=
|
||||
@ -125,7 +125,7 @@ chalk@1.1.3, chalk@^1.1.1:
|
||||
strip-ansi "^3.0.0"
|
||||
supports-color "^2.0.0"
|
||||
|
||||
compressible@*, compressible@~2.0.13, compressible@~2.0.14:
|
||||
compressible@~2.0.13, compressible@~2.0.14:
|
||||
version "2.0.15"
|
||||
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.15.tgz#857a9ab0a7e5a07d8d837ed43fe2defff64fe212"
|
||||
integrity sha512-4aE67DL33dSW9gw4CI2H/yTxqHLNcxp0yS6jB+4h+wr3e43+1z7vm0HU9qXOH8j+qjKuL8+UtkOxYQSMq60Ylw==
|
||||
@ -158,24 +158,17 @@ compression@^1.6.0:
|
||||
safe-buffer "5.1.2"
|
||||
vary "~1.1.2"
|
||||
|
||||
concat-map@*, concat-map@0.0.1:
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
content-disposition@*:
|
||||
version "0.5.3"
|
||||
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
|
||||
integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==
|
||||
dependencies:
|
||||
safe-buffer "5.1.2"
|
||||
|
||||
content-disposition@0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4"
|
||||
integrity sha1-DPaLud318r55YcOoUXjLhdunjLQ=
|
||||
|
||||
content-type@*, content-type@~1.0.4:
|
||||
content-type@~1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
|
||||
integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==
|
||||
@ -185,7 +178,7 @@ cookie-signature@1.0.6:
|
||||
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
|
||||
integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw=
|
||||
|
||||
cookie@*, cookie@0.3.1:
|
||||
cookie@0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
|
||||
integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
|
||||
@ -278,6 +271,11 @@ cordova-plugin-headercolor@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/cordova-plugin-headercolor/-/cordova-plugin-headercolor-1.0.0.tgz#020acd943787ee039d67f679e8d9ea6d38920316"
|
||||
integrity sha1-AgrNlDeH7gOdZ/Z56NnqbTiSAxY=
|
||||
|
||||
cordova-plugin-inappbrowser@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cordova-plugin-inappbrowser/-/cordova-plugin-inappbrowser-3.0.0.tgz#d4ae00d36676210751057ad258ae4ad4a9161ada"
|
||||
integrity sha1-1K4A02Z2IQdRBXrSWK5K1KkWGto=
|
||||
|
||||
cordova-plugin-statusbar@^2.4.2:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.4.2.tgz#fc1fbdc0d8d7033a7e8e1f1f7ff167ac9bd4faf6"
|
||||
@ -288,7 +286,7 @@ cordova-plugin-whitelist@^1.3.3:
|
||||
resolved "https://registry.yarnpkg.com/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.3.tgz#b5e85ecdbbfe5aeded40a1bf4ee2372e67d96fb4"
|
||||
integrity sha1-tehezbv+Wu3tQKG/TuI3LmfZb7Q=
|
||||
|
||||
cordova-registry-mapper@*, cordova-registry-mapper@^1.1.8:
|
||||
cordova-registry-mapper@^1.1.8:
|
||||
version "1.1.15"
|
||||
resolved "https://registry.yarnpkg.com/cordova-registry-mapper/-/cordova-registry-mapper-1.1.15.tgz#e244b9185b8175473bff6079324905115f83dc7c"
|
||||
integrity sha1-4kS5GFuBdUc7/2B5MkkFEV+D3Hw=
|
||||
@ -311,11 +309,6 @@ debug@2.6.9:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
depd@*:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
|
||||
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
|
||||
|
||||
depd@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359"
|
||||
@ -326,12 +319,12 @@ depd@~1.1.1, depd@~1.1.2:
|
||||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
|
||||
integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=
|
||||
|
||||
destroy@*, destroy@~1.0.4:
|
||||
destroy@~1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
|
||||
integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=
|
||||
|
||||
ee-first@*, ee-first@1.1.1:
|
||||
ee-first@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
|
||||
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
|
||||
@ -343,27 +336,27 @@ elementtree@0.1.6:
|
||||
dependencies:
|
||||
sax "0.3.5"
|
||||
|
||||
encodeurl@*, encodeurl@~1.0.2:
|
||||
encodeurl@~1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
|
||||
|
||||
escape-html@*, escape-html@~1.0.3:
|
||||
escape-html@~1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
|
||||
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
|
||||
|
||||
escape-string-regexp@*, escape-string-regexp@^1.0.2:
|
||||
escape-string-regexp@^1.0.2:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||
|
||||
etag@*, etag@~1.8.1:
|
||||
etag@~1.8.1:
|
||||
version "1.8.1"
|
||||
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
|
||||
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
|
||||
|
||||
express@*, express@^4.13.3:
|
||||
express@^4.13.3:
|
||||
version "4.16.4"
|
||||
resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e"
|
||||
integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==
|
||||
@ -399,7 +392,7 @@ express@*, express@^4.13.3:
|
||||
utils-merge "1.0.1"
|
||||
vary "~1.1.2"
|
||||
|
||||
finalhandler@*, finalhandler@1.1.1:
|
||||
finalhandler@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105"
|
||||
integrity sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==
|
||||
@ -412,12 +405,12 @@ finalhandler@*, finalhandler@1.1.1:
|
||||
statuses "~1.4.0"
|
||||
unpipe "~1.0.0"
|
||||
|
||||
forwarded@*, forwarded@~0.1.2:
|
||||
forwarded@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
|
||||
integrity sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=
|
||||
|
||||
fresh@*, fresh@0.5.2:
|
||||
fresh@0.5.2:
|
||||
version "0.5.2"
|
||||
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
|
||||
integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=
|
||||
@ -472,7 +465,7 @@ iconv-lite@0.4.23:
|
||||
dependencies:
|
||||
safer-buffer ">= 2.1.2 < 3"
|
||||
|
||||
inflight@*, inflight@^1.0.4:
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
|
||||
@ -480,7 +473,7 @@ inflight@*, inflight@^1.0.4:
|
||||
once "^1.3.0"
|
||||
wrappy "1"
|
||||
|
||||
inherits@*, inherits@2, inherits@2.0.3:
|
||||
inherits@2, inherits@2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
|
||||
@ -495,27 +488,22 @@ ipaddr.js@1.8.0:
|
||||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e"
|
||||
integrity sha1-6qM9bd16zo9/b+DJygRA5wZzix4=
|
||||
|
||||
is-wsl@*, is-wsl@^1.1.0:
|
||||
is-wsl@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
|
||||
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=
|
||||
|
||||
media-typer@*:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.0.1.tgz#e39d677e19a011c52d2681f430d1adafb299dd41"
|
||||
integrity sha512-v42gdPIuqYCoDVH5OiaKsVrv6aJqdMWJzl8KCyDs/KeDyBveYp3Wxq4UWJfsWjkSZUNC0xlLfDlLCPa1h/oo+g==
|
||||
|
||||
media-typer@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
|
||||
|
||||
merge-descriptors@*, merge-descriptors@1.0.1:
|
||||
merge-descriptors@1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
|
||||
integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=
|
||||
|
||||
methods@*, methods@~1.1.2:
|
||||
methods@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
|
||||
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
|
||||
@ -549,7 +537,7 @@ mime@1.4.1:
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
|
||||
integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==
|
||||
|
||||
minimatch@*, "minimatch@2 || 3", minimatch@^3.0.0:
|
||||
"minimatch@2 || 3", minimatch@^3.0.0:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
|
||||
@ -561,7 +549,7 @@ ms@2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||
|
||||
negotiator@*, negotiator@0.6.1:
|
||||
negotiator@0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
|
||||
integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=
|
||||
@ -580,42 +568,37 @@ nopt@3.0.6:
|
||||
dependencies:
|
||||
abbrev "1"
|
||||
|
||||
on-finished@*, on-finished@~2.3.0:
|
||||
on-finished@~2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
|
||||
integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=
|
||||
dependencies:
|
||||
ee-first "1.1.1"
|
||||
|
||||
on-headers@*, on-headers@~1.0.1:
|
||||
on-headers@~1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7"
|
||||
integrity sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=
|
||||
|
||||
once@*, once@^1.3.0:
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
opn@*, opn@^5.3.0:
|
||||
opn@^5.3.0:
|
||||
version "5.4.0"
|
||||
resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035"
|
||||
integrity sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==
|
||||
dependencies:
|
||||
is-wsl "^1.1.0"
|
||||
|
||||
parseurl@*, parseurl@~1.3.2:
|
||||
parseurl@~1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3"
|
||||
integrity sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=
|
||||
|
||||
path-is-absolute@*:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-2.0.0.tgz#cba416f4f3be5d068afe2083d9b3b3707414533d"
|
||||
integrity sha512-ajROpjq1SLxJZsgSVCcVIt+ZebVH+PwJtPnVESjfg6JKwJGwAgHRC3zIcjvI0LnecjIHCJhtfNZ/Y/RregqyXg==
|
||||
|
||||
path-is-absolute@1.0.1, path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
@ -656,16 +639,16 @@ proxy-addr@~2.0.4:
|
||||
forwarded "~0.1.2"
|
||||
ipaddr.js "1.8.0"
|
||||
|
||||
q@*, q@^1.4.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
||||
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
|
||||
|
||||
q@1.4.1:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
|
||||
integrity sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=
|
||||
|
||||
q@^1.4.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
||||
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
|
||||
|
||||
qs@6.5.1:
|
||||
version "6.5.1"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8"
|
||||
@ -676,7 +659,7 @@ qs@6.5.2:
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
|
||||
|
||||
range-parser@*, range-parser@~1.2.0:
|
||||
range-parser@~1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
|
||||
integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=
|
||||
@ -731,7 +714,7 @@ semver@^5.4.1:
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
|
||||
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
|
||||
|
||||
send@*, send@0.16.2:
|
||||
send@0.16.2:
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1"
|
||||
integrity sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==
|
||||
@ -750,7 +733,7 @@ send@*, send@0.16.2:
|
||||
range-parser "~1.2.0"
|
||||
statuses "~1.4.0"
|
||||
|
||||
serve-static@*, serve-static@1.13.2:
|
||||
serve-static@1.13.2:
|
||||
version "1.13.2"
|
||||
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1"
|
||||
integrity sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==
|
||||
@ -760,11 +743,6 @@ serve-static@*, serve-static@1.13.2:
|
||||
parseurl "~1.3.2"
|
||||
send "0.16.2"
|
||||
|
||||
setprototypeof@*:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
|
||||
integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==
|
||||
|
||||
setprototypeof@1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04"
|
||||
@ -802,7 +780,7 @@ supports-color@2.0.0, supports-color@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
|
||||
|
||||
type-is@*, type-is@~1.6.15, type-is@~1.6.16:
|
||||
type-is@~1.6.15, type-is@~1.6.16:
|
||||
version "1.6.16"
|
||||
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194"
|
||||
integrity sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==
|
||||
@ -810,32 +788,32 @@ type-is@*, type-is@~1.6.15, type-is@~1.6.16:
|
||||
media-typer "0.3.0"
|
||||
mime-types "~2.1.18"
|
||||
|
||||
underscore@*, underscore@^1.8.3:
|
||||
underscore@^1.8.3:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961"
|
||||
integrity sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==
|
||||
|
||||
unorm@*, unorm@^1.3.3:
|
||||
unorm@^1.3.3:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.4.1.tgz#364200d5f13646ca8bcd44490271335614792300"
|
||||
integrity sha1-NkIA1fE2RsqLzURJAnEzVhR5IwA=
|
||||
|
||||
unpipe@*, unpipe@1.0.0, unpipe@~1.0.0:
|
||||
unpipe@1.0.0, unpipe@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
|
||||
integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=
|
||||
|
||||
utils-merge@*, utils-merge@1.0.1:
|
||||
utils-merge@1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
|
||||
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
|
||||
|
||||
vary@*, vary@~1.1.2:
|
||||
vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
|
||||
|
||||
wrappy@*, wrappy@1:
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||
@ -845,7 +823,7 @@ xmlbuilder@8.2.2:
|
||||
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-8.2.2.tgz#69248673410b4ba42e1a6136551d2922335aa773"
|
||||
integrity sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=
|
||||
|
||||
xmldom@*, xmldom@0.1.x:
|
||||
xmldom@0.1.x:
|
||||
version "0.1.27"
|
||||
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9"
|
||||
integrity sha1-1QH5ezvbQDr4757MIFcxh6rawOk=
|
||||
|
Loading…
x
Reference in New Issue
Block a user