Skip to content

Commit

Permalink
Improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Nov 17, 2020
1 parent 750643e commit 72fc5c6
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 91 deletions.
2 changes: 2 additions & 0 deletions README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

Далее зайдите в Safari, на мобильном устройстве и введите там "http://IP:735/webapp", где IP это зарезервированный постоянный IP вашего компьютера. Далее нужно нажать "Поделиться" -> "На экран Домой". На рабочем столе появится ярлык для EasyNotes.


Для обновления нужно синхронизироваться, далее зайти в настройки "Safari" и удалить историю и данные, после чего можно заново добавлять приложение.
### Android
Установите "EasyNotes.apk" и введите зарезервированный постоянный IP вашего компьютера.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ For iOS 12 and above, go to Settings -> Safari -> Advanced -> Experimental Featu

Next, go to Safari on your mobile device and enter there "http://IP:735/webapp", where IP is the reserved permanent IP of your computer. Next you need to click "Share" -> "On the Home Screen". A shortcut to EasyNotes appears on the desktop.


To update, you need to synchronize, then go to the "Safari" settings and delete history and data, after which you can add the application again.
### Android
Install "EasyNotes.apk" and enter the reserved permanent IP of your computer.

Expand Down
8 changes: 4 additions & 4 deletions Source/Android/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.r57zone.easynotes"
versionCode = "13"
version = "0.8.6" >
versionCode = "14"
version = "0.8.7" >

<!-- versionCode is optional and Android only -->
<name>EasyNotes</name>
Expand All @@ -18,8 +18,8 @@
<access origin="*" />

<preference name="android-minSdkVersion" value="21" />
<preference name="android-targetSdkVersion" value="26" />
<preference name="android-targetSdkVersion" value="26" />

<plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
<plugin name="cordova-plugin-whitelist" source="npm" spec="*" />

</widget>
78 changes: 48 additions & 30 deletions Source/Android/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
<!DOCTYPE html>
<html>
<html manifest="app.manifest">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EasyNotes</title>
<meta name="apple-mobile-web-app-title" content="EasyNotes">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, viewport-fit=cover" />
<meta name="apple-mobile-web-app-capable" content="yes">
<!--<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />-->
<!--<link rel="stylesheet" href="all.css">-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="apple-touch-icon" href="icons/Icon-76.png">
<link rel="apple-touch-icon" sizes="57x57" href="icons/Icon-57.png">
<link rel="apple-touch-icon" sizes="60x60" href="icons/Icon-60.png">
<link rel="apple-touch-icon" sizes="72x72" href="icons/Icon-60.png">
<link rel="apple-touch-icon" sizes="76x76" href="icons/Icon-76.png">
<link rel="apple-touch-icon" sizes="114x114" href="icons/Icon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="icons/Icon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="icons/Icon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="icons/Icon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="icons/Icon-180x180.png">
<link rel="apple-touch-startup-image" href="images/launch.png">
<style type="text/css">
html,body{padding:0;margin:0; }
html,body{padding:0;margin:0;}
body{font-family: Arial, sans-serif; font-size:16px; color:#333; background-color:#f8f8f8; -webkit-user-select:none; -webkit-tap-highlight-color:transparent;}
a{text-decoration:none; font-weight:bold; color:gray;}
#wrapper{position:absolute; width:100%; height:100%;}
Expand All @@ -33,14 +48,15 @@
#meta #DaysAgo{margin-left:12px;}
#meta #DateNote{margin-right:12px;}

#editor #memo{display:block; width:calc(100% - 24px); height:calc(100% - 45px); padding:4px 12px 4px 12px; background-color:transparent; border:none;}
#editor #memo{display:block; width:calc(100% - 24px); height:calc(100% - 45px); padding:4px 0; margin:0 auto; background-color:transparent; border:none;}
textarea{font-weight:normal; font-size:17px; font-family: Arial, sans-serif; color:#333; overflow-y:auto; -webkit-overflow-scrolling:touch; border-radius:0; -webkit-tap-highlight-color:rgba(0,0,0,0);}
textarea:focus{outline:none;}
#sub-panel{display:flex; flex-direction:row; justify-content:space-between; align-items:center; height:45px; overflow:hidden; background-color:#e7e7e7; text-align:center; cursor:default;}

/* Settings */
#settings{display:none; width:100%; height:100%;}
#settings #page{height:calc(100% - 45px); overflow-y:auto; -webkit-overflow-scrolling:touch;}
#settings #page #items:first-child{margin-top:3px;}
#settings #items{padding:10px 0; margin:0 auto; width:92%; overflow:hidden; font-size:14px;}
#settings #items #item{display:flex; flex-direction:row; justify-content:space-between; align-items:center; text-overflow:ellipsis; overflow:hidden; white-space:nowrap; border:1px solid #dbdbdb; padding:14px 8px; background-color:#fff; border-top:none; color:black;}
#settings #items #item:first-child{border-top-left-radius:15px; border-top-right-radius:15px; border:1px solid #dbdbdb;}
Expand All @@ -59,8 +75,6 @@
#notification{position:absolute; bottom:0; width:100%; padding: 15px 0; visibility:hidden; font-size:14px; background-color:#e7e7e7; text-align:center; border-top:1px solid #bdbdbd;}
#notification.show{visibility:visible; animation:fadein 0.5s, fadeout 0.5s 3s;}
@keyframes fadein{from {opacity: 0;} to {opacity: 1;}}
@keyframes fadein{from {opacity: 0;} to {opacity: 1;}}
@keyframes fadeout{from {opacity: 1;} to {opacity: 0;}}
@keyframes fadeout{from {opacity: 1;} to {opacity: 0;}}

#sync-progress{display:none; position:absolute; bottom:0; width:100%; height:4px; background-color:blue; background:linear-gradient(to left, transparent, transparent, #23A6D5, transparent, transparent); background-size:200% 200%; animation:move-background 2s linear infinite;}
Expand All @@ -74,7 +88,7 @@
100%{display:block; opacity:1;}
}

/* Tablet mode */
/* Android tablet mode */
@media all and (min-width:550px) {
#list{display:block; float:left; width:37%;}
#list #items{border-right:1px solid #d5d5d5;}
Expand All @@ -90,7 +104,7 @@
var ActionsDB;
var SettingsDB;

var CurNoteID = -1; //По умолчанию, для возврата настроек
var CurNoteID = -1; //По умолчанию новая заметка
var LatestNote;
var CurNoteDateTime;

Expand Down Expand Up @@ -118,6 +132,7 @@
var IDS_ABOUT_SYNC = 'IP address and port to sync notes with your PC.';
var IDS_AUTO_SYNC = 'Sync at startup';
var IDS_ABOUT_AUTO_SYNC = 'Automatically sync on app launch.';

//Для всех
var IDS_DARK_THEME = 'Dark theme';
var IDS_THEME_TIME_DEPENDENT = 'Theme is time dependent';
Expand All @@ -133,9 +148,7 @@
var IDS_CONNECTION_FAILED = 'Connection failed';

//Русский
//console.log(navigator.language.toLowerCase());
//в iOS языки прописными буквами
if (navigator.language.toLowerCase() == 'ru-ru') {
if (navigator.language.toLowerCase() == 'ru-ru') { //В iOS языки прописными буквами
IDS_MONTHS = ['янв.', 'фев.', 'мар.', 'апр.', 'май', 'июн.', 'июл.', 'авг.', 'сен.', 'окт.', 'ноя.', 'дек.'];
IDS_DAYOFWEEK = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье'];
IDS_TODAY = 'Сегодня';
Expand Down Expand Up @@ -314,8 +327,6 @@

function ShowNotes()
{
//document.getElementById('list').className = 'page transition center';
//document.getElementById('editor').className = 'page transition right';
if (TabletMode == false)
document.getElementById('editor').style.display = 'none';
document.getElementById('list').style.display = 'block';
Expand Down Expand Up @@ -513,49 +524,57 @@
{
var CurTimeStamp = GetTimeStamp();
var UTCTimeStamp = GetUTCTimeStamp();
var MemoText = document.getElementById('memo').value;
var LatestCurNoteID = CurNoteID; //Для мновенного переключения на новую заметку, без ожидания выполнения SQL

//Новая заметка
if (CurNoteID == '-1') {

if (document.getElementById('memo').value.trim() != '') {
//Не создаем заметку без текста
if (MemoText.trim() != '') {
NotesDB.transaction(function (tx) {
tx.executeSql('INSERT INTO Notes (ID, Note, DateTime) VALUES (' + CurTimeStamp + ', "' + StrToCharCodes(document.getElementById('memo').value) + '", ' + UTCTimeStamp + ')');
tx.executeSql('INSERT INTO Notes (ID, Note, DateTime) VALUES (' + CurTimeStamp + ', "' + StrToCharCodes(MemoText) + '", ' + UTCTimeStamp + ')');
});

ActionsDB.transaction(function (tx) {
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("insert", ' + CurTimeStamp + ', "' + StrToCharCodes(document.getElementById('memo').value) + '",' + UTCTimeStamp + ')');
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("insert", ' + CurTimeStamp + ', "' + StrToCharCodes(MemoText) + '",' + UTCTimeStamp + ')');
});

}
//console.log('Inserted done');
} else if (LatestNote.trim() != document.getElementById('memo').value.trim()) { //Добавлять только при наличии изменений
} else if (LatestNote.trim() != MemoText.trim()) { //Добавлять только при наличии изменений

if (UpdateDateTime) {
if (UpdateDateTime) { //Обновление времени
NotesDB.transaction(function (tx) {
tx.executeSql('UPDATE Notes SET Note="' + StrToCharCodes(document.getElementById('memo').value) + '", DateTime=' + UTCTimeStamp + ' WHERE ID=' + CurNoteID);
tx.executeSql('UPDATE Notes SET Note="' + StrToCharCodes(MemoText) + '", DateTime=' + UTCTimeStamp + ' WHERE ID=' + LatestCurNoteID);
});

ActionsDB.transaction(function (tx) {
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("update", ' + CurNoteID + ', "' + StrToCharCodes(document.getElementById('memo').value) + '",' + UTCTimeStamp + ')');
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("update", ' + LatestCurNoteID + ', "' + StrToCharCodes(MemoText) + '",' + UTCTimeStamp + ')');
});
} else {
} else { //Сохранение старого времени
NotesDB.transaction(function (tx) {
tx.executeSql('UPDATE Notes SET Note="' + StrToCharCodes(document.getElementById('memo').value) + '" WHERE ID=' + CurNoteID);
tx.executeSql('UPDATE Notes SET Note="' + StrToCharCodes(MemoText) + '" WHERE ID=' + LatestCurNoteID);
});

ActionsDB.transaction(function (tx) {
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("update", ' + CurNoteID + ', "' + StrToCharCodes(document.getElementById('memo').value) + '",' + CurNoteDateTime + ')');
tx.executeSql('INSERT INTO Actions (Action, ID, Note, DateTime) VALUES ("update", ' + LatestCurNoteID + ', "' + StrToCharCodes(MemoText) + '",' + CurNoteDateTime + ')');
});
}
//console.log('Updated done');
}
if (TabletMode) //Новая заметка открывается только в режиме планшета
NewNote();
ShowNotes();
}

function RemNote()
{
if (CurNoteID == '-1') return;
if (CurNoteID == '-1') {ShowNotes(); return;}
NotesDB.transaction(function (tx) {
tx.executeSql('DELETE FROM Notes WHERE id=' + CurNoteID, [], function (tx, results) {
tx.executeSql('DELETE FROM Notes WHERE ID=' + CurNoteID, [], function (tx, results) {
ShowNotes();
if (TabletMode) //Новая заметка открывается только в режиме планшета
NewNote();
}, null);
});
ActionsDB.transaction(function (tx) {
Expand All @@ -579,7 +598,7 @@
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();

request.open('GET', URL, false);
request.open('GET', URL, true);

request.onload = function() {
if (request.status == 200)
Expand Down Expand Up @@ -703,11 +722,11 @@
}

function CheckTabletMode(){
if (window.innerWidth >= 550) { //|| window.innerWidth > window.innerHeight
if (window.innerWidth >= 550) {
TabletMode = true;
document.getElementById('list').style.display = 'block';

if (document.getElementById('editor').style.display == 'none' && document.getElementById('settings').style.display == 'none')
if (document.getElementById('editor').style.display == 'none' && (document.getElementById('settings').style.display == 'none' || document.getElementById('settings').style.display == '')) //Когда блока нет, вместо "none" бывает ""
document.getElementById('editor').style.display = 'block';
} else {
TabletMode = false;
Expand Down Expand Up @@ -820,7 +839,6 @@
}, null);
});

//UpdateSizes(); //Для устройств не поддерживающих css calc
});
</script>
</head>
Expand Down Expand Up @@ -914,7 +932,7 @@

<div id="AboutThemeTime" class="titlebox"></div>

<div class="titlebox" style="text-align:center;"><br>EasyNotes<br><span id="LastUpdate"></span> 28.09.20<br>https://r57zone.github.io</div>
<div class="titlebox" style="text-align:center;"><br>EasyNotes<br><span id="LastUpdate"></span> 17.11.20<br>https://r57zone.github.io</div>
<br><br>
</div>
</div>
Expand Down
33 changes: 33 additions & 0 deletions Source/Windows/AllowIPs.txt → Source/Windows/AllowedIPs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
192.168.0.108
192.168.0.109
192.168.0.110
192.168.1.0
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
192.168.1.7
192.168.1.8
192.168.1.9
192.168.1.10
192.168.1.100
192.168.1.101
192.168.1.102
Expand All @@ -31,3 +42,25 @@
192.168.1.108
192.168.1.109
192.168.1.110
192.168.2.0
192.168.2.1
192.168.2.2
192.168.2.3
192.168.2.4
192.168.2.5
192.168.2.6
192.168.2.7
192.168.2.8
192.168.2.9
192.168.2.10
192.168.3.0
192.168.3.1
192.168.3.2
192.168.3.3
192.168.3.4
192.168.3.5
192.168.3.6
192.168.3.7
192.168.3.8
192.168.3.9
192.168.3.10
Loading

0 comments on commit 72fc5c6

Please sign in to comment.