| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 /** | 8 /** |
| 9 * Basic common LogDog application functionality. | 9 * Basic common LogDog application functionality. |
| 10 * | 10 * |
| 11 * @param {window} window the application window to bind to | 11 * @param {window} window the application window to bind to |
| 12 */ | 12 */ |
| 13 LogDogApp = function(window) { | 13 LogDogApp = function(window) { |
| 14 // Set up our default LogDog host. | 14 // Set up our default LogDog host. |
| 15 this.host = window.location.hostname; | 15 this.host = window.location.hostname; |
| 16 if (this.host === "localhost") { | 16 if (this.host === "localhost") { |
| 17 // Running locally. Bind to our development instance. | 17 // Running locally. Bind to our development instance. |
| 18 this.host = "luci-logdog-dev.appspot.com"; | 18 this.host = "luci-logdog-dev.appspot.com"; |
| 19 } | 19 } |
| 20 | 20 |
| 21 this.production = (window.location.port === ""); | 21 this.production = (window.location.port === ""); |
| 22 |
| 23 // Sets app default base URL. |
| 24 this.baseUrl = window.location.pathname; |
| 22 }; | 25 }; |
| 23 | 26 |
| 24 /** | 27 /** |
| 25 * Returns an Array of values for a given query parameter. | 28 * Returns an Array of values for a given query parameter. |
| 26 * | 29 * |
| 27 * For example, if the query parameter was, "...?a=asdf&a=qwer", this would | 30 * For example, if the query parameter was, "...?a=asdf&a=qwer", this would |
| 28 * return ["asdf", "qwer"]. | 31 * return ["asdf", "qwer"]. |
| 29 * | 32 * |
| 30 * @param {string} q the query parameter text. | 33 * @param {string} q the query parameter text. |
| 31 * @param {string} key the query parameter key to extract. | 34 * @param {string} key the query parameter key to extract. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 * @param {string} v the stream path value | 74 * @param {string} v the stream path value |
| 72 * @returns {string} the fixed stream path value | 75 * @returns {string} the fixed stream path value |
| 73 */ | 76 */ |
| 74 LogDogApp.prototype.correctStreamPath = function(v) { | 77 LogDogApp.prototype.correctStreamPath = function(v) { |
| 75 return v.replace(" ", "+"); | 78 return v.replace(" ", "+"); |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 /** Global LogDogApp instance bound to the current window. */ | 81 /** Global LogDogApp instance bound to the current window. */ |
| 79 var logdog = new LogDogApp(window); | 82 var logdog = new LogDogApp(window); |
| 80 </script> | 83 </script> |
| OLD | NEW |