1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-11-23 17:50:19 +01:00

Show certain options only sometimes

This commit is contained in:
John Crepezzi 2011-11-19 00:30:14 -05:00
parent f54712f9d9
commit af02375b7c
3 changed files with 25 additions and 8 deletions

View file

@ -37,6 +37,7 @@ textarea {
color: #999; color: #999;
font-size: 13px; font-size: 13px;
font-family: monospace; font-family: monospace;
line-height: 1.3em;
} }
#key em { #key em {

View file

@ -68,6 +68,26 @@ haste.prototype.setTitle = function(ext) {
document.title = title; document.title = title;
}; };
// Show the light key
haste.prototype.lightKey = function() {
var text = '';
text += '<em>' + this.appName + '</em>';
text += '^s - save<br>';
text += '^n - new';
$('#key').html(text);
};
// Show the full key
haste.prototype.fullKey = function() {
var text = '';
text += '<em>' + this.appName + '</em>';
text += '^s - save<br>';
text += '^n - new<br>';
text += '^d - duplicate<br>';
text += '^t - twitter';
$('#key').html(text);
};
// Remove the current document (if there is one) // Remove the current document (if there is one)
// and set up for a new one // and set up for a new one
haste.prototype.newDocument = function(hideHistory) { haste.prototype.newDocument = function(hideHistory) {
@ -77,6 +97,7 @@ haste.prototype.newDocument = function(hideHistory) {
window.history.pushState(null, this.appName, '/'); window.history.pushState(null, this.appName, '/');
} }
this.setTitle(); this.setTitle();
this.lightKey();
this.$textarea.show('fast', function() { this.$textarea.show('fast', function() {
this.focus(); this.focus();
}); });
@ -94,6 +115,7 @@ haste.prototype.loadDocument = function(key) {
title += ' - ' + ret.language; title += ' - ' + ret.language;
} }
_this.setTitle(title); _this.setTitle(title);
_this.fullKey();
_this.$textarea.val('').hide(); _this.$textarea.val('').hide();
_this.$box.show(); _this.$box.show();
} }
@ -123,6 +145,7 @@ haste.prototype.lockDocument = function() {
title += ' - ' + ret.language; title += ' - ' + ret.language;
} }
_this.setTitle(title); _this.setTitle(title);
_this.fullKey();
window.history.pushState(null, _this.appName + '-' + ret.key, '/' + ret.key); window.history.pushState(null, _this.appName + '-' + ret.key, '/' + ret.key);
_this.$textarea.val('').hide(); _this.$textarea.val('').hide();
_this.$box.show(); _this.$box.show();

View file

@ -32,14 +32,7 @@
<body> <body>
<div id="key"> <div id="key"></div>
<em>haste</em>
^s - save<br>
^n - new<br>
^d - duplicate<br>
^t - tweet
</div>
<pre id="box" style="display:none;"><code></code></pre> <pre id="box" style="display:none;"><code></code></pre>
<textarea spellcheck="false" style="display:none;"></textarea> <textarea spellcheck="false" style="display:none;"></textarea>