| 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; | |
| 25 }; | 22 }; |
| 26 | 23 |
| 27 /** | 24 /** |
| 28 * Returns an Array of values for a given query parameter. | 25 * Returns an Array of values for a given query parameter. |
| 29 * | 26 * |
| 30 * For example, if the query parameter was, "...?a=asdf&a=qwer", this would | 27 * For example, if the query parameter was, "...?a=asdf&a=qwer", this would |
| 31 * return ["asdf", "qwer"]. | 28 * return ["asdf", "qwer"]. |
| 32 * | 29 * |
| 33 * @param {string} q the query parameter text. | 30 * @param {string} q the query parameter text. |
| 34 * @param {string} key the query parameter key to extract. | 31 * @param {string} key the query parameter key to extract. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 * @param {string} v the stream path value | 71 * @param {string} v the stream path value |
| 75 * @returns {string} the fixed stream path value | 72 * @returns {string} the fixed stream path value |
| 76 */ | 73 */ |
| 77 LogDogApp.prototype.correctStreamPath = function(v) { | 74 LogDogApp.prototype.correctStreamPath = function(v) { |
| 78 return v.replace(" ", "+"); | 75 return v.replace(" ", "+"); |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 /** Global LogDogApp instance bound to the current window. */ | 78 /** Global LogDogApp instance bound to the current window. */ |
| 82 var logdog = new LogDogApp(window); | 79 var logdog = new LogDogApp(window); |
| 83 </script> | 80 </script> |
| OLD | NEW |