From 9638baffdb3650e891e6b7512045bf52bf3007ed Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Sat, 19 Nov 2011 01:00:04 -0500 Subject: [PATCH] Make twitter posting an option --- TODO | 1 - static/application.js | 9 ++++++--- static/index.html | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index a560cf3..9538502 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,6 @@ tests test in other browsers and add note to README maximum size of a haste fix any annoying visual quirks -make twitter posting an option add FAVICON # shared version only diff --git a/static/application.js b/static/application.js index 2ab9799..d79b394 100644 --- a/static/application.js +++ b/static/application.js @@ -53,13 +53,14 @@ haste_document.prototype.save = function(data, callback) { ///// represents the paste application -var haste = function(appName) { +var haste = function(appName, options) { this.appName = appName; this.baseUrl = window.location.href; // since this is loaded first this.$textarea = $('textarea'); this.$box = $('#box'); this.$code = $('#box code'); this.configureShortcuts(); + this.options = options; }; // Set the page title - include the appName @@ -84,7 +85,9 @@ haste.prototype.fullKey = function() { text += '^s - save
'; text += '^n - new
'; text += '^d - duplicate
'; - text += '^t - twitter'; + if (this.options.twitter) { + text += '^t - twitter'; + } $('#key').html(text); }; @@ -175,7 +178,7 @@ haste.prototype.configureShortcuts = function() { _this.duplicateDocument(); } // ^T for redirecting to twitter - else if (_this.doc.locked && evt.ctrlKey && evt.keyCode == 84) { + else if (_this.options.twitter && _this.doc.locked && evt.ctrlKey && evt.keyCode == 84) { evt.preventDefault(); window.open('https://twitter.com/share?url=' + encodeURI(_this.baseUrl + _this.doc.key)); } diff --git a/static/index.html b/static/index.html index 68c60dc..7ca2172 100644 --- a/static/index.html +++ b/static/index.html @@ -14,7 +14,7 @@