|
|
@ -69,7 +69,7 @@ var haste = function(appName, options) { |
|
|
|
this.configureButtons(); |
|
|
|
this.configureButtons(); |
|
|
|
// If twitter is disabled, hide the button
|
|
|
|
// If twitter is disabled, hide the button
|
|
|
|
if (!options.twitter) { |
|
|
|
if (!options.twitter) { |
|
|
|
$('#key .box2 .twitter').hide(); |
|
|
|
$('#box2 .twitter').hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -94,7 +94,7 @@ haste.prototype.fullKey = function() { |
|
|
|
// Set the key up for certain things to be enabled
|
|
|
|
// Set the key up for certain things to be enabled
|
|
|
|
haste.prototype.configureKey = function(enable) { |
|
|
|
haste.prototype.configureKey = function(enable) { |
|
|
|
var $this, i = 0; |
|
|
|
var $this, i = 0; |
|
|
|
$('#key .box2 .function').each(function() { |
|
|
|
$('#box2 .function').each(function() { |
|
|
|
$this = $(this); |
|
|
|
$this = $(this); |
|
|
|
for (i = 0; i < enable.length; i++) { |
|
|
|
for (i = 0; i < enable.length; i++) { |
|
|
|
if ($this.hasClass(enable[i])) { |
|
|
|
if ($this.hasClass(enable[i])) { |
|
|
@ -197,7 +197,7 @@ haste.prototype.configureClip = function() { |
|
|
|
this.clipper.setCSSEffects(false); |
|
|
|
this.clipper.setCSSEffects(false); |
|
|
|
// and then set and show
|
|
|
|
// and then set and show
|
|
|
|
this.clipper.setText(window.location.href); |
|
|
|
this.clipper.setText(window.location.href); |
|
|
|
$('#key .box2 .link').html(this.clipper.getHTML(32, 37)); |
|
|
|
$('#box2 .link').html(this.clipper.getHTML(32, 37)); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// hide the current clip, if it exists
|
|
|
|
// hide the current clip, if it exists
|
|
|
@ -205,14 +205,14 @@ haste.prototype.removeClip = function() { |
|
|
|
if (this.clipper) { |
|
|
|
if (this.clipper) { |
|
|
|
this.clipper.destroy(); |
|
|
|
this.clipper.destroy(); |
|
|
|
} |
|
|
|
} |
|
|
|
$('#key .box2 .link').html(''); |
|
|
|
$('#box2 .link').html(''); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
haste.prototype.configureButtons = function() { |
|
|
|
haste.prototype.configureButtons = function() { |
|
|
|
var _this = this; |
|
|
|
var _this = this; |
|
|
|
this.buttons = [ |
|
|
|
this.buttons = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
$where: $('#key .box2 .save'), |
|
|
|
$where: $('#box2 .save'), |
|
|
|
label: 'Save', |
|
|
|
label: 'Save', |
|
|
|
shortcutDescription: 'control + s', |
|
|
|
shortcutDescription: 'control + s', |
|
|
|
shortcut: function(evt) { |
|
|
|
shortcut: function(evt) { |
|
|
@ -225,7 +225,7 @@ haste.prototype.configureButtons = function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
$where: $('#key .box2 .new'), |
|
|
|
$where: $('#box2 .new'), |
|
|
|
label: 'New', |
|
|
|
label: 'New', |
|
|
|
shortcut: function(evt) { |
|
|
|
shortcut: function(evt) { |
|
|
|
return evt.ctrlKey && evt.keyCode === 78
|
|
|
|
return evt.ctrlKey && evt.keyCode === 78
|
|
|
@ -236,7 +236,7 @@ haste.prototype.configureButtons = function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
$where: $('#key .box2 .duplicate'), |
|
|
|
$where: $('#box2 .duplicate'), |
|
|
|
label: 'Duplicate & Edit', |
|
|
|
label: 'Duplicate & Edit', |
|
|
|
shortcut: function(evt) { |
|
|
|
shortcut: function(evt) { |
|
|
|
return _this.doc.locked && evt.ctrlKey && evt.keyCode === 68; |
|
|
|
return _this.doc.locked && evt.ctrlKey && evt.keyCode === 68; |
|
|
@ -247,7 +247,7 @@ haste.prototype.configureButtons = function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
$where: $('#key .box2 .twitter'), |
|
|
|
$where: $('#box2 .twitter'), |
|
|
|
label: 'Twitter', |
|
|
|
label: 'Twitter', |
|
|
|
shortcut: function(evt) { |
|
|
|
shortcut: function(evt) { |
|
|
|
return _this.options.twitter && _this.doc.locked && evt.ctrlKey && evt.keyCode == 84; |
|
|
|
return _this.options.twitter && _this.doc.locked && evt.ctrlKey && evt.keyCode == 84; |
|
|
@ -258,7 +258,7 @@ haste.prototype.configureButtons = function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
$where: $('#key .box2 .link'), |
|
|
|
$where: $('#box2 .link'), |
|
|
|
label: 'Copy URL', |
|
|
|
label: 'Copy URL', |
|
|
|
letBubble: true, |
|
|
|
letBubble: true, |
|
|
|
action: function() { } |
|
|
|
action: function() { } |
|
|
@ -279,14 +279,14 @@ haste.prototype.configureButton = function(options) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
// Show the label
|
|
|
|
// Show the label
|
|
|
|
options.$where.mouseenter(function(evt) { |
|
|
|
options.$where.mouseenter(function(evt) { |
|
|
|
$('#key .box3 .label').text(options.label); |
|
|
|
$('#box3 .label').text(options.label); |
|
|
|
$('#key .box3 .shortcut').text(options.shortcutDescription || ''); |
|
|
|
$('#box3 .shortcut').text(options.shortcutDescription || ''); |
|
|
|
$('#key .box3').show(); |
|
|
|
$('#box3').show(); |
|
|
|
$(this).append($('#pointer').remove().show()); |
|
|
|
$(this).append($('#pointer').remove().show()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// Hide the label
|
|
|
|
// Hide the label
|
|
|
|
options.$where.mouseleave(function(evt) { |
|
|
|
options.$where.mouseleave(function(evt) { |
|
|
|
$('#key .box3').hide(); |
|
|
|
$('#box3').hide(); |
|
|
|
$('#pointer').hide(); |
|
|
|
$('#pointer').hide(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|