client/js/router.js
changeset 471 e0c7be5dc02c
child 473 6649d2d75a87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/router.js	Wed Jun 03 17:27:46 2015 +0200
@@ -0,0 +1,27 @@
+(function(root) {
+    "use strict";
+    
+    var Backbone = root.Backbone;
+    
+    var Router = root.Rkns.Router = Backbone.Router.extend({
+        routes: {
+            '': 'index',
+            '*params': 'setParams'
+        },
+        
+        index: function(){
+            this.params = {};
+        },
+        setParams: function (parameters) {
+            var _this = this;
+            this.params = {};
+            
+            parameters.split('&').forEach(function(param){
+                _this.params[param.split('=')[0]] = param.split('=')[1] || null;
+                _this.trigger(param.split('=')[0], param.split('=')[1]);
+            });
+            
+        }  
+    });
+
+})(window);
\ No newline at end of file