initial commit

This commit is contained in:
quenousimporte 2023-01-18 12:34:55 +01:00 committed by GitHub
parent bed65c6b40
commit 7ed60f58e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1755 additions and 0 deletions

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

50
handler.php Normal file
View File

@ -0,0 +1,50 @@
<?php
// global settings
$datafile = '../data/data.json';
$password = '';
// check authent
if ($password && (!isset($_POST['password']) || $_POST['password'] != $password))
{
echo '{"error": "authent"}';
}
else if (isset($_POST['action']))
{
$action = $_POST['action'];
switch ($action)
{
case 'fetch':
if (file_exists($datafile))
{
echo file_get_contents($datafile);
}
else
{
echo '[]';
}
break;
case 'push':
$result = file_put_contents($datafile, $_POST['data']);
if ($result === false)
{
echo '{"error": "could not save ' . $datafile . '"}';
}
else
{
echo '{}';
}
break;
default:
echo '{"error": "unknown action ' . $action . '"}';
break;
}
}
else
{
echo '{"error": "missing action parameter"}';
}
?>

45
index.html Normal file
View File

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>notes</title>
<link href="https://fonts.cdnfonts.com/css/inconsolata-2" rel="stylesheet">
</head>
<body onload="init()" onkeydown="mainkeydownhandler()" onresize="resize()">
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js" integrity="sha512-LhccdVNGe2QMEfI3x4DVV3ckMRe36TfydKss6mJpdHjNFiV07dFpS2xzeZedptKZrwxfICJpez09iNioiSZ3hA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="main.js"></script>
<div id="authentpage" hidden>
<div id="bigtitle">notes</div>
<div>
<input id="password" type="password" placeholder="pass phrase..." onkeydown="sendpassword()" onblur="sendpassword()" ></input>
</div>
</div>
<div id="searchdialog" oninput="applyfilter()" hidden>
<div>
<input id="filter" placeholder="search..." autocomplete="off"></input>
</div>
<div id="filteredlist" hidden></div>
</div>
<div id="notepage">
<div id="topbar" onclick="ontopbarclick()">
<span id="titlecontainer">
<input id="title" onchange="ontitlechange()" hidden/>
</span>
<span id="mark">&nbsp;</span>
</div>
<div id="notecontent">
<textarea id="md" spellcheck="false" oninput="notecontentchanged()" onkeydown="editorkeydown()" ondblclick="checkfolding()"></textarea>
<div hidden id="preview"></div>
</div>
</div>
</body>
</html>

1478
main.js Normal file

File diff suppressed because it is too large Load Diff

38
readme.md Normal file
View File

@ -0,0 +1,38 @@
# notes
## getting started
### local
* download files
* launch index.html
for a more app-feel on windows, try:
```
chrome_proxy.exe --app=index.html
```
### remote
* put files on your php web server
* navigate to index.html
* edit settings (ctrl+shift+p, settings)
* change: remote=true
* reload page
to protect your data by a password, edit handler.php and change `$password` variable.
your password will be sent from browser to server through a POST http query with no more encryption than ssl, if enabled. it is stored unencrypted in your browser local storage.
## usage
* help: f1
* notes list: ctrl+p
* command palette: ctrl+shift+p
## reclaim you data
your notes are stored in your browser local storage. download them in a single json file with ctrl+shift+s.
write a moulinette to flatten them as md files.

21
split.css Normal file
View File

@ -0,0 +1,21 @@
body {
margin: 0;
}
div {
width: 100%;
}
iframe {
width: 50%;
height: 100%;
border: none;
}
#left {
float: left;
}
#right {
float: right;
}

17
split.html Normal file
View File

@ -0,0 +1,17 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="split.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>notes</title>
</head>
<body>
<div>
<iframe src="index.html" id="left" name="left"></iframe>
<iframe src="index.html" id="right" name="right"></iframe>
</div>
</body>
</html>

106
style.css Normal file
View File

@ -0,0 +1,106 @@
/* globals */
body {
margin-left: 5%;
margin-right: 5%;
font-size: 90%;
line-height: 130%;
caret-color: #5AA7CE;
}
input {
outline: none;
border: none;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
/* scrollbars */
:root
{
scrollbar-width: thin;
scrollbar-color: RGBA(90, 167, 206, 0.5) lightgray;
}
body::-webkit-scrollbar {
height: 5px;
width: 5px;
background-color: lightgray;
}
body::-webkit-scrollbar-thumb {
background-color: RGBA(90, 167, 206, 0.5);
border-radius: 10px;
}
/* note page and editor */
#notepage {
width: 100%;
}
#md {
outline: none;
border: none;
width: 100%;
resize: none;
font-family: inherit;
font-size: inherit;
line-height: inherit;
background-color: inherit;
}
/* top bar content */
#topbar {
height: 50px;
width: 100%;
}
#topbar > span {
display: table-cell;
}
#titlecontainer {
width: 100%;
}
#title {
width: 100%;
padding-top: 10px;
font-size: 20px;
background-color: inherit;
}
/* search file dialog */
.selected {
background-color: darkgray;
}
#filter {
width: 100%;
/* wm style
background-color: #f0f0f0;
*/
}
#searchdialog {
position: absolute;
top: 0;
background-color: lightgray;
opacity: 1;
width: 90%;
}
/* authent */
#bigtitle {
font-size: 50px;
line-height: 100%;
}