Compare commits
5 Commits
084c27653b
...
84baa60a2b
Author | SHA1 | Date |
---|---|---|
quenousimporte | 84baa60a2b | |
quenousimporte | 959a68a4bb | |
quenousimporte | cd8d52249c | |
quenousimporte | fb84c7f4ea | |
quenousimporte | ffc90cf9fa |
4
home.php
4
home.php
|
@ -1,9 +1,7 @@
|
|||
<form action="index.php" method="GET">
|
||||
<div>
|
||||
<input hidden type="submit" name="search" value="search" accesskey="s">
|
||||
<input type="submit" name="open" value="open" accesskey="o">
|
||||
<input type="submit" name="tags" value="tags" accesskey="t">
|
||||
<input type="submit" name="clip" value="clip" accesskey="c">
|
||||
<input type="submit" name="new" value="new" accesskey="o">
|
||||
<input type="submit" name="download" value="download" accesskey="d">
|
||||
<br>
|
||||
<input placeholder="search..." autofocus autocomplete="off" class="title" name="param" value="<?php if (!isset($_GET['home']) && !isset($_POST['home'])) echo $param; ?>">
|
||||
|
|
47
index.php
47
index.php
|
@ -80,7 +80,7 @@
|
|||
$path = $dir . '/' . $title;
|
||||
$lastchanged = filemtime($path);
|
||||
$previous = $_POST['lastchanged'];
|
||||
if (!isset($_GET['clip']) && (int)$lastchanged > (int)$previous)
|
||||
if ((int)$lastchanged > (int)$previous)
|
||||
{
|
||||
$tempcontent = file_get_contents($path . '.md');
|
||||
if ($tempcontent != $content)
|
||||
|
@ -130,13 +130,7 @@
|
|||
{
|
||||
downloadall();
|
||||
}
|
||||
else if (isset($_GET['clip']) && $_GET['param'])
|
||||
{
|
||||
$content = $_GET['param'] . "\r\n" . file_get_contents($dir . '/todo.md');
|
||||
savenote('todo', $content);
|
||||
$_GET['param'] = '';
|
||||
}
|
||||
else if (isset($_POST['save']) || isset($_POST['home']) || isset($_POST['links']) || isset($_POST['stats']) || isset($_POST['download']))
|
||||
else if (isset($_POST['save']) || isset($_POST['home']) || isset($_POST['download']))
|
||||
{
|
||||
$title = $_POST['title'];
|
||||
$content = $_POST['content'];
|
||||
|
@ -184,6 +178,10 @@
|
|||
$nextpage = 'note';
|
||||
$title = $_GET['param'];
|
||||
}
|
||||
else if (isset($_GET['new']))
|
||||
{
|
||||
$nextpage = 'note';
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -255,46 +253,19 @@
|
|||
|
||||
foreach($_SESSION['index'] as $path)
|
||||
{
|
||||
$tags = '';
|
||||
$name = basename($path);
|
||||
if (!str_ends_with($name, '.del'))
|
||||
{
|
||||
if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags']))
|
||||
if (($_GET['param'] && isset($_GET['search'])))
|
||||
{
|
||||
$content = file_get_contents($path . '.md');
|
||||
if (
|
||||
// param does not match content or title
|
||||
(isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param))) ||
|
||||
// param does not match tags
|
||||
(isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content))
|
||||
)
|
||||
if (isset($_GET['search']) && !str_contains(cleanstring($content), cleanstring($param)) && !str_contains(cleanstring($name), cleanstring($param)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (isset($_GET['search']) && $param == $name)
|
||||
{
|
||||
header('Location: index.php?open=true¶m=' . urlencode($name));
|
||||
die();
|
||||
}
|
||||
}
|
||||
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
||||
if (isset($content) && isset($_GET['tags']))
|
||||
{
|
||||
$tags = array();
|
||||
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
|
||||
if ($hastags)
|
||||
{
|
||||
$tagslist = explode(',', $tags[0][1]);
|
||||
echo '<span class="grey"> ';
|
||||
foreach ($tagslist as $tag)
|
||||
{
|
||||
$tag = trim($tag);
|
||||
echo('<a class="grey" href="index.php?tags=true¶m=' . $tag . '">' . $tag . '</a> ');
|
||||
}
|
||||
echo '</span>';
|
||||
}
|
||||
}
|
||||
else if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
||||
if (isset($_GET['search']) && str_contains(cleanstring($content), cleanstring($param)))
|
||||
{
|
||||
$pos = strpos(cleanstring($content), cleanstring($param));
|
||||
echo '<span class="grey"> ' . $param . substr($content, $pos + strlen($param), 42) . '</span>';
|
||||
|
|
15
note.php
15
note.php
|
@ -3,24 +3,17 @@
|
|||
<input type="submit" name="home" value="home" accesskey="h">
|
||||
<input type="submit" name="save" value="save" accesskey="s">
|
||||
<input type="submit" name="preview" value="preview" accesskey="p" formtarget="_blank">
|
||||
<input type="submit" name="links" value="links" accesskey="l">
|
||||
<input type="submit" name="stats" value="stats" accesskey="i">
|
||||
<input type="submit" name="download" value="download" accesskey="d">
|
||||
<input type="submit" name="delete" value="delete">
|
||||
<input hidden name="lastchanged" value="<? echo $lastchanged; ?>">
|
||||
<?php
|
||||
if (isset($_POST['stats']))
|
||||
{
|
||||
echo '<div class="grey">' . $lines . ' ' . $words . ' ' . $chars . ' ' . $title . '.md</div>';
|
||||
}
|
||||
else if (isset($_POST['links']))
|
||||
{
|
||||
echo linksdiv($content);
|
||||
}?>
|
||||
<div><input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"></div>
|
||||
</div>
|
||||
<div class="editor">
|
||||
<textarea rows="<? echo $rows; ?>" autofocus name="content" spellcheck="false"><? echo $content; ?></textarea>
|
||||
</div>
|
||||
<input hidden name="previoustitle" value="<? echo $title; ?>">
|
||||
<?php
|
||||
echo '<div class="grey">' . $lines . ' ' . $words . ' ' . $chars . ' ' . $title . '.md</div>';
|
||||
echo linksdiv($content);
|
||||
?>
|
||||
</form>
|
||||
|
|
10
readme.md
10
readme.md
|
@ -14,8 +14,6 @@ No javascript.
|
|||
|------------------------|----------------------------------|-------------------------------|--------|
|
||||
| search (default action)| full text search | reload home | alt-s |
|
||||
| open | open if exists, or create | create with timestamp as title| alt-o |
|
||||
| tag | filter list by tag | show all tags in list | alt-t |
|
||||
| clip | insert in todo | | alt-c |
|
||||
| download | download all notes in a zip file | | alt-d |
|
||||
|
||||
| Note page | action with param | hotkey |
|
||||
|
@ -23,18 +21,10 @@ No javascript.
|
|||
| home (default action) | save and back to home | alt-h |
|
||||
| save | save | alt-s |
|
||||
| preview | save and show markdown preview | alt-p |
|
||||
| links | save and show links | alt-l |
|
||||
| stats | save and show stats | alt-i |
|
||||
| delete | delete (rename as .del) | alt-d |
|
||||
|
||||
| On list | action |
|
||||
|------------------------|--------------------------|
|
||||
| clic on tag | filter list by tag (home with tags+param) |
|
||||
|
||||
| Url params | action |
|
||||
|------------------------|--------------------------|
|
||||
| reindex | force notes reindex |
|
||||
| clip+param | same as button |
|
||||
| open+param | same as button |
|
||||
| tags+param | same as button |
|
||||
| search+param | same as button |
|
Loading…
Reference in New Issue