v0.6
parent
4618680737
commit
bb02f76a79
|
@ -22,6 +22,8 @@ ENV HOST=0.0.0.0\
|
|||
|
||||
USER node:node
|
||||
|
||||
VOLUME /usr/src/app/data
|
||||
|
||||
EXPOSE ${PORT}
|
||||
STOPSIGNAL SIGINT
|
||||
ENTRYPOINT [ "bash", "docker-entrypoint.sh" ]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Test it in seconds :
|
||||
|
||||
```bash
|
||||
docker run --rm -d -p 7777:7777 hastepad:0.5
|
||||
docker run --rm -d -p 7777:7777 mtudury/hastepad:0.6
|
||||
```
|
||||
Open your browser and type url : http://127.0.0.1:7777/
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ version: '3.6'
|
|||
services:
|
||||
haste-server:
|
||||
build: .
|
||||
image: hastepad:0.5
|
||||
image: hastepad:0.6
|
||||
ports:
|
||||
- 7777:7777
|
||||
volumes:
|
||||
|
|
|
@ -133,6 +133,30 @@ textarea {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
#box4 ul {
|
||||
margin-block-start: 3px;
|
||||
margin-block-end: 3px;
|
||||
padding-inline-start: 0;
|
||||
background: #00222b;
|
||||
}
|
||||
|
||||
#box4 li {
|
||||
display: block;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
#box4 a {
|
||||
display:block;
|
||||
padding-left: 10px;
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#box4 a:hover {
|
||||
background: #173e48;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#box2 .function.save { background-position: -5px top; }
|
||||
#box2 .function.enabled.save { background-position: -5px center; }
|
||||
#box2 .function.enabled.save:hover { background-position: -5px bottom; }
|
||||
|
@ -141,17 +165,21 @@ textarea {
|
|||
#box2 .function.enabled.new { background-position: -42px center; }
|
||||
#box2 .function.enabled.new:hover { background-position: -42px bottom; }
|
||||
|
||||
#box2 .function.duplicate { background-position: -79px top; }
|
||||
#box2 .function.enabled.duplicate { background-position: -79px center; }
|
||||
#box2 .function.enabled.duplicate:hover { background-position: -79px bottom; }
|
||||
#box2 .function.edit { background-position: -79px top; }
|
||||
#box2 .function.enabled.edit { background-position: -79px center; }
|
||||
#box2 .function.enabled.edit:hover { background-position: -79px bottom; }
|
||||
|
||||
#box2 .function.raw { background-position: -116px top; }
|
||||
#box2 .function.enabled.raw { background-position: -116px center; }
|
||||
#box2 .function.enabled.raw:hover { background-position: -116px bottom; }
|
||||
|
||||
#box2 .function.twitter { background-position: -153px top; }
|
||||
#box2 .function.enabled.twitter { background-position: -153px center; }
|
||||
#box2 .function.enabled.twitter:hover { background-position: -153px bottom; }
|
||||
#box2 .function.duplicate { background-position: -153px top; }
|
||||
#box2 .function.enabled.duplicate { background-position: -153px center; }
|
||||
#box2 .function.enabled.duplicate:hover { background-position: -153px bottom; }
|
||||
|
||||
#box2 .function.delete { background-position: -190px top; }
|
||||
#box2 .function.enabled.delete { background-position: -190px center; }
|
||||
#box2 .function.enabled.delete:hover { background-position: -190px bottom; }
|
||||
#box2 .button-picture{ border-width: 0; font-size: inherit; }
|
||||
|
||||
#messages {
|
||||
|
|
|
@ -86,6 +86,28 @@ haste_document.prototype.save = function(key, data, callback) {
|
|||
});
|
||||
};
|
||||
|
||||
// Save this document to the server and lock it here
|
||||
haste_document.prototype.deleteDocument = function(key, callback) {
|
||||
if (!this.locked) {
|
||||
return false;
|
||||
}
|
||||
var _this = this;
|
||||
$.ajax('/documents/' + key, {
|
||||
type: 'delete',
|
||||
success: function(res) {
|
||||
callback(null, res);
|
||||
},
|
||||
error: function(res) {
|
||||
try {
|
||||
callback($.parseJSON(res.responseText));
|
||||
}
|
||||
catch (e) {
|
||||
callback({message: 'Something went wrong!'});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// get a valid key from server
|
||||
haste_document.prototype.getkey = function(callback) {
|
||||
$.ajax('/key/', {
|
||||
|
@ -143,12 +165,12 @@ haste.prototype.lightKey = function() {
|
|||
|
||||
// Show the full key
|
||||
haste.prototype.fullKey = function() {
|
||||
this.configureKey(['new', 'duplicate', 'twitter', 'raw']);
|
||||
this.configureKey(['new', 'duplicate', 'edit', 'raw', 'delete']);
|
||||
};
|
||||
|
||||
// Show all the keys
|
||||
haste.prototype.allKey = function() {
|
||||
this.configureKey(['new', 'save', 'duplicate', 'twitter', 'raw']);
|
||||
this.configureKey(['new', 'save', 'duplicate', 'edit', 'raw', 'delete']);
|
||||
};
|
||||
|
||||
// Set the key up for certain things to be enabled
|
||||
|
@ -323,7 +345,7 @@ haste.prototype.unlockDocument = function() {
|
|||
var _this = this;
|
||||
_this.$textarea.val(_this.$code.text()).show().focus();
|
||||
_this.$box.hide();
|
||||
_this.allKey();
|
||||
_this.lightKey();
|
||||
_this.removeLineNumbers();
|
||||
_this.doc.locked = false;
|
||||
};
|
||||
|
@ -378,16 +400,31 @@ haste.prototype.configureButtons = function() {
|
|||
}
|
||||
},
|
||||
{
|
||||
$where: $('#box2 .twitter'),
|
||||
$where: $('#box2 .edit'),
|
||||
label: 'Edit',
|
||||
shortcut: function(evt) {
|
||||
return _this.options.twitter && _this.doc.locked && evt.shiftKey && evt.ctrlKey && evt.keyCode == 84;
|
||||
return _this.doc.locked && evt.shiftKey && evt.ctrlKey && evt.keyCode == 84;
|
||||
},
|
||||
shortcutDescription: 'control + shift + t',
|
||||
action: function() {
|
||||
//window.open('https://twitter.com/share?url=' + encodeURI(window.location.href));
|
||||
_this.unlockDocument();
|
||||
}
|
||||
},
|
||||
{
|
||||
$where: $('#box2 .delete'),
|
||||
label: 'Delete',
|
||||
shortcut: function(evt) {
|
||||
return false;
|
||||
},
|
||||
shortcutDescription: 'none',
|
||||
action: function() {
|
||||
_this.doc.deleteDocument(_this.getCurrentKey(), function () {
|
||||
_this.$box.html('');
|
||||
_this.removeLineNumbers();
|
||||
_this.showMessage("Deleted");
|
||||
_this.updateList();
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
for (var i = 0; i < this.buttons.length; i++) {
|
||||
|
@ -422,8 +459,11 @@ haste.prototype.updateList = function () {
|
|||
_this.getList(function (lst) {
|
||||
if (lst) {
|
||||
var lis = "";
|
||||
var cnt = 0;
|
||||
lst.forEach(function (file) {
|
||||
lis+= '<li><a href="'+file+'">'+file+'</a></li>';
|
||||
if (cnt < 150)
|
||||
lis+= '<li><a href="'+file+'">'+file+'</a></li>';
|
||||
cnt++;
|
||||
});
|
||||
$('#list').html(lis);
|
||||
}
|
||||
|
@ -461,7 +501,7 @@ haste.prototype.autosave = function() {
|
|||
});
|
||||
_this.doc.changed = false;
|
||||
}
|
||||
window.setTimeout(cycle, 15000);
|
||||
window.setTimeout(cycle, 5000);
|
||||
};
|
||||
|
||||
window.setTimeout(cycle, 5000);
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 13 KiB |
|
@ -50,9 +50,10 @@
|
|||
<div id="box2">
|
||||
<button class="save function button-picture">Save</button>
|
||||
<button class="new function button-picture">New</button>
|
||||
<button class="duplicate function button-picture">Duplicate & Edit</button>
|
||||
<button class="edit function button-picture">Edit</button>
|
||||
<button class="raw function button-picture">Just Text</button>
|
||||
<button class="twitter function button-picture">Edit</button>
|
||||
<button class="duplicate function button-picture">Duplicate & Edit</button>
|
||||
<button class="delete function button-picture">Delete</button>
|
||||
</div>
|
||||
<div id="box3" style="display:none;">
|
||||
<div class="label"></div>
|
||||
|
|
Loading…
Reference in New Issue