Compare commits
1 Commits
jsonp
...
toggle_key
Author | SHA1 | Date | |
---|---|---|---|
|
2c466d069b |
@@ -20,6 +20,14 @@ to do things like:
|
|||||||
which will output a URL to share containing the contents of `cat something`'s
|
which will output a URL to share containing the contents of `cat something`'s
|
||||||
STDOUT. Check the README there for more details and usages.
|
STDOUT. Check the README there for more details and usages.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Please consider paying what you feel this project is worth:
|
||||||
|
|
||||||
|
<a href="https://www.stripeme.com/pay/1r2f">
|
||||||
|
<img alt="Pay" src="https://www.stripeme.com/pay.jpg" />
|
||||||
|
</a>
|
||||||
|
|
||||||
## Tested Browsers
|
## Tested Browsers
|
||||||
|
|
||||||
* Firefox 8
|
* Firefox 8
|
||||||
|
@@ -15,23 +15,12 @@ var DocumentHandler = function(options) {
|
|||||||
DocumentHandler.defaultKeyLength = 10;
|
DocumentHandler.defaultKeyLength = 10;
|
||||||
|
|
||||||
// Handle retrieving a document
|
// Handle retrieving a document
|
||||||
DocumentHandler.prototype.handleGet = function(key, callback, response, skipExpire) {
|
DocumentHandler.prototype.handleGet = function(key, response, skipExpire) {
|
||||||
this.store.get(key, function(ret) {
|
this.store.get(key, function(ret) {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
winston.verbose('retrieved document', { key: key });
|
winston.verbose('retrieved document', { key: key });
|
||||||
var responseData = JSON.stringify({ data: ret, key: key });
|
|
||||||
if (callback) {
|
|
||||||
if (callback.match(/^[a-z0-9]+$/i)) {
|
|
||||||
response.writeHead(200, { 'content-type': 'application/javascript' });
|
|
||||||
response.end(callback + '(' + responseData + ');');
|
|
||||||
} else {
|
|
||||||
response.writeHead(400, { 'content-type': 'application/json' });
|
|
||||||
response.end(JSON.stringify({ message: 'invalid callback function name' }));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
response.writeHead(200, { 'content-type': 'application/json' });
|
response.writeHead(200, { 'content-type': 'application/json' });
|
||||||
response.end(responseData);
|
response.end(JSON.stringify({ data: ret, key: key }));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
winston.warn('document not found', { key: key });
|
winston.warn('document not found', { key: key });
|
||||||
|
@@ -29,7 +29,7 @@ RedisDocumentStore.connect = function(options) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
winston.error(
|
winston.error(
|
||||||
'error connecting to redis index ' + index,
|
'error connecting to redis index ' + index,
|
||||||
{ error: err }
|
{ error: err.message }
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -116,10 +116,8 @@ connect.createServer(
|
|||||||
// get documents
|
// get documents
|
||||||
app.get('/documents/:id', function(request, response, next) {
|
app.get('/documents/:id', function(request, response, next) {
|
||||||
var skipExpire = !!config.documents[request.params.id];
|
var skipExpire = !!config.documents[request.params.id];
|
||||||
var parsedUrl = url.parse(request.url, true);
|
|
||||||
return documentHandler.handleGet(
|
return documentHandler.handleGet(
|
||||||
request.params.id,
|
request.params.id,
|
||||||
parsedUrl.query.callback,
|
|
||||||
response,
|
response,
|
||||||
skipExpire
|
skipExpire
|
||||||
);
|
);
|
||||||
|
@@ -362,6 +362,11 @@ haste.prototype.configureShortcuts = function() {
|
|||||||
///// Tab behavior in the textarea - 2 spaces per tab
|
///// Tab behavior in the textarea - 2 spaces per tab
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
var $key = $('#key');
|
||||||
|
$(document).click(function () {
|
||||||
|
$key.fadeToggle();
|
||||||
|
});
|
||||||
|
|
||||||
$('textarea').keydown(function(evt) {
|
$('textarea').keydown(function(evt) {
|
||||||
if (evt.keyCode === 9) {
|
if (evt.keyCode === 9) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -63,6 +63,17 @@
|
|||||||
<pre id="box" style="display:none;" tabindex="0"><code></code></pre>
|
<pre id="box" style="display:none;" tabindex="0"><code></code></pre>
|
||||||
<textarea spellcheck="false" style="display:none;"></textarea>
|
<textarea spellcheck="false" style="display:none;"></textarea>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _gaq = _gaq || [];
|
||||||
|
_gaq.push(['_setAccount', 'UA-27329119-1']);
|
||||||
|
_gaq.push(['_trackPageview']);
|
||||||
|
(function() {
|
||||||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user