| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * Simple utility functions for Chromoting. | |
| 8 */ | |
| 9 | |
| 10 /** | |
| 11 * TODO(garykac): Remove this once host_list.js and host_table_entry.js have | |
| 12 * been updated to use classList directly. | |
| 13 * | |
| 14 * @param {Element} element The element to which to add the class. | |
| 15 * @param {string} cls The new class. | |
| 16 * @return {void} Nothing. | |
| 17 */ | |
| 18 function addClass(element, cls) { | |
| 19 var helem = /** @type {HTMLElement} */ element; | |
| 20 helem.classList.add(cls); | |
| 21 } | |
| 22 | |
| 23 /** | |
| 24 * TODO(garykac): Remove this once host_list.js and host_table_entry.js have | |
| 25 * been updated to use classList directly. | |
| 26 * | |
| 27 * @param {Element} element The element from which to remove the class. | |
| 28 * @param {string} cls The new class. | |
| 29 * @return {void} Nothing. | |
| 30 */ | |
| 31 function removeClass(element, cls) { | |
| 32 var helem = /** @type {HTMLElement} */ element; | |
| 33 helem.classList.remove(cls); | |
| 34 } | |
| 35 | |
| 36 /** | |
| 37 * @return {Object.<string, string>} The URL parameters. | |
| 38 */ | |
| 39 function getUrlParameters() { | |
| 40 var result = {}; | |
| 41 var parts = window.location.search.substring(1).split('&'); | |
| 42 for (var i = 0; i < parts.length; i++) { | |
| 43 var pair = parts[i].split('='); | |
| 44 result[pair[0]] = decodeURIComponent(pair[1]); | |
| 45 } | |
| 46 return result; | |
| 47 } | |
| 48 | |
| 49 // This function can be called from the Javascript console to show all the UI, | |
| 50 // for example prior to auditing the CSS. It is not useful otherwise. | |
| 51 function unhideAll() { | |
| 52 var hidden = document.querySelectorAll('[hidden]'); | |
| 53 for (var i in hidden) { | |
| 54 hidden[i].hidden = false; | |
| 55 } | |
| 56 } | |
| OLD | NEW |