Improve wording in comments
This commit is contained in:
parent
dac31aa351
commit
31499d4f21
|
@ -4,7 +4,7 @@
|
|||
$base_url = 'https://notes.orga.cat';
|
||||
|
||||
// Path to the directory to save the notes in, without trailing slash.
|
||||
// Should be outside of the document root, if possible.
|
||||
// Should be outside the document root, if possible.
|
||||
$save_path = '_tmp';
|
||||
|
||||
// Disable caching.
|
||||
|
@ -12,7 +12,7 @@ header('Cache-Control: no-cache, no-store, must-revalidate');
|
|||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
|
||||
// If no name is provided or it contains invalid characters or it is too long.
|
||||
// If no name is provided, or if it contains invalid characters, or if it is too long.
|
||||
if (!isset($_GET['note']) || !preg_match('/^[a-zA-Z0-9_-]+$/', $_GET['note']) || strlen($_GET['note']) > 64) {
|
||||
|
||||
// Generate a name with 5 random unambiguous characters. Redirect to it.
|
||||
|
@ -34,7 +34,7 @@ if (isset($_POST['text'])) {
|
|||
die;
|
||||
}
|
||||
|
||||
// Print raw file if the client is curl, wget, or when explicitly requested.
|
||||
// Print raw file when explicitly requested, or if the client is curl or wget.
|
||||
if (isset($_GET['raw']) || strpos($_SERVER['HTTP_USER_AGENT'], 'curl') === 0 || strpos($_SERVER['HTTP_USER_AGENT'], 'Wget') === 0) {
|
||||
if (is_file($path)) {
|
||||
header('Content-type: text/plain');
|
||||
|
|
11
script.js
11
script.js
|
@ -1,18 +1,15 @@
|
|||
/*! Minimalist Web Notepad | https://github.com/pereorga/minimalist-web-notepad */
|
||||
|
||||
function uploadContent() {
|
||||
|
||||
// If textarea value changes.
|
||||
if (content !== textarea.value) {
|
||||
var temp = textarea.value;
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
request.open('POST', window.location.href, true);
|
||||
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||
request.onload = function() {
|
||||
if (request.readyState === 4) {
|
||||
|
||||
// Request has ended, check again after 1 second.
|
||||
// If the request has ended, check again after 1 second.
|
||||
content = temp;
|
||||
setTimeout(uploadContent, 1000);
|
||||
}
|
||||
|
@ -24,13 +21,13 @@ function uploadContent() {
|
|||
}
|
||||
request.send('text=' + encodeURIComponent(temp));
|
||||
|
||||
// Make the content available to print.
|
||||
// Update the printable contents.
|
||||
printable.removeChild(printable.firstChild);
|
||||
printable.appendChild(document.createTextNode(temp));
|
||||
}
|
||||
else {
|
||||
|
||||
// Content has not changed, check again after 1 second.
|
||||
// If the content has not changed, check again after 1 second.
|
||||
setTimeout(uploadContent, 1000);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +36,7 @@ var textarea = document.getElementById('content');
|
|||
var printable = document.getElementById('printable');
|
||||
var content = textarea.value;
|
||||
|
||||
// Make the content available to print.
|
||||
// Initialize the printable contents with the initial value of the textarea.
|
||||
printable.appendChild(document.createTextNode(content));
|
||||
|
||||
textarea.focus();
|
||||
|
|
Loading…
Reference in New Issue