From f83e619fd97883d9e55494c2f3cc7e84d98fd5a8 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sat, 28 Jan 2012 17:25:24 -0800 Subject: [PATCH 1/2] Null-out the padeditor's reference to ace once it has been distroyed. This enables the guards placed in `padeditor.disable` to work. On `window.unload` the pad's connection would get closed which would lead to the editor becomming disabled. If the editor had already been `disposed` then the call to `disable` would raise the exception: `Uncaught TypeError: Cannot call method 'ace_setProperty' of null` --- static/js/pad_editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 6d3cbf40..d336aa87 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -141,6 +141,7 @@ var padeditor = (function() if (self.ace) { self.ace.destroy(); + self.ace = null; } }, disable: function() From 23a166ca99d442284001844ca0b4fff7280de4a8 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Mon, 30 Jan 2012 13:27:43 -0800 Subject: [PATCH 2/2] JSON exports itself. This fixes issue #376. --- static/js/json2.js | 2 ++ static/js/pad.js | 2 +- static/js/timeslider.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/json2.js b/static/js/json2.js index 898e8369..663f932c 100644 --- a/static/js/json2.js +++ b/static/js/json2.js @@ -469,3 +469,5 @@ if (!JSON) }; } }()); + +module.exports = JSON; diff --git a/static/js/pad.js b/static/js/pad.js index fb297d4a..0ed2a5d0 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -30,7 +30,7 @@ require('/jquery'); require('/jquery-ui'); require('/farbtastic'); require('/excanvas'); -require('/json2'); +JSON = require('/json2'); require('/undo-xpopup'); var chat = require('/chat').chat; diff --git a/static/js/timeslider.js b/static/js/timeslider.js index 939c4c64..b02fd22f 100644 --- a/static/js/timeslider.js +++ b/static/js/timeslider.js @@ -23,7 +23,7 @@ // These jQuery things should create local references, but for now `require()` // assigns to the global `$` and augments it with plugins. require('/jquery'); -require('/json2'); +JSON = require('/json2'); require('/undo-xpopup'); function createCookie(name,value,days)