diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-02 18:46:55 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-02 18:46:55 +1300 |
commit | f8bf7ede29f2e063a30721e8ed415a6184646424 (patch) | |
tree | 43259e48230270edaed0a1981e8ef975508c9831 /web/app/controller/Root.js | |
parent | 6d447219ceab19c368b7ca6efabca83001b64a04 (diff) | |
parent | ea09b2e85e014d438084a454fae7c0cce57d9773 (diff) | |
download | trackermap-web-f8bf7ede29f2e063a30721e8ed415a6184646424.tar.gz trackermap-web-f8bf7ede29f2e063a30721e8ed415a6184646424.tar.bz2 trackermap-web-f8bf7ede29f2e063a30721e8ed415a6184646424.zip |
Merge pull request #347 from Abyss777/handle_eventid
Handle eventId url parameter
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r-- | web/app/controller/Root.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 5600d4e8..87c4cf5e 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.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:'; |