From d7b9c163ceafadfd7c5760bbcc77f880b3636f21 Mon Sep 17 00:00:00 2001 From: KIMB-technologies Date: Mon, 25 Dec 2017 20:39:34 +0100 Subject: [PATCH] Build und Installer Fixes --- build/node.js | 2 +- build/package.json | 2 +- install/index.php | 122 +++--------------- system/appcache.php | 4 +- system/data/config.example.json | 40 +----- ...6b4a87ae8505a9b5f21160f3fc69e133f6860.json | 8 -- system/data/notes/noteslist.json | 4 +- .../user_qassixxeldvqflejmkbmsmkbixaonp.json | 7 - system/data/user/userslist.json | 4 +- system/data/userlist.json | 11 +- system/index.php | 8 +- system/load/backend.min.js | 2 +- system/load/notes.min.css | 2 +- system/load/notes.min.js | 2 +- system/php/systemInit.php | 74 ++--------- 15 files changed, 53 insertions(+), 239 deletions(-) delete mode 100644 system/data/notes/note_dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860.json delete mode 100644 system/data/user/user_qassixxeldvqflejmkbmsmkbixaonp.json diff --git a/build/node.js b/build/node.js index b328407..1f18f62 100644 --- a/build/node.js +++ b/build/node.js @@ -11,7 +11,7 @@ console.log( "=> 1. Minify" ); { //JS console.log( "===> 1.1 JavaScript" ); - var UglifyJS = require("uglify-js"); + var UglifyJS = require("uglify-es"); [ __dirname + "/../system/load/backend", diff --git a/build/package.json b/build/package.json index 54e831c..3492817 100644 --- a/build/package.json +++ b/build/package.json @@ -11,6 +11,6 @@ "license": "GPL-3.0", "dependencies": { "clean-css": "^4.1.9", - "uglify-js": "^3.2.2" + "uglify-es": "^3.3.1" } } diff --git a/install/index.php b/install/index.php index 839aa5a..6b8b17d 100644 --- a/install/index.php +++ b/install/index.php @@ -162,6 +162,8 @@ public function __destruct(){ $abfr .= '

URL zu Impressum/ Support:

'; $abfr .= '

Beschriftung des Links zu Impressum/ Support:

'; $abfr .= '

Hinweise zur Syntax der Notizen anzeigen: Anzeigen Ausblenden

'; + $abfr .= '

Prüfen nach Ändrungen alle Sekunden.

'; + $abfr .= '

OfflineApp durch CacheManifest anbieten: Aktvieren Deaktivieren

'; $abfr .= '

'; $abfr .= '

'; @@ -169,24 +171,13 @@ public function __destruct(){ //Konfiguration Gerüst erstellen: $_SESSION['confarray'] = array( - "config" => array( - "domain" => "", - "JSdevmin" => "", - "impressumURL" => "", - "impressumName" => "", - "showMarkdownInfo" => "" - ), - "externeLibs" => array( - "", - array( - "fonts" => "", - "jqueryuiCSS" => "", - "jqueryui" => "", - "jquery" => "", - "sjcl" => "", - "qrcode" => "" - ) - ) + "domain" => "", + "JSdevmin" => "", + "impressumURL" => "", + "impressumName" => "", + "showMarkdownInfo" => "", + "sysPoll" => "", + "AppCache" => "" ); } else if( $step == 3 ){ @@ -204,99 +195,26 @@ public function __destruct(){ !empty( $_POST['impressumName'] ) && ( $_POST['showMarkdownInfo'] == 'true' || $_POST['showMarkdownInfo'] == 'false' ) + && + is_numeric( $_POST['sysPoll'] ) + && + ( $_POST['AppCache'] == 'true' || $_POST['AppCache'] == 'false' ) ) ){ if( !empty( $_POST['from2'] ) ){ //Werte von 2 verarbeiten - $_SESSION['confarray']["config"] = array( + $_SESSION['confarray'] = array( "domain" => $_POST['domain'], "JSdevmin" => ( $_POST['JSdemvin'] == "dev" ? "dev" : "min" ), "impressumURL" => $_POST["impressumURL"], "impressumName" => $_POST["impressumName"], - "showMarkdownInfo" => ( $_POST['showMarkdownInfo'] == 'false' ? false : true ) + "showMarkdownInfo" => ( $_POST['showMarkdownInfo'] == 'false' ? false : true ), + "sysPoll" => intval( $_POST['sysPoll'] ), + "AppCache" => ( $_POST['AppCache'] == 'false' ? false : true ), ); - } - - //Libraries abfragen - $out->addBox( '

External Libraries

' ); - - $out->addBox( - 'KIMB-Notes benötigt externe JS-Bibilotheken, die Quelle dieser muss hier angegeben werden.
' - .'Siehe ReadMe
' - .'Es gibt zwei Möglichkeiten, entweder geben Sie zu jeder dieser Bibilotheken die genaue URL an oder Sie definieren ein Verzeichnis' - .'in dem die Bibilotheken nach vorgegebener Struktur liegen (ein solches Verzeichnis finden sie unter /js-libs/).' - ); - - $abfr = '
'; - $abfr .= '

Verzeichnis angeben Einzeln angeben

'; - $abfr .= '
'; - $abfr .= ''; - $abfr .= '
'; - - $abfr .= '

'; - - $out->addBox( $abfr ); - - } - else{ - $out->addBox( '
Konnte Systemkonfiguration nicht sichern!
' ); - $out->addBox( '' ); - } -} -else if( $step == 4 ){ - //Übergaben okay? - if( - !empty( $_POST['modus'] ) - && - ( - !empty( $_POST['libfolder'] ) - || - ( - !empty( $_POST['fonts'] ) - && - !empty( $_POST['jqueryuiCSS'] ) - && - !empty( $_POST['jqueryui'] ) - && - !empty( $_POST['jquery'] ) - && - !empty( $_POST['sjcl'] ) - && - !empty( $_POST['qrcode'] ) - ) - ) - ){ - //Werte von 3 verarbeiten - $extarray = array(); - // Verzeichnis oder einzeln? - if( !empty( $_POST['libfolder'] ) ){ - $extarray = array( $_POST['libfolder'] ); } - else{ - $extarray = array( - false, - array( - "fonts" => $_POST['fonts'], - "jqueryuiCSS" => $_POST['jqueryuiCSS'], - "jqueryui" => $_POST['jqueryui'], - "jquery" => $_POST['jquery'], - "sjcl" => $_POST['sjcl'], - "qrcode" => $_POST['qrcode'] - ) - ); - } - //in die Config rein - $_SESSION['confarray']["externeLibs"] = $extarray; - - + //neue Config öffnen und schreiben $conf = new JSONReader( 'config' ); // schreiben @@ -311,8 +229,8 @@ public function __destruct(){ } } else{ - $out->addBox( '
Konnte External Libraries nicht übernehmen!
' ); - $out->addBox( '' ); + $out->addBox( '
Konnte Systemkonfiguration nicht sichern!
' ); + $out->addBox( '' ); } } else if( $step == 5 ){ diff --git a/system/appcache.php b/system/appcache.php index 65d59de..e0553a9 100644 --- a/system/appcache.php +++ b/system/appcache.php @@ -39,12 +39,14 @@ echo "CACHE MANIFEST"."\r\n"; echo "# Version ".$versnum."\r\n"; - // Code fuer JS dev +if( $jsdevmin == 'dev' ){ + // Weiterer Versionscode für JS dev foreach( scandir( __DIR__ . '/load/devjs/' ) as $fona ){ if( $fona != '.' && $fona != '..' && is_file( __DIR__ . '/load/devjs/'. $fona ) ){ echo "# ". $fona ." ".filemtime( __DIR__ . '/load/devjs/'. $fona )."\r\n"; } } +} echo "\r\n"; echo "CACHE:"."\r\n"; echo $domain."/index.php"."\r\n"; diff --git a/system/data/config.example.json b/system/data/config.example.json index 87402a2..cc60e58 100644 --- a/system/data/config.example.json +++ b/system/data/config.example.json @@ -1,35 +1,9 @@ { - "config": { - "domain": "http:\/\/notes.example.com", - "JSdevmin": "min", - "impressumURL": "http:\/\/example.com\/impressum-datenschutz", - "impressumName": "Impressum & Datenschutz", - "showMarkdownInfo" : true - }, - "externeLibs": [ - "https:\/\/data.example.com" - ] -} - -// Oder auch - -{ - "config": { - "domain": "http:\/\/notes.example.com", - "JSdevmin": "min", - "impressumURL": "http:\/\/example.com\/impressum-datenschutz", - "impressumName": "Impressum & Datenschutz", - "showMarkdownInfo" : true - }, - "externeLibs": [ - false, - { - "fonts": "https:\/\/fonts.example.com\/fonts.css", - "jqueryuiCSS": "https:\/\/jquery.example.com\/jquery-ui.min.css", - "jqueryui": "https:\/\/jquery.example.com\/jquery-ui.mn.js", - "jquery": "https:\/\/jquery.example.com\/jquery.min.js", - "sjcl": "https:\/\/other.example.com\/sjcl.min.js", - "qrcode": "https:\/\/other.example.com\/qrcoe.min.js" - } - ] + "domain": "http:\/\/notes.example.com", + "JSdevmin": "min", + "impressumURL": "http:\/\/example.com\/impressum-datenschutz", + "impressumName": "Impressum & Datenschutz", + "showMarkdownInfo" : true, + "sysPoll" : 60, + "AppCache" : true } \ No newline at end of file diff --git a/system/data/notes/note_dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860.json b/system/data/notes/note_dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860.json deleted file mode 100644 index eb1ccea..0000000 --- a/system/data/notes/note_dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "noteid": "dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860", - "userid": "qassixxeldvqflejmkbmsmkbixaonp", - "name": "fdf", - "content": "# fdf\nUnd hier dann der Text!!\n", - "geandert": 1513792519, - "erstellt": 1513792519 -} \ No newline at end of file diff --git a/system/data/notes/noteslist.json b/system/data/notes/noteslist.json index 70a7f69..0637a08 100644 --- a/system/data/notes/noteslist.json +++ b/system/data/notes/noteslist.json @@ -1,3 +1 @@ -[ - "dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860" -] \ No newline at end of file +[] \ No newline at end of file diff --git a/system/data/user/user_qassixxeldvqflejmkbmsmkbixaonp.json b/system/data/user/user_qassixxeldvqflejmkbmsmkbixaonp.json deleted file mode 100644 index e7adfda..0000000 --- a/system/data/user/user_qassixxeldvqflejmkbmsmkbixaonp.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "name": "fdf", - "noteid": "dbcd2987d264971c919982c79259c197815362fed683df428e1a881fcce22426b4a87ae8505a9b5f21160f3fc69e133f6860", - "position": 1 - } -] \ No newline at end of file diff --git a/system/data/user/userslist.json b/system/data/user/userslist.json index ba9ee4a..0637a08 100644 --- a/system/data/user/userslist.json +++ b/system/data/user/userslist.json @@ -1,3 +1 @@ -[ - "qassixxeldvqflejmkbmsmkbixaonp" -] \ No newline at end of file +[] \ No newline at end of file diff --git a/system/data/userlist.json b/system/data/userlist.json index 9e8551d..0637a08 100644 --- a/system/data/userlist.json +++ b/system/data/userlist.json @@ -1,10 +1 @@ -[ - { - "username": "admin", - "password": "6ae659ef03c9b9785dc49b9e9219b4f84be64eaa758477ed8ac87971ab928afd", - "salt": "BDtssPP9UfZpAkxF5vT52LMmHCIsXDmWpam3yCOI", - "userid": "qassixxeldvqflejmkbmsmkbixaonp", - "admin": true, - "authcodes": [] - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/system/index.php b/system/index.php index 5fdd15f..510a517 100644 --- a/system/index.php +++ b/system/index.php @@ -41,12 +41,14 @@ require_once( __DIR__ . '/php/systemInit.php' ); //Domain holen $domain = SystemInit::get( 'domain' ); -//JSdivmin +//JSdevmin $jsdevmin = SystemInit::get( 'JSdevmin' ); +//AppCache +$manifest = SystemInit::get( 'AppCache' ) ? ' manifest="'.$domain.'/appcache.php"' : ''; ?> - +> KIMB-Notes @@ -90,7 +92,7 @@ - + diff --git a/system/load/backend.min.js b/system/load/backend.min.js index 19d149e..1afb40a 100644 --- a/system/load/backend.min.js +++ b/system/load/backend.min.js @@ -1 +1 @@ -function adminDialog(){function e(e){$("div#mainAdminDialog").html(e)}function n(){var i;ajax_request("admin",{userid:userinformation.id,art:"list"},function(t){if("okay"===t.status){i=t.data.salt;var r="

Userliste

";t.data.list.forEach(function(e){r+=''}),r+="
UserIdUsernameAdminLöschen
'+e.userid.substr(0,20)+""+e.username+''+e.admin+'
",e(r+='

Hinzufügen


Admin: true false


'),$("button#newUserButton").click(function(){if(""!=$("input#newUserPasswordA").val()&&""!=$("input#newUserName").val()){var e=$("input#newUserName").val();if(/[^a-z]+/.test(e))alert("Der Usernamen darf nur aus Kleinbuchstaben bestehen!");else if($("input#newUserPasswordA").val()==$("input#newUserPasswordB").val()){var t=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash($("input#newUserPasswordA").val()));t=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(t+"+"+i));var r={name:$("input#newUserName").val(),admin:"true"==$("input#newUserAdmin:checked").val(),password:t,salt:i};ajax_request("admin",{userid:userinformation.id,art:"add",user:r},function(e){1==e.data.done&&n(),"string"==typeof e.error[0]&&"Username already assigned!"===e.error[0]&&alert("Username bereits vergeben!")})}else alert("Die Passwörter stimmen nicht überein!")}else alert("Sie müssen alle Felder füllen!")}),$("button.delUser").click(function(){var e=$(this).parent().parent().attr("userid");if(confirm("Wollen Sie den User mit der ID: '"+e+"' wirklich löschen?")){if(e==userinformation.id&&!confirm("Sie löschen Ihren eigenen Account!! (Achten Sie darauf, dass immer ein Administrator bestehen bleibt!)"))return;ajax_request("admin",{userid:userinformation.id,art:"del",deluserid:e},function(e){1==e.data.done&&n()})}})}else e("Fehler!")})}$("body").append('
'),$("div#mainAdminDialog").dialog({modal:!0,title:"Notes - Administration",close:function(e,n){$("div#mainAdminDialog").remove()},position:{my:"center",at:"center",of:$("div.main")},resizable:!1,width:$("div.main").width(),height:500}),e("Loading ..."),n()} \ No newline at end of file +function adminDialog(){$("body").append('
'),$("div#mainAdminDialog").dialog({modal:!0,title:"Notes - Administration",close:function(e,n){$("div#mainAdminDialog").remove()},position:{my:"center",at:"center",of:$("div.main")},resizable:!1,width:$("div.main").width(),height:500}),e("Loading ...");function e(e){$("div#mainAdminDialog").html(e)}function n(){var i;ajax_request("admin",{userid:userinformation.id,art:"list"},function(t){if("okay"===t.status){i=t.data.salt;var r="

Userliste

";t.data.list.forEach(function(e){r+=''}),r+="
UserIdUsernameAdminLöschen
'+e.userid.substr(0,20)+""+e.username+''+e.admin+'
",e(r+='

Hinzufügen


Admin: true false


'),$("button#newUserButton").click(function(){if(""!=$("input#newUserPasswordA").val()&&""!=$("input#newUserName").val()){var e=$("input#newUserName").val();if(/[^a-z]+/.test(e))alert("Der Usernamen darf nur aus Kleinbuchstaben bestehen!");else if($("input#newUserPasswordA").val()==$("input#newUserPasswordB").val()){var t=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash($("input#newUserPasswordA").val()));t=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(t+"+"+i));var r={name:$("input#newUserName").val(),admin:"true"==$("input#newUserAdmin:checked").val(),password:t,salt:i};ajax_request("admin",{userid:userinformation.id,art:"add",user:r},function(e){1==e.data.done&&n(),"string"==typeof e.error[0]&&"Username already assigned!"===e.error[0]&&alert("Username bereits vergeben!")})}else alert("Die Passwörter stimmen nicht überein!")}else alert("Sie müssen alle Felder füllen!")}),$("button.delUser").click(function(){var e=$(this).parent().parent().attr("userid");if(confirm("Wollen Sie den User mit der ID: '"+e+"' wirklich löschen?")){if(e==userinformation.id&&!confirm("Sie löschen Ihren eigenen Account!! (Achten Sie darauf, dass immer ein Administrator bestehen bleibt!)"))return;ajax_request("admin",{userid:userinformation.id,art:"del",deluserid:e},function(e){1==e.data.done&&n()})}})}else e("Fehler!")})}n()} \ No newline at end of file diff --git a/system/load/notes.min.css b/system/load/notes.min.css index 7c552e4..5bc0406 100644 --- a/system/load/notes.min.css +++ b/system/load/notes.min.css @@ -1 +1 @@ -body,button,code,input,pre,textarea{font-size:100%}body,button,input,textarea{font-family:Ubuntu,sans-serif}input[readonly=readonly]{background-color:#ddd;border-radius:3px}code,pre{font-family:"Ubuntu Mono",monospace}body{background:url(notes_bg_sw.png) repeat scroll center top #010101;background-color:#010101;color:#000}h1,h2{border-bottom:1px solid #5d7}h1{font-size:1.8em;font-weight:700}h2{font-size:1.3em;font-type:italic}a,a:active,a:hover,a:visited{text-decoration:none;color:#00f}blockquote{margin:15px 0;margin-left:1.5em;padding-left:1.5em;border-left:.2em gray solid}code,pre{border-radius:3px;background-color:#f8f8f8;color:inherit}code{border:1px solid #eaeaea;margin:0 2px;padding:0 5px}pre{border:1px solid #ccc;line-height:1.25em;overflow:auto;padding:6px 10px}pre>code{border:0;margin:0;padding:0}ins{color:green;text-decoration:none;font-weight:700}del{color:red;text-decoration:line-through}.disable{display:none!important}.important{color:orange}.error{color:red;font-weight:700}.okay{color:green}.small{font-size:.8em}.message{margin:auto;text-align:center;border:2px solid #5d7;border-radius:5px;background-color:#eee;padding:5px;margin:5px}.box{margin:auto;border:2px solid #aaa;border-radius:5px;background-color:#eee;padding:5px;margin:5px}.loading{background:url(loader.gif) no-repeat center center;height:20px}div.main{margin:auto;max-width:1100px;min-width:300px;background-color:#fff;padding:10px;border-radius:15px;border:1px solid #5d7;border-shadow:5px 5px 5px #ddd;position:relative}div.logout{position:absolute;top:0;right:0;height:50px;width:200px}div.logout span.usertools{position:absolute;top:10px;right:10px}div.logout span.usertools span.ui-icon{display:inline-block}div.noteslist div.toolbar button#notesarchive{float:right}div.footer{text-align:center;padding:10px}div.footer a{color:#fff}div#authCodeManagerDialog table,div#authCodeManagerDialog td,div#authCodeManagerDialog th,div#authCodeManagerDialog tr,div#freigabeManagerDialog table,div#freigabeManagerDialog td,div#freigabeManagerDialog th,div#freigabeManagerDialog tr,div#historyManagerDialog table,div#historyManagerDialog td,div#historyManagerDialog th,div#historyManagerDialog tr,div#mainAdminDialog table,div#mainAdminDialog td,div#mainAdminDialog th,div#mainAdminDialog tr,div#oldNotesDialog table,div#oldNotesDialog td,div#oldNotesDialog th,div#oldNotesDialog tr{border:1px solid #fff;border-collapse:collapse}.CodeMirror{border:1px solid #000;height:auto}.CodeMirror-scroll{min-height:200px}.ui-widget,.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Ubuntu,sans-serif;font-size:1em} \ No newline at end of file +body,button,code,input,pre,textarea{font-size:100%}body,button,input,textarea{font-family:Ubuntu,sans-serif}input[readonly=readonly]{background-color:#ddd;border-radius:3px}code,pre{font-family:"Ubuntu Mono",monospace}body{background:url(notes_bg_sw.png) repeat scroll center top #010101;background-color:#010101;color:#000}h1,h2{border-bottom:1px solid #5d7}h1{font-size:1.8em;font-weight:700}h2{font-size:1.3em;font-type:italic}a,a:active,a:hover,a:visited{text-decoration:none;color:#00f}blockquote{margin:15px 0;margin-left:1.5em;padding-left:1.5em;border-left:.2em gray solid}code,pre{border-radius:3px;background-color:#f8f8f8;color:inherit}code{border:1px solid #eaeaea;margin:0 2px;padding:0 5px}pre{border:1px solid #ccc;line-height:1.25em;overflow:auto;padding:6px 10px}pre>code{border:0;margin:0;padding:0}ins{color:green;text-decoration:none;font-weight:700}del{color:red;text-decoration:line-through}.disable{display:none!important}.important{color:orange}.error{color:red;font-weight:700}.okay{color:green}.small{font-size:.8em}.message{margin:auto;text-align:center;border:2px solid #5d7;border-radius:5px;background-color:#eee;padding:5px;margin:5px}.box{margin:auto;border:2px solid #aaa;border-radius:5px;background-color:#eee;padding:5px;margin:5px}.loading{background:url(loader.gif) no-repeat center center;height:20px}div.main{margin:auto;max-width:1100px;min-width:300px;background-color:#fff;padding:10px;border-radius:15px;border:1px solid #5d7;border-shadow:5px 5px 5px #ddd;position:relative}div.logout{position:absolute;top:0;right:0;height:50px;width:200px}div.logout span.usertools{position:absolute;top:10px;right:10px}div.logout span.usertools span.ui-icon{display:inline-block}div.noteslist div.toolbar button#notesarchive{float:right}div.footer{text-align:center;padding:10px}div.footer a{color:#fff}div#authCodeManagerDialog table,div#authCodeManagerDialog td,div#authCodeManagerDialog th,div#authCodeManagerDialog tr,div#freigabeManagerDialog table,div#freigabeManagerDialog td,div#freigabeManagerDialog th,div#freigabeManagerDialog tr,div#historyManagerDialog table,div#historyManagerDialog td,div#historyManagerDialog th,div#historyManagerDialog tr,div#mainAdminDialog table,div#mainAdminDialog td,div#mainAdminDialog th,div#mainAdminDialog tr,div#oldNotesDialog table,div#oldNotesDialog td,div#oldNotesDialog th,div#oldNotesDialog tr{border:1px solid #000;border-collapse:collapse}.CodeMirror{border:1px solid #000;height:auto}.CodeMirror-scroll{min-height:200px}.ui-widget,.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Ubuntu,sans-serif;font-size:1em} \ No newline at end of file diff --git a/system/load/notes.min.js b/system/load/notes.min.js index 794619d..22f73aa 100644 --- a/system/load/notes.min.js +++ b/system/load/notes.min.js @@ -1 +1 @@ -$(function(){loginsys()});function review(e){$("div.login").addClass("disable"),$("div.noteview").addClass("disable"),$("div.noteslist").addClass("disable"),$("div.globalloader").addClass("disable"),$("div."+e).removeClass("disable")}function errorMessage(e,r){void 0===r&&(r=10),$("div.global.error.message").html(e),$("div.global.error.message").removeClass("disable"),null!==errorMessageTimeOut&&clearTimeout(errorMessageTimeOut),!1!==r&&(errorMessageTimeOut=setTimeout(function(){$("div.global.error.message").addClass("disable")},1e3*r))}function ajax_request(e,r,s,o){$.post(domain+"/ajax.php?"+e,r,function(e){"object"==typeof e?("error"===e.status?console.log(e.error):errorMessage("",0),"function"==typeof s&&s(e)):(errorMessage("Sever antwortet nicht korrekt!",!1),"function"==typeof o&&o(e))}).fail(function(){errorMessage("Verbindung zum Sever verloren!",!1),"function"==typeof o&&o({})})}var userinformation={name:null,id:null,admin:!1},errorMessageTimeOut=null;function loginsys(){function i(){var i=window.location.hash;if(""!=i){i=i.substr(1);if(new RegExp("[a-z]+:[a-z0-9]+").test(i)){var o=i.split(":"),n=o[0],s=o[1];console.log('Versuche User "'+n+'" mit Loginlink einzuloggen.'),$("div.login div.input div.loading").removeClass("disable"),ajax_request("login",{username:n,authcode:s},function(i){$("div.login div.input div.loading").addClass("disable"),"okay"===i.status?(userinformation.name=n,userinformation.id=i.data.id,userinformation.admin=i.data.admin,localStorage.setItem("userinformation_id",userinformation.id),localStorage.setItem("userinformation_name",userinformation.name),localStorage.setItem("userinformation_admin",userinformation.admin),a(),list()):e()})}else e()}else e()}function e(){function i(){$("div.login div.input div.loading").removeClass("disable"),$("div.login div.input div#loginform").addClass("disable"),$("div.login p.message.important").addClass("disable");var i=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash($("input#userpassword").val()));ajax_request("login",{username:$("input#username").val(),password:i},function(i){$("div.login div.input div.loading").addClass("disable"),"error"===i.status?($("div.login p.message.error").removeClass("disable"),$("div.login div.input div#loginform").removeClass("disable")):"okay"===i.status&&($("div.login p.message.okay").removeClass("disable"),$("div.login p.message.error").addClass("disable"),$("div.login div.input").addClass("disable"),$("input#username").val(""),$("input#userpassword").val(""),userinformation.name=i.data.name,userinformation.id=i.data.id,userinformation.admin=i.data.admin,localStorage.setItem("userinformation_id",userinformation.id),localStorage.setItem("userinformation_name",userinformation.name),localStorage.setItem("userinformation_admin",userinformation.admin),a(),list())})}$("div.login p.message.important").removeClass("disable"),$("div.login p.message.error").addClass("disable"),$("div.login p.message.okay").addClass("disable"),$("div.login div.input div.loading").addClass("disable"),$("div.login div.input div#loginform").removeClass("disable"),$("div.login div.input").removeClass("disable"),$("button#userlogin").unbind("click").click(i),$("input#userpassword").unbind("keyup").keyup(function(e){13==e.keyCode&&i()})}function a(){function i(){ajax_request("login",{logout:null},function(i){"okay"===i.status&&($("p.message.error.loggedout").removeClass("disable"),setTimeout(function(){$("p.message.error.loggedout").addClass("disable")},2e4))}),0==$("input#logouttype:checked").length?localStorage.clear():(localStorage.removeItem("userinformation_id"),localStorage.removeItem("userinformation_name")),userinformation={name:null,id:null,admin:!1},window.location.hash="",null!==e&&clearInterval(e),errorMessage("Fehler!",0),"undefined"!=typeof cm_editor&&cm_editor.setValue("empty"),["input#userpassword","input#username","input#notename","div#notespreview","textarea#notesinput","input#newnotename","div.listpart div.list"].forEach(function(i){$(i).empty(),"textarea#notesinput"!==i&&$(i).val("")}),$("div.logout").addClass("disable"),loginsys()}var e=null;$("div.logout").removeClass("disable"),$("button#logout").unbind("click").click(i),e=setInterval(function(){ajax_request("login",{status:userinformation.id},function(i){1!=i.data&&errorMessage("Die Session ist abgelaufen!",!1)})},3e5),$("div.logout span.usertools").tooltip(),userinformation.admin?($("div.logout span.usertools span.ui-icon-wrench").removeClass("disable"),$("div.logout span.usertools span.ui-icon-wrench").unbind("click").click(function(){$.ajax({type:"GET",url:domain+"/load/backend."+jsdevmin+".js",success:function(){adminDialog()},dataType:"script",cache:!0})})):$("div.logout span.usertools span.ui-icon-wrench").addClass("disable"),$("div.logout span.usertools span.ui-icon-person").unbind("click").click(function(){authCodeManager()})}!function(){function e(){review("login"),""!=localStorage.getItem("userinformation_id")&&null!=localStorage.getItem("userinformation_id")&&""!=localStorage.getItem("userinformation_name")&&null!=localStorage.getItem("userinformation_name")?(userinformation.id=localStorage.getItem("userinformation_id"),userinformation.name=localStorage.getItem("userinformation_name"),userinformation.admin=JSON.parse(localStorage.getItem("userinformation_admin")),$("div.login div.input div.loading").removeClass("disable"),ajax_request("login",{status:userinformation.id},function(e){$("div.login div.input div.loading").addClass("disable"),1==e.data?(a(),list()):i()})):i()}review("globalloader");var o=window.location.hash;""!=o?(o=o.substr(1),new RegExp("[^A-Za-z0-9]").test(o)?e():shareviewer(o,e)):e()}()}function list(){review("noteslist"),$("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id},function(t){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===t.status&&function(t){$("button#newnote").unbind("click").click(function(){var t=$("input#newnotename").val();""!=t&&function(t){$("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id,name:t},function(i){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===i.status&&(console.log('Notiz: "'+t+'" ("'+i.data.id+'") angelegt.'),list())})}(t)}),$("button#notesarchive").unbind("click").click(function(){oldNotesManager()});var i="",$("div.noteslist div.listpart div.list").html(i),$("li.noteslist_notesnames").tooltip(),$("div.noteslist div.listpart div.list ul").css({"list-style-type":"none"}),$("div.noteslist div.listpart div.list ul li.noteslist_notesnames").css({"line-height":"28px"}),$("span.noteseditbuttons").css({float:"right",cursor:"pointer"}),$("div.noteslist div.listpart div.list ul li span.notesnames").css({display:"inline-block",cursor:"pointer"}),$("div.noteslist div.listpart div.list ul li span.notesnames").unbind("click").click(function(){var t=$(this).parent().attr("noteid"),i=$(this).text();console.log('Oeffne: "'+i+'" ("'+t+'")'),maker(t,i)}),$("span.noteseditbuttons button").unbind("click").click(function(){var t=$(this).attr("art"),i=$(this).parent().parent().attr("noteid");$("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id,art:t,noteid:i},function(s){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===s.status&&(console.log('Notiz: "'+i+'" wurde '+("del"==t?"gelöscht":"up"==t?"nach oben verschoben":"nach unten verschoben")),list())})})}(t.data)})}function maker(e,t,i,a){function n(){$("input#notename").val(u.name),$("textarea#notesinput").text(u.content),"object"!=typeof cm_editor?cm_editor=CodeMirror.fromTextArea(document.getElementById("notesinput"),{mode:"gfm",lineNumbers:!0,theme:"default"}):cm_editor.setValue($("textarea#notesinput").val()),function(){function e(e,t){var i=/(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);if(i&&void 0!==t&&1===t.text.length&&/^[A-Z]$/.test(t.text[0])){var a=$(":focus");a.blur(),a.focus()}$("div#notespreview").html(marked(cm_editor.getValue()))}var t=new marked.Renderer;t.heading=function(e,t){return""+e+""},t.link=function(e,t,i){return''+i+""},marked.setOptions({renderer:t,gfm:!0,tables:!0,highlight:function(e,t){if("tex"!=t)return-1!==["markup","css","clike","javascript","c","bash","cpp","csharp","ruby","git","ini","java","json","lua","markdown","matlab","objectivec","perl","php","python","r","sql","swift"].indexOf(t)?Prism.highlight(e,Prism.languages[t]):e;try{return katex.renderToString(e)}catch(e){return''+e.message+""}}});e(),l&&!s?$("div.input.box").addClass("disable"):($("div.input.box").removeClass("disable"),cm_editor.on("change",e));c=e}(),function(){function e(){var e={name:$("input#notename").val(),id:u.id,content:cm_editor.getValue()};localStorage.setItem("note_autosave_"+u.id,JSON.stringify(e)),Date.now()-3e4>b&&o()}e(),cm_editor.on("change",e),g=e}()}function o(i){function n(){l&&s?(b=Date.now(),a(cm_editor.getValue(),!1)):!1===l&&($("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,note:{name:$("input#notename").val(),cont:cm_editor.getValue()}},function(a){$("div.noteview div.loading").addClass("disable"),"okay"===a.status&&(console.log('Notiz: "'+t+'" ("'+e+'") auf Server gespeichert.'),b=Date.now()),"function"==typeof i&&i("okay"===a.status)},function(e){"function"==typeof i&&i(!1)}))}v?($("body").append('
Beim Speichern der Notiz kann es eventuell zu Datenverlust kommen, da die aktuellste Version nicht vom Server geladen werden konnte!
'),$("#dangerMessageNoteSave").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Gefahr des Datenverlustes!",buttons:{"Trotzdem Speichern":function(){$(this).dialog("close"),v=!1,n()},"Erstmal nicht":function(){$(this).dialog("close")}},close:function(){$(this).remove()}})):n()}function d(){function t(){errorMessage("Freigaben konnten nicht geladen werden."),$("div.noteview div.loading").addClass("disable")}$("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e},function(i){if("okay"===i.status){var a='
Konnte Aktion nicht durchführen.
',n=!1;$.each(i.data,function(e,t){n=!0,a+='',a+="",a+="",a+='",a+="",a+=''}),a+="
LinkNameErstelltBearbeitenLetzter Aufruf (Anzahl)Löschen
Aufrufen "+t.name+""+t.created+"'+t.edit+""+t.lastAccessed+" ("+t.accesses+")
",!1===n&&(a+="

Noch keine Freigaben!

"),a+='

Neue Freigabe


Bearbeiten erlauben Nur lesen
',$("body").append('
'+a+"
"),$("div.noteview div.loading").addClass("disable"),$("div#freigabeManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Freigaben",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),$("button.deleteFreigabe").click(function(){var t=$(this).attr("authcode");$("div.freigabeDialog.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,share:{authcode:t,edit:"leer",name:"leer"}},function(e){"okay"===e.status?($("div#freigabeManagerDialog").dialog("close"),d()):($("div.freigabeDialog.loading").addClass("disable"),$("div.freigabeDialog.error").removeClass("disable"))})}),$("button#addFreigabe").click(function(){var t=$("input#freigabeManagerNewName").val(),i="true"==$("input#freigabeManagerNewEdit:checked").val();""!=t&&($("div.freigabeDialog.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,share:{authcode:"leer",edit:i,name:t}},function(e){"okay"===e.status?($("div#freigabeManagerDialog").dialog("close"),d()):($("div.freigabeDialog.loading").addClass("disable"),$("div.freigabeDialog.error").removeClass("disable"))}))}),$("button.freigabeQR").click(function(){var e=$(this).attr("authcode"),t=domain+"/#"+e,i='

Code: '+e+'

URL:

Link: Aufrufen

';$("body").append('
'+i+"
"),$("div#freigabeManagerQRDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Freigabelink",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),new QRCode(document.getElementById("freigabeManagerQR"),t)})}else t()},t)}function r(){function t(){errorMessage("Notizverlauf konnte nicht geladen werden."),$("div.noteview div.loading").addClass("disable")}$("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,history:3},function(e){if("okay"===e.status){var i="";$.each(e.data,function(e,t){i+="",i+="'}),i+="
ÄnderungenZeitpunkt
"+t.diff+""+t.time+'
",$("body").append('
'+i+"
"),$("div.noteview div.loading").addClass("disable"),$("div#historyManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Notizverlauf",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),$("button.takeInputFromHistory").click(function(){var t=$(this).attr("key"),i=e.data[t].text;cm_editor.setValue(i),$("div#historyManagerDialog").dialog("close")})}else t()},t)}if(void 0===i)var l=!1,s=!1;else{if("function"==typeof a)s=!0;else s=!1;l=!0}review("noteview");var u,c,g,v=!1,b=0;!function(){function a(i){i||(v=!0,errorMessage("Kann die aktuelle Version der Notiz nicht vom Server holen.",20)),null!=localStorage.getItem("note_autosave_"+e)?(u=JSON.parse(localStorage.getItem("note_autosave_"+e)),n()):(u={name:t,id:e,content:"# "+t+"\nUnd hier dann der Text!!\n"},n())}l?(u={name:t,id:e,content:i},$("div.noteview div.loading").addClass("disable"),n()):($("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,history:2},function(e){$("div.noteview div.loading").addClass("disable"),"okay"===e.status?e.data.empty?a(!0):(u={name:e.data.name,id:e.data.id,content:e.data.content},n()):a(!1)},function(e){a(!1)}))}(),$("button#closenote").unbind("click").click(function(){cm_editor.off("change",c),cm_editor.off("change",g),l&&s?a(cm_editor.getValue(),!0):l?(window.location.hash="",loginsys()):!1===l&&o(function(e){e?list():($("body").append('
Die Speicherung der Notiz auf dem Server schlug fehl!
Wollen Sie den Editor verlassen und einen Verlust der Änderungen in Kauf nehmen oder abbrechen?
'),$("#errorMessageNoteSave").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Fehler beim Speichern!",buttons:{"Änderungen verwerfen":function(){$(this).dialog("close"),list()},Abbrechen:function(){$(this).dialog("close")}},close:function(){$(this).remove()}}))})}),l?($("button#publishnote").addClass("disable"),$("button#notehistory").addClass("disable")):($("button#publishnote").removeClass("disable"),$("button#notehistory").removeClass("disable"),$("button#publishnote").unbind("click").click(d),$("button#notehistory").unbind("click").click(r))}var cm_editor;function authCodeManager(){function e(e){$("div#authCodeManagerDialog").html(e)}function a(a){function s(e,a){var n=!1;if($("span#newPasswordAIndikator").css({color:"white"}),""==e&&($("span#newPasswordAIndikator").css({"background-color":"inherit"}),$("span#newPasswordAIndikator").text("Bitte geben Sie ein Passwort ein!"),n=!0),""==a&&($("span#newPasswordBIndikator").css({"background-color":"inherit"}),$("span#newPasswordBIndikator").text("Bitte geben Sie das Passwort ein!"),n=!0),""!=e){var s,o=e,t=e.length,d=0;t>5?((d+=5*(t-=5))>20&&(d=20),o.match(/([a-zA-Z])/)&&(d+=10),o.match(/([A-Z])/)&&(d+=5),o.match(/([0-9])/)&&(d+=5),o.match(/([0-9].*[0-9])/)&&(d+=10),o.match(/([0-9].*[0-9].*[0-9])/)&&(d+=10),o.match(/([!,%,&,@,#,*,?,_,])/)&&(d+=15),o.match(/([!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,])/)&&(d+=15),o.match(/([!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,])/)&&(d+=15)):d=0,d<=25?(s="Das soll ein Passwort sein?",$("span#newPasswordAIndikator").css({"background-color":"red"})):d<=50?(s="Gut, aber es geht noch besser!",$("span#newPasswordAIndikator").css({"background-color":"orange"}),$("span#newPasswordAIndikator").css({color:"black"})):d<=75?(s="Das sieht doch super aus!",$("span#newPasswordAIndikator").css({"background-color":"yellow"}),$("span#newPasswordAIndikator").css({color:"black"})):d<=100&&(s="Da werden die Hacker schwitzen!",$("span#newPasswordAIndikator").css({"background-color":"green"})),$("span#newPasswordAIndikator").text(s)}return e!=a&&""!=e&&""!=a&&($("span#newPasswordBIndikator").css({"background-color":"red"}),$("span#newPasswordBIndikator").text("Die Passwörter stimmen nicht überein!"),n=!0),!n&&($("span#newPasswordBIndikator").css({"background-color":"green"}),$("span#newPasswordBIndikator").text("Passwörter stimmen überein!"),!0)}var o='

Authentifizierungslinks

';!1!==a?(o+="",a.forEach(function(e){o+=''}),o+="
Code (Anfang)Letzte NutzungLöschen
'+e.code+""+e.time+'
"):o+="

Sie haben noch keine Authentifizierungslinks!

",o+='

 

',e(o+='

Passwort ändern

Bitte geben Sie ein Passwort ein!
Bitte geben Sie das Passwort ein!
'),$("button#newPasswordSet").prop("disabled",!0),$("span.newPasswordIndikator").css({"border-radius":"5px",padding:"2px"}),$("button#newPasswordSet").click(function(){var e=$("input#newPasswordA").val(),a=$("input#newPasswordB").val();if(!s(e,a))return!1;$("div#newPasswordLoader").removeClass("disable"),ajax_request("account",{userid:userinformation.id},function(a){if("okay"===a.status){var n=a.data,s=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(e));s=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(s+"+"+n)),ajax_request("account",{userid:userinformation.id,newpass:s,salt:n},function(e){$("div#newPasswordLoader").addClass("disable"),"okay"===e.status?($("div#newPasswordDone").removeClass("disable error"),$("div#newPasswordDone").addClass("okay"),$("div#newPasswordDone").text("Passwort geändert!")):($("div#newPasswordDone").removeClass("disable okay"),$("div#newPasswordDone").addClass("error"),$("div#newPasswordDone").text("Konnte Passwort nicht ändern!"))})}else $("div#newPasswordLoader").addClass("disable"),$("div#newPasswordDone").removeClass("disable okay"),$("div#newPasswordDone").addClass("error"),$("div#newPasswordDone").text("Konnte Passwort nicht ändern!")})}),$("input.newPassword").on("keyup",function(){s($("input#newPasswordA").val(),$("input#newPasswordB").val())?$("button#newPasswordSet").prop("disabled",!1):$("button#newPasswordSet").prop("disabled",!0)}),$("button.deleteAuthLink").click(function(){var e=$(this).attr("linkid"),a=$(this).attr("codeteil");confirm('Wollen sie den Code "'+a+'" wirklich löschen? ')&&($("div#authLinkLoading").removeClass("disable"),ajax_request("account",{userid:userinformation.id,art:"del",id:e},function(e){$("div#authLinkLoading").addClass("disable"),"okay"===e.status?n():alert("Konnte den Code nicht löschen!")}))}),$("button#addAuthLink").click(function(){$("div#authLinkLoading").removeClass("disable"),ajax_request("account",{userid:userinformation.id,art:"new",id:"new"},function(e){$("div#authLinkLoading").addClass("disable"),"okay"===e.status?(!function(e){var a=domain+"/#"+userinformation.name+":"+e,n='

Neuer Authentifizierungslink wurde erstellt:

Code: '+e+'

URL:

Link: Aufrufen

Achtung: Dieser Link und Code wird nur ein einziges Mal angezeigt!!

';$("body").append('
'+n+"
"),$("div#authCodeManagerNewCodeDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Neuer Authentifizierungslink",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),new QRCode(document.getElementById("authCodeManagerNewCodeDialogQR"),a)}(e.data),n()):alert("Konnte keinen Code erstellen!")})})}function n(){ajax_request("account",{userid:userinformation.id,art:"list",id:"list"},function(n){"okay"===n.status?a(n.data):e("Kann nicht laden!")})}$("body").append('
Lädt ...
'),$("div#authCodeManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Authentifizierungslinks und Passwort",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),n()}function oldNotesManager(){function t(t){t='
'+t,$("div#oldNotesDialog").html(t)}$("body").append('
'),$("div#oldNotesDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Notizarchiv",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),t("Lädt ..."),$("div#oldNotesDialogLoader").removeClass("disable"),ajax_request("list",{userid:userinformation.id,reload:"none"},function(o){if($("div#oldNotesDialogLoader").addClass("disable"),"okay"===o.status){var e="";o.data.forEach(function(t){e+="'}),t(e+="
NameZuletzt geändertWiederherstellen
"+t.name+""+t.geaendert+'
"),$("button.oldNotesDialogReload").click(function(){var t=$(this).attr("noteid");$("div#oldNotesDialogLoader").removeClass("disable"),ajax_request("list",{userid:userinformation.id,reload:t},function(t){$("div#oldNotesDialogLoader").addClass("disable"),"okay"===t.status?(list(),$("div#oldNotesDialog").dialog("close")):alert("Konnte die Notiz nicht wiederherstellen!")})})}else t("Konnte nicht laden!!")})}function shareviewer(e,n){function t(){"function"==typeof n&&n()}ajax_request("share",{authcode:e},function(n){"okay"===n.status?n.data.edit?maker(n.data.id,n.data.name,n.data.content,function(n,t){function a(e){t&&(e&&!confirm("Konnte nicht Notiz speichern, trotzdem schließen?")||(window.location.hash="",loginsys()))}$("div.noteview div.loading").removeClass("disable"),ajax_request("share",{authcode:e,cont:n},function(e){$("div.noteview div.loading").addClass("disable"),"okay"===e.status||errorMessage("Konnten Notiz nicht speichern!"),a(!("okay"===e.status))},function(e){$("div.noteview div.loading").addClass("disable"),errorMessage("Konnte Notiz nicht speichern!"),a(!0)})}):maker(n.data.id,n.data.name,n.data.content):(errorMessage("Nachricht lässt sich mittels Freigabelink nicht öffnen.",!1),t())},function(e){t()})} \ No newline at end of file +$(function(){loginsys()});class OfflineManager{constructor(){null!==localStorage.getItem("notes_offline_storage")?this.data=JSON.parse(localStorage.getItem("notes_offline_storage")):this.data={},this.status=null}statusChanged(t){!0!==this.status&&null!==this.status||t||this.pushToServer(),this.status=t}saveNote(t,a,e){this.status&&(this.data[t]={content:a,name:e},this.saveLocalStorage())}saveLocalStorage(){localStorage.setItem("notes_offline_storage",JSON.stringify(this.data))}pushToServer(){if("{}"==JSON.stringify(this.data))this.data={},this.saveLocalStorage();else if(0==this.status){var t=this;$.each(this.data,function(a,e){ajax_request("view",{userid:userinformation.id,noteid:a,note:{name:e.name,cont:e.content}},function(e){if($("div.noteview div.loading").addClass("disable"),"okay"===e.status){if(4==e.data.length){var s=JSON.parse(localStorage.getItem("note_autosave_"+a));s.lastserverchanged=e.data[3],localStorage.setItem("note_autosave_"+a,JSON.stringify(s))}delete t.data[a],t.saveLocalStorage()}})})}}}var userinformation={name:null,id:null,admin:!1},errorMessageTimeOut=null,systemOfflineMode=!1,systemOfflineManager=new OfflineManager,systemRESTAPI=!1;function review(e){$("div.login").addClass("disable"),$("div.noteview").addClass("disable"),$("div.noteslist").addClass("disable"),$("div.globalloader").addClass("disable"),$("div."+e).removeClass("disable")}function errorMessage(e,a){null!==errorMessageTimeOut&&clearTimeout(errorMessageTimeOut),null===e?($("div.global.error.message").html("Fehler!"),$("div.global.error.message").addClass("disable")):(void 0===a&&(a=10),$("div.global.error.message").html(e),$("div.global.error.message").removeClass("disable"),!1!==a&&(errorMessageTimeOut=setTimeout(function(){$("div.global.error.message").addClass("disable")},1e3*a)))}function ajax_request(e,a,i,s){$.post(domain+"/ajax.php?"+e,a,function(e){"object"==typeof e?("error"===e.status?console.log(e.error):(systemOfflineMode=!1,systemOfflineManager.statusChanged(!1),errorMessage(null)),"function"==typeof i&&i(e)):(errorMessage("Sever antwortet nicht korrekt!",!1),"function"==typeof s&&s(e))}).fail(function(){errorMessage("Offlinemodus",!1),systemOfflineMode=!0,systemOfflineManager.statusChanged(!0),"function"==typeof i&&i({data:{}})})}function confirmDialog(e,a,i){if(void 0===a)a={OK:function(){},Abbrechen:function(){}};if(void 0===i)i="Wichtig!";$("div.globalDialog").removeClass("disable"),$("div.globalDialog").dialog({resizable:!1,height:"auto",width:"auto",minWidth:200,minHeight:150,modal:!0,title:i,close:function(){$("div.globalDialog").html(""),$("div.globalDialog").addClass("disable")},position:{my:"center",at:"center",of:$("div.main")},buttons:a});function s(e){$("div.globalDialog").html(e)}return s(e),s}function loginsys(){!function(){review("globalloader");var o=window.location.hash;""!=o?(o=o.substr(1),new RegExp("[^A-Za-z0-9]").test(o)?n():shareviewer(o,n)):n();function n(){review("login"),""!=localStorage.getItem("userinformation_id")&&null!=localStorage.getItem("userinformation_id")&&""!=localStorage.getItem("userinformation_name")&&null!=localStorage.getItem("userinformation_name")?(userinformation.id=localStorage.getItem("userinformation_id"),userinformation.name=localStorage.getItem("userinformation_name"),userinformation.admin=JSON.parse(localStorage.getItem("userinformation_admin")),$("div.login div.input div.loading").removeClass("disable"),ajax_request("login",{status:userinformation.id},function(i){$("div.login div.input div.loading").addClass("disable"),systemOfflineMode?(a(),list()):1==i.data?(a(),list()):e()})):systemOfflineMode?i():e()}}();function e(){var e=window.location.hash;if(""!=e){e=e.substr(1);if(new RegExp("[a-z]+:[a-z0-9]+").test(e)){var o=e.split(":"),n=o[0],s=o[1];console.log('Versuche User "'+n+'" mit Loginlink einzuloggen.'),$("div.login div.input div.loading").removeClass("disable"),ajax_request("login",{username:n,authcode:s},function(e){$("div.login div.input div.loading").addClass("disable"),"okay"===e.status?(userinformation.name=n,userinformation.id=e.data.id,userinformation.admin=e.data.admin,localStorage.setItem("userinformation_id",userinformation.id),localStorage.setItem("userinformation_name",userinformation.name),localStorage.setItem("userinformation_admin",userinformation.admin),a(),list()):i()})}else i()}else i()}function i(){systemOfflineMode?($("div.login p.message.important.offline").removeClass("disable"),$("div.login p.message.important.online").addClass("disable"),$("div.login div.input div#loginform").addClass("disable"),$("div.login div.input").addClass("disable")):(ajax_request("login",{status:userinformation.id},function(e){systemOfflineMode&&i()}),$("div.login p.message.important.offline").addClass("disable"),$("div.login p.message.important.online").removeClass("disable")),$("div.login p.message.error").addClass("disable"),$("div.login p.message.okay").addClass("disable"),$("div.login div.input div.loading").addClass("disable"),systemOfflineMode||($("div.login div.input div#loginform").removeClass("disable"),$("div.login div.input").removeClass("disable"),$("button#userlogin").unbind("click").click(e),$("input#userpassword").unbind("keyup").keyup(function(i){13==i.keyCode&&e()}));function e(){$("div.login div.input div.loading").removeClass("disable"),$("div.login div.input div#loginform").addClass("disable"),$("div.login p.message.important").addClass("disable");var e=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash($("input#userpassword").val()));ajax_request("login",{username:$("input#username").val(),password:e},function(e){$("div.login div.input div.loading").addClass("disable"),"error"===e.status?($("div.login p.message.error").removeClass("disable"),$("div.login div.input div#loginform").removeClass("disable")):"okay"===e.status&&($("div.login p.message.okay").removeClass("disable"),$("div.login p.message.error").addClass("disable"),$("div.login div.input").addClass("disable"),$("input#username").val(""),$("input#userpassword").val(""),userinformation.name=e.data.name,userinformation.id=e.data.id,userinformation.admin=e.data.admin,localStorage.setItem("userinformation_id",userinformation.id),localStorage.setItem("userinformation_name",userinformation.name),localStorage.setItem("userinformation_admin",userinformation.admin),a(),list())})}}function a(){var e=null;function i(){systemOfflineMode||ajax_request("login",{logout:null},function(e){"okay"===e.status&&($("p.message.error.loggedout").removeClass("disable"),setTimeout(function(){$("p.message.error.loggedout").addClass("disable")},2e4))}),0==$("input#logouttype:checked").length?localStorage.clear():(localStorage.removeItem("userinformation_id"),localStorage.removeItem("userinformation_name")),userinformation={name:null,id:null,admin:!1},window.location.hash="",null!==e&&clearInterval(e),errorMessage(null),"undefined"!=typeof cm_editor&&cm_editor.setValue("empty"),["input#userpassword","input#username","input#notename","div#notespreview","textarea#notesinput","input#newnotename","div.listpart div.list"].forEach(function(e){$(e).empty(),"textarea#notesinput"!==e&&$(e).val("")}),$("div.logout").addClass("disable"),loginsys()}$("div.logout").removeClass("disable"),$("button#logout").unbind("click").click(i),e=setInterval(function(){if(null!=localStorage.getItem("note_maker_reopen")&&"none"!=localStorage.getItem("note_maker_reopen")){var e=JSON.parse(localStorage.getItem("note_maker_reopen"));ajax_request("view",{userid:userinformation.id,noteid:e.noteid,history:4},function(i){if("error"===i.status)errorMessage("Die Session ist abgelaufen!",!1);else if(null!=JSON.parse(localStorage.getItem("note_autosave_"+e.noteid))){var a=JSON.parse(localStorage.getItem("note_autosave_"+e.noteid)).lastserverchanged;i.data-a>5&&newerNoteOnServerFound()}})}else ajax_request("login",{status:userinformation.id},function(e){1!=e.data&&errorMessage("Die Session ist abgelaufen!",!1)})},1e3*global_polling_secs),$("div.logout span.usertools").tooltip(),systemOfflineMode?($("div.logout span.usertools span.ui-icon-wrench").addClass("disable"),$("div.logout span.usertools span.ui-icon-person").addClass("disable")):(userinformation.admin?($("div.logout span.usertools span.ui-icon-wrench").removeClass("disable"),$("div.logout span.usertools span.ui-icon-wrench").unbind("click").click(function(){$.ajax({type:"GET",url:domain+"/load/backend."+jsdevmin+".js",success:function(){adminDialog()},dataType:"script",cache:!0})})):$("div.logout span.usertools span.ui-icon-wrench").addClass("disable"),$("div.logout span.usertools span.ui-icon-person").unbind("click").click(function(){authCodeManager()}))}}function list(){if(review("noteslist"),systemOfflineManager.pushToServer(),null!=localStorage.getItem("note_maker_reopen")&&"none"!=localStorage.getItem("note_maker_reopen")){var t=JSON.parse(localStorage.getItem("note_maker_reopen"));maker(t.noteid,t.name)}!function(){systemOfflineMode?t():($("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id},function(s){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===s.status?(localStorage.setItem("note_list_notes",JSON.stringify(s.data)),i(s.data)):t()},t));function t(){$("div.noteslist div.listpart div.loading").addClass("disable"),null!=localStorage.getItem("note_list_notes")&&i(JSON.parse(localStorage.getItem("note_list_notes")))}}();function i(t){systemOfflineMode?$("div.toolbar").addClass("disable"):($("div.toolbar").removeClass("disable"),$("button#newnote").unbind("click").click(function(){var t=$("input#newnotename").val();""!=t&&(i=t,$("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id,name:i},function(t){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===t.status&&(console.log('Notiz: "'+i+'" ("'+t.data.id+'") angelegt.'),list())}));var i}),$("button#notesarchive").unbind("click").click(function(){oldNotesManager()}));var i="",$("div.noteslist div.listpart div.list").html(i),$("li.noteslist_notesnames").tooltip(),$("div.noteslist div.listpart div.list ul").css({"list-style-type":"none"}),$("div.noteslist div.listpart div.list ul li.noteslist_notesnames").css({"line-height":"28px"}),$("span.noteseditbuttons").css({float:"right",cursor:"pointer"}),$("div.noteslist div.listpart div.list ul li span.notesnames").css({display:"inline-block",cursor:"pointer",width:$("div.noteslist div.listpart div.list ul li").width()-$("div.noteslist div.listpart div.list ul li span.noteseditbuttons").width()-5+"px"}),list_first_load&&($(window).resize(function(){$("div.noteslist div.listpart div.list ul li span.notesnames").css({display:"inline-block",cursor:"pointer",width:$("div.noteslist div.listpart div.list ul li").width()-$("div.noteslist div.listpart div.list ul li span.noteseditbuttons").width()-5+"px"});var t=$("button#notesarchive").width();$("div.toolbar").width()-(t+($("input#newnotename").width()+$("button#newnote").width()+36))<10?($("button#notesarchive").css("float","none"),$("div.toolbar").css("line-height","28px")):($("button#notesarchive").css("float","right"),$("div.toolbar").css("line-height","inherit"))}),list_first_load=!1),$("div.noteslist div.listpart div.list ul li span.notesnames").unbind("click").click(function(){var t=$(this).parent().attr("noteid"),i=$(this).text();console.log('Oeffne: "'+i+'" ("'+t+'")'),maker(t,i)}),systemOfflineMode?$("span.noteseditbuttons").addClass("disable"):($("span.noteseditbuttons").removeClass("disable"),$("span.noteseditbuttons button").unbind("click").click(function(){var t=$(this).attr("art"),i=$(this).parent().parent().attr("noteid");$("div.noteslist div.listpart div.loading").removeClass("disable"),ajax_request("list",{userid:userinformation.id,art:t,noteid:i},function(s){$("div.noteslist div.listpart div.loading").addClass("disable"),"okay"===s.status&&(console.log('Notiz: "'+i+'" wurde '+("del"==t?"gelöscht":"up"==t?"nach oben verschoben":"nach unten verschoben")),list())})}))}}var list_first_load=!0;var cm_editor;function maker(e,t,a,i){if(void 0===a){var n=!1,o=!1;localStorage.setItem("note_maker_reopen",JSON.stringify({noteid:e,name:t}))}else{if("function"==typeof i)o=!0;else o=!1;n=!0}review("noteview");var d,r,s=!1;function l(){cm_editor.off("change",c),cm_editor.off("change",u),newerNoteOnServerFound=function(){}}var c,u;function g(){r=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(d.content)),localStorage.setItem("note_autosave_"+d.id,JSON.stringify(d)),$("input#notename").val(d.name),$("textarea#notesinput").text(d.content),"object"!=typeof cm_editor?cm_editor=CodeMirror.fromTextArea(document.getElementById("notesinput"),{mode:"gfm",lineNumbers:!0,theme:"default"}):cm_editor.setValue($("textarea#notesinput").val()),function(){var e=new marked.Renderer;e.heading=function(e,t){return""+e+""},e.link=function(e,t,a){return''+a+""},marked.setOptions({renderer:e,gfm:!0,tables:!0,highlight:function(e,t){if("tex"!=t)return-1!==["markup","css","clike","javascript","c","bash","cpp","csharp","ruby","git","ini","java","json","lua","markdown","matlab","objectivec","perl","php","python","r","sql","swift"].indexOf(t)?Prism.highlight(e,Prism.languages[t]):e;try{return katex.renderToString(e)}catch(e){return''+e.message+""}}});function t(e,t){var a=/(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);if(a&&void 0!==t&&1===t.text.length&&/^[A-Z]$/.test(t.text[0])){var i=$(":focus");i.blur(),i.focus()}$("div#notespreview").html(marked(cm_editor.getValue()))}t(),n&&!o?$("div.input.box").addClass("disable"):($("div.input.box").removeClass("disable"),cm_editor.on("change",t));c=t}(),function(){$("span.noteunsaved").tooltip(),$("span.notesaved").tooltip();function e(){var e=Date.now()-3e4>v,t={name:$("input#notename").val(),id:d.id,content:cm_editor.getValue(),lastserverchanged:d.lastserverchanged};localStorage.setItem("note_autosave_"+d.id,JSON.stringify(t)),e?f():($("span.noteunsaved").removeClass("disable"),$("span.notesaved").addClass("disable"))}cm_editor.on("change",e),u=e,$("span.noteunsaved").unbind("click").click(f)}()}var v=0;function f(a){if(r==sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(cm_editor.getValue())))"function"==typeof a&&a(!0);else{s?($("body").append('
Beim Speichern der Notiz kann es eventuell zu Datenverlust kommen, da die aktuellste Version nicht vom Server geladen werden konnte!
'),$("#dangerMessageNoteSave").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Gefahr des Datenverlustes!",buttons:{"Trotzdem Speichern":function(){$(this).dialog("close"),s=!1,l()},"Erstmal nicht":function(){$(this).dialog("close")}},close:function(){$(this).remove()}})):l();function l(){n&&o?(v=Date.now(),i(cm_editor.getValue(),!1)):!1===n&&(systemOfflineMode?(systemOfflineManager.saveNote(e,cm_editor.getValue(),$("input#notename").val()),v=Date.now(),"function"==typeof a&&a(!0)):($("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,note:{name:$("input#notename").val(),cont:cm_editor.getValue()}},function(i){if($("div.noteview div.loading").addClass("disable"),"okay"===i.status){if(console.log('Notiz: "'+t+'" ("'+e+'") auf Server gespeichert.'),v=Date.now(),4==i.data.length){d.lastserverchanged=i.data[3];var n=JSON.parse(localStorage.getItem("note_autosave_"+e));n.lastserverchanged=i.data[3],localStorage.setItem("note_autosave_"+e,JSON.stringify(n))}$("span.notesaved").removeClass("disable"),$("span.noteunsaved").addClass("disable")}"function"==typeof a&&a("okay"===i.status)},function(e){"function"==typeof a&&a(!1)})))}}}!function(){function i(a,i){a||systemOfflineMode||(s=!0,errorMessage("Kann die aktuelle Version der Notiz nicht vom Server holen.",20)),null!=localStorage.getItem("note_autosave_"+e)?(d=JSON.parse(localStorage.getItem("note_autosave_"+e)),g()):systemOfflineMode?(confirmDialog("Die gewäöhlte Notiz ist auf diesem Gerät leider nicht offline verfügbar!",{OK:function(){$(this).dialog("close")}},"Offlinemodus"),list()):(d={name:t,id:e,content:"# "+t+"\nUnd hier dann der Text!!\n",lastserverchanged:void 0!==i?i:0},g())}n?(d={name:t,id:e,content:a.content,lastserverchanged:a.lastchanged},$("div.noteview div.loading").addClass("disable"),g()):systemOfflineMode?($("div.noteview div.loading").addClass("disable"),i(!1)):($("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,history:2},function(e){$("div.noteview div.loading").addClass("disable"),"okay"===e.status?e.data.empty?i(!0,e.data.geandert):(d={name:e.data.name,id:e.data.id,content:e.data.content,lastserverchanged:e.data.geandert},g()):i(!1)},function(e){i(!1)}))}(),$("button#closenote").unbind("click").click(function(){l(),n&&o?i(cm_editor.getValue(),!0):n?(window.location.hash="",loginsys()):!1===n&&f(function(e){e?(localStorage.setItem("note_maker_reopen","none"),list()):($("body").append('
Die Speicherung der Notiz auf dem Server schlug fehl!
Wollen Sie den Editor verlassen und einen Verlust der Änderungen in Kauf nehmen oder abbrechen?
'),$("#errorMessageNoteSave").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Fehler beim Speichern!",buttons:{"Änderungen verwerfen":function(){localStorage.setItem("note_maker_reopen","none"),list(),$(this).dialog("close")},Abbrechen:function(){$(this).dialog("close")}},close:function(){$(this).remove()}}))})}),n||systemOfflineMode?($("button#publishnote").addClass("disable"),$("button#notehistory").addClass("disable")):($("button#publishnote").removeClass("disable"),$("button#notehistory").removeClass("disable"),$("button#publishnote").unbind("click").click(h),$("button#notehistory").unbind("click").click(b));function h(){function t(){errorMessage("Freigaben konnten nicht geladen werden."),$("div.noteview div.loading").addClass("disable")}$("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e},function(a){if("okay"===a.status){var i='
Konnte Aktion nicht durchführen.
',n=!1;$.each(a.data,function(e,t){n=!0,i+='',i+="",i+="",i+='",i+="",i+=''}),i+="
LinkNameErstelltBearbeitenLetzter Aufruf (Anzahl)Löschen
Aufrufen "+t.name+""+t.created+"'+t.edit+""+t.lastAccessed+" ("+t.accesses+")
",!1===n&&(i+="

Noch keine Freigaben!

"),i+='

Neue Freigabe


Bearbeiten erlauben Nur lesen
',$("body").append('
'+i+"
"),$("div.noteview div.loading").addClass("disable"),$("div#freigabeManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Freigaben",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),$("button.deleteFreigabe").click(function(){var t=$(this).attr("authcode");$("div.freigabeDialog.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,share:{authcode:t,edit:"leer",name:"leer"}},function(e){"okay"===e.status?($("div#freigabeManagerDialog").dialog("close"),h()):($("div.freigabeDialog.loading").addClass("disable"),$("div.freigabeDialog.error").removeClass("disable"))})}),$("button#addFreigabe").click(function(){var t=$("input#freigabeManagerNewName").val(),a="true"==$("input#freigabeManagerNewEdit:checked").val();""!=t&&($("div.freigabeDialog.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,share:{authcode:"leer",edit:a,name:t}},function(e){"okay"===e.status?($("div#freigabeManagerDialog").dialog("close"),h()):($("div.freigabeDialog.loading").addClass("disable"),$("div.freigabeDialog.error").removeClass("disable"))}))}),$("button.freigabeQR").click(function(){var e=$(this).attr("authcode"),t=domain+"/#"+e,a='

Code: '+e+'

URL:

Link: Aufrufen

';$("body").append('
'+a+"
"),$("div#freigabeManagerQRDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Freigabelink",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),new QRCode(document.getElementById("freigabeManagerQR"),t)})}else t()},t)}function b(){function t(){errorMessage("Notizverlauf konnte nicht geladen werden."),$("div.noteview div.loading").addClass("disable")}$("div.noteview div.loading").removeClass("disable"),ajax_request("view",{userid:userinformation.id,noteid:e,history:3},function(e){if("okay"===e.status){var a="";$.each(e.data,function(e,t){a+="",a+="'}),a+="
ÄnderungenZeitpunkt
"+t.diff+""+t.time+'
",$("body").append('
'+a+"
"),$("div.noteview div.loading").addClass("disable"),$("div#historyManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Notizverlauf",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),$("button.takeInputFromHistory").click(function(){var t=$(this).attr("key"),a=e.data[t].text;cm_editor.setValue(a),$("div#historyManagerDialog").dialog("close")})}else t()},t)}newerNoteOnServerFound=function(){!0,r==sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(cm_editor.getValue()))?(l(),maker(e,t)):(s=!0,confirmDialog("

Die Notiz ist auf dem Server verändert worden.
Wollen Sie die neue Version laden?

Dadurch können Ihre Änderungen verloren gehen! Andernfalls die Änderungen auf dem Server.

",{Ja:function(){l(),maker(e,t),!1,$(this).dialog("close")},Nein:function(){s=!1,f(),!1,$(this).dialog("close")}},"Änderung auf Server"))}}var newerNoteOnServerFound=function(){};function authCodeManager(){function e(e){$("div#authCodeManagerDialog").html(e)}function a(a){var s='

Authentifizierungslinks

';!1!==a?(s+="",a.forEach(function(e){s+=''}),s+="
Code (Anfang)Letzte NutzungLöschen
'+e.code+""+e.time+'
"):s+="

Sie haben noch keine Authentifizierungslinks!

",s+='

 

',e(s+='

Passwort ändern

Bitte geben Sie ein Passwort ein!
Bitte geben Sie das Passwort ein!
'),$("button#newPasswordSet").prop("disabled",!0),$("span.newPasswordIndikator").css({"border-radius":"5px",padding:"2px"}),$("button#newPasswordSet").click(function(){var e=$("input#newPasswordA").val(),a=$("input#newPasswordB").val();if(!o(e,a))return!1;$("div#newPasswordLoader").removeClass("disable"),ajax_request("account",{userid:userinformation.id},function(a){if("okay"===a.status){var n=a.data,s=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(e));s=sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(s+"+"+n)),ajax_request("account",{userid:userinformation.id,newpass:s,salt:n},function(e){$("div#newPasswordLoader").addClass("disable"),"okay"===e.status?($("div#newPasswordDone").removeClass("disable error"),$("div#newPasswordDone").addClass("okay"),$("div#newPasswordDone").text("Passwort geändert!")):($("div#newPasswordDone").removeClass("disable okay"),$("div#newPasswordDone").addClass("error"),$("div#newPasswordDone").text("Konnte Passwort nicht ändern!"))})}else $("div#newPasswordLoader").addClass("disable"),$("div#newPasswordDone").removeClass("disable okay"),$("div#newPasswordDone").addClass("error"),$("div#newPasswordDone").text("Konnte Passwort nicht ändern!")})}),$("input.newPassword").on("keyup",function(){o($("input#newPasswordA").val(),$("input#newPasswordB").val())?$("button#newPasswordSet").prop("disabled",!1):$("button#newPasswordSet").prop("disabled",!0)}),$("button.deleteAuthLink").click(function(){var e=$(this).attr("linkid"),a=$(this).attr("codeteil");confirm('Wollen sie den Code "'+a+'" wirklich löschen? ')&&($("div#authLinkLoading").removeClass("disable"),ajax_request("account",{userid:userinformation.id,art:"del",id:e},function(e){$("div#authLinkLoading").addClass("disable"),"okay"===e.status?n():alert("Konnte den Code nicht löschen!")}))}),$("button#addAuthLink").click(function(){$("div#authLinkLoading").removeClass("disable"),ajax_request("account",{userid:userinformation.id,art:"new",id:"new"},function(e){$("div#authLinkLoading").addClass("disable"),"okay"===e.status?(!function(e){var a=domain+"/#"+userinformation.name+":"+e,n='

Neuer Authentifizierungslink wurde erstellt:

Code: '+e+'

URL:

Link: Aufrufen

Achtung: Dieser Link und Code wird nur ein einziges Mal angezeigt!!

';$("body").append('
'+n+"
"),$("div#authCodeManagerNewCodeDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Neuer Authentifizierungslink",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),new QRCode(document.getElementById("authCodeManagerNewCodeDialogQR"),a)}(e.data),n()):alert("Konnte keinen Code erstellen!")})});function o(e,a){var n=!1;if($("span#newPasswordAIndikator").css({color:"white"}),""==e&&($("span#newPasswordAIndikator").css({"background-color":"inherit"}),$("span#newPasswordAIndikator").text("Bitte geben Sie ein Passwort ein!"),n=!0),""==a&&($("span#newPasswordBIndikator").css({"background-color":"inherit"}),$("span#newPasswordBIndikator").text("Bitte geben Sie das Passwort ein!"),n=!0),""!=e){var s,o=e,t=e.length,d=0;t>5?((d+=5*(t-=5))>20&&(d=20),o.match(/([a-zA-Z])/)&&(d+=10),o.match(/([A-Z])/)&&(d+=5),o.match(/([0-9])/)&&(d+=5),o.match(/([0-9].*[0-9])/)&&(d+=10),o.match(/([0-9].*[0-9].*[0-9])/)&&(d+=10),o.match(/([!,%,&,@,#,*,?,_,])/)&&(d+=15),o.match(/([!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,])/)&&(d+=15),o.match(/([!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,].*[!,%,&,@,#,*,?,_,])/)&&(d+=15)):d=0,d<=25?(s="Das soll ein Passwort sein?",$("span#newPasswordAIndikator").css({"background-color":"red"})):d<=50?(s="Gut, aber es geht noch besser!",$("span#newPasswordAIndikator").css({"background-color":"orange"}),$("span#newPasswordAIndikator").css({color:"black"})):d<=75?(s="Das sieht doch super aus!",$("span#newPasswordAIndikator").css({"background-color":"yellow"}),$("span#newPasswordAIndikator").css({color:"black"})):d<=100&&(s="Da werden die Hacker schwitzen!",$("span#newPasswordAIndikator").css({"background-color":"green"})),$("span#newPasswordAIndikator").text(s)}return e!=a&&""!=e&&""!=a&&($("span#newPasswordBIndikator").css({"background-color":"red"}),$("span#newPasswordBIndikator").text("Die Passwörter stimmen nicht überein!"),n=!0),!n&&($("span#newPasswordBIndikator").css({"background-color":"green"}),$("span#newPasswordBIndikator").text("Passwörter stimmen überein!"),!0)}}$("body").append('
Lädt ...
'),$("div#authCodeManagerDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Authentifizierungslinks und Passwort",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}});function n(){ajax_request("account",{userid:userinformation.id,art:"list",id:"list"},function(n){"okay"===n.status?a(n.data):e("Kann nicht laden!")})}n()}function oldNotesManager(){function t(t){t='
'+t,$("div#oldNotesDialog").html(t)}$("body").append('
'),$("div#oldNotesDialog").dialog({resizable:!1,height:"auto",width:"auto",modal:!0,title:"Notizarchiv",close:function(){$(this).remove()},position:{my:"center",at:"center",of:$("div.main")}}),t("Lädt ..."),$("div#oldNotesDialogLoader").removeClass("disable"),ajax_request("list",{userid:userinformation.id,reload:"none"},function(o){if($("div#oldNotesDialogLoader").addClass("disable"),"okay"===o.status){var e="";o.data.forEach(function(t){e+="'}),t(e+="
NameZuletzt geändertWiederherstellen
"+t.name+""+t.geaendert+'
"),$("button.oldNotesDialogReload").click(function(){var t=$(this).attr("noteid");$("div#oldNotesDialogLoader").removeClass("disable"),ajax_request("list",{userid:userinformation.id,reload:t},function(t){$("div#oldNotesDialogLoader").addClass("disable"),"okay"===t.status?(list(),$("div#oldNotesDialog").dialog("close")):alert("Konnte die Notiz nicht wiederherstellen!")})})}else t("Konnte nicht laden!!")})}function shareviewer(e,n){var a,t=0,i=!1;function r(){ajax_request("share",{authcode:e},function(n){systemOfflineMode?(errorMessage("Offline können keine Freigaben geöffnet werden!"),o()):"okay"===n.status?(t=n.data.geandert,i=n.data.edit,n.data.edit?(maker(n.data.id,n.data.name,{content:n.data.content,lastchanged:n.data.geandert},function(n,i){$("div.noteview div.loading").removeClass("disable"),ajax_request("share",{authcode:e,cont:n},function(e){$("div.noteview div.loading").addClass("disable"),t=e.data[3],"okay"===e.status?($("span.notesaved").removeClass("disable"),$("span.noteunsaved").addClass("disable")):errorMessage("Konnte Notiz nicht speichern!"),r(!("okay"===e.status))},function(e){$("div.noteview div.loading").addClass("disable"),errorMessage("Konnte Notiz nicht speichern!"),r(!0)});function r(e){i&&(e&&!confirm("Konnte nicht Notiz speichern, trotzdem schließen?")||(clearInterval(a),window.location.hash="",loginsys()))}}),s()):(maker(n.data.id,n.data.name,{content:n.data.content,lastchanged:n.data.geandert}),s())):(errorMessage("Nachricht lässt sich mittels Freigabelink nicht öffnen.",!1),o())},function(e){o()})}r();function o(){"function"==typeof n&&n()}function s(){a=setInterval(function(){ajax_request("share",{authcode:e},function(e){"error"===e.status?errorMessage("Die Freigabe kann nichtmehr erreicht werden",!1):(console.log(e.data.geandert-t,e.data.geandert,t),e.data.geandert-t>5&&(clearInterval(a),i?confirmDialog("

Die Notiz ist auf dem Server verändert worden.
Wollen Sie die neue Version laden?

Dadurch können Ihre Änderungen verloren gehen!

",{Ja:function(){r(),$(this).dialog("close")},Abbrechen:function(){$(this).dialog("close")}},"Änderung auf Server"):r()))})},1e3*global_polling_secs)}} \ No newline at end of file diff --git a/system/php/systemInit.php b/system/php/systemInit.php index 6435751..70eef9f 100644 --- a/system/php/systemInit.php +++ b/system/php/systemInit.php @@ -53,27 +53,16 @@ abstract class SystemInit{ //Name für Impressum 'impressumName' => 'Impressum & Datenschutz', //Markdown Info Link anzeigen - 'showMarkdownInfo' => true + 'showMarkdownInfo' => true, + //Polling mittels JS des Servers für Änderungen (Zeit in sec.) + 'sysPoll' => 60, + //AppCache aktivieren? + 'AppCache' => true ); - //Array Externe Libs - // Relative Angabe für globalen Ordner - private static $externeLibs = array( - 'fonts' => '/fonts.css', - 'jqueryuiCSS' => '/jquery-ui.min.css', - 'jqueryui' => '/jquery-ui.min.js', - 'jquery' => '/jquery.min.js', - 'sjcl' => '/sjcl.min.js', - 'qrcode' => '/qrcode.min.js', - ); - - //Ordner mit allen Libs - // false oder URL - private static $globalfolder = 'http://localhost:8000/js-libs'; - //Sytemversion // [ Hauptversionsnummer, Unternummer, Patch ] => [1, 23, 5] -> 1.23.5 - const SYSTEMVERSION = [ 0, 9, 0 ]; + const SYSTEMVERSION = [ 0, 9, 5 ]; /* Auslesen der Konfiguration @@ -87,37 +76,10 @@ private static function readConfig(){ if( self::$readConfFile == false ){ $json = new JSONReader( 'config' ); - //Konfigurationsarray - try{ - self::$config = $json->getValue(['config'], true); - }catch( Exception $e ){ - //nicht vorhanden, dann Standardwerte von oben - } - - //Externe Bibilotheken Array - try{ - //Ordner der Libs einlesen - $folder = $json->getValue(['externeLibs',0], true); - }catch( Exception $e ){ - //keiner gegeben - $folder = self::$globalfolder; - } - - //Folder == false => Array enthält vollständiges URLs - if( $folder === false ){ - try{ - //Array so übernehmen - self::$externeLibs = $json->getValue(['externeLibs',1], true); - }catch( Exception $e ){ - //Installation fehlerhaft - die( 'This Version of KIMB-Notes is not installed properly!' ); - } - } - else{ - foreach( self::$externeLibs as $key => $val ){ - $new_array[$key] = $folder . $val; - } - self::$externeLibs = $new_array; + //Konfigurationsarray leer? + $cf = $json->getValue([], true); + if( !empty($cf) ){ + self::$config = $cf; } //fertig eingelesen @@ -145,21 +107,5 @@ public static function get( $key ){ return false; } } - - //Getter fuer Externe Bibilotheken - // $key => Schlüssel - // Return => Wert oder false - public static function getExtLib( $key ){ - //KonfFile einlesen - self::readConfig(); - - //Wert vorhanden? - if( !empty( self::$externeLibs[$key] ) ){ - return self::$externeLibs[$key]; - } - else{ - return false; - } - } } ?> \ No newline at end of file