From 8763f0392dd8ee2d6044941dba297f4b5486772b Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Mon, 15 Aug 2011 11:28:14 +0200 Subject: [PATCH] handle history for main navigation --- .../main/webapp/resources/js/sonia.history.js | 32 +++++--- .../src/main/webapp/resources/js/sonia.scm.js | 77 ++++++++++++++----- 2 files changed, 80 insertions(+), 29 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.history.js b/scm-webapp/src/main/webapp/resources/js/sonia.history.js index b1d6eae314..6a817f8542 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.history.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.history.js @@ -49,21 +49,31 @@ Sonia.History = { } }, - register: function(id, fn){ - this.historyElements.push({ - 'id': id, - 'fn': fn - }); + register: function(id, fn, scope){ + if (scope){ + this.historyElements[id] = { + 'fn': fn, + 'scope': scope + }; + } else { + this.historyElements[id] = fn; + } + }, handleChange: function(id, params){ - if ( debug ){ - console.debug( 'handle ' + id + ' with "' + params + '"' ); - } - for (var i=0; i