From 42574b6700384bd8a45d3410c4f8da644dad112e Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 1 Dec 2016 17:30:50 +0500 Subject: Implement in other way --- web/app/controller/Root.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'web/app/controller/Root.js') diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 5600d4e..379a0d8 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -75,7 +75,7 @@ Ext.define('Traccar.controller.Root', { }, loadApp: function () { - var attribution; + var attribution, eventId; Ext.getStore('Groups').load(); Ext.getStore('Geofences').load(); Ext.getStore('AttributeAliases').load(); @@ -94,6 +94,11 @@ Ext.define('Traccar.controller.Root', { } else { Ext.create('widget.main'); } + eventId = Ext.Object.fromQueryString(window.location.search).eventId; + if (eventId) { + this.application.fireEvent('showSingleEvent', eventId); + //this.removeUrlParameter('eventId'); + } }, beep: function () { @@ -108,6 +113,12 @@ Ext.define('Traccar.controller.Root', { return muteButton && !muteButton.pressed; }, + removeUrlParameter: function (param) { + var params = Ext.Object.fromQueryString(window.location.search); + delete params[param]; + window.history.pushState(null, null, window.location.pathname + '?' + Ext.Object.toQueryString(params)); + }, + asyncUpdate: function (first) { var protocol, pathname, socket, self = this; protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; -- cgit v1.2.3