Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: ui/webui/resources/js/chromeos/ui_account_tweaks.js

Issue 2597013002: Run clang-format on ui/webui/resources (Closed)
Patch Set: merge Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/js/chromeos/ui_account_tweaks.js
diff --git a/ui/webui/resources/js/chromeos/ui_account_tweaks.js b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
index 6dab42b4e55e719ef8ebfe1928d5ee2b0beb0f6f..96ac8f5fee176ad3235c49fec48d0b97f13da8d0 100644
--- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js
+++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -25,8 +25,7 @@ cr.define('uiAccountTweaks', function() {
* Encapsulated handling of ChromeOS accounts options page.
* @constructor
*/
- function UIAccountTweaks() {
- }
+ function UIAccountTweaks() {}
/**
* @return {boolean} Whether the current user is owner or not.
@@ -61,7 +60,8 @@ cr.define('uiAccountTweaks', function() {
*
* @param {!Element} element Element that should be enabled.
*/
- UIAccountTweaks.enableElementIfPossible = function(element) {
+ UIAccountTweaks.enableElementIfPossible =
+ function(element) {
var sessionType;
if (UIAccountTweaks.loggedInAsGuest())
sessionType = SESSION_TYPE_GUEST;
@@ -76,19 +76,21 @@ cr.define('uiAccountTweaks', function() {
element.disabled = false;
}
- /**
- * Disables or hides some elements in specified type of session in ChromeOS.
- * All elements within given document with *sessionType*-visibility
- * attribute are either hidden (for *sessionType*-visibility="hidden")
- * or disabled (for *sessionType*-visibility="disabled").
- *
- * @param {Document} document Document that should processed.
- * @param {string} sessionType name of the session type processed.
- * @private
- */
- UIAccountTweaks.applySessionTypeVisibility_ = function(document,
- sessionType) {
- var elements = document.querySelectorAll('['+ sessionType + '-visibility]');
+ /**
+ * Disables or hides some elements in specified type of session in
+ * ChromeOS.
+ * All elements within given document with *sessionType*-visibility
+ * attribute are either hidden (for *sessionType*-visibility="hidden")
+ * or disabled (for *sessionType*-visibility="disabled").
+ *
+ * @param {Document} document Document that should processed.
+ * @param {string} sessionType name of the session type processed.
+ * @private
+ */
+ UIAccountTweaks.applySessionTypeVisibility_ =
+ function(document, sessionType) {
+ var elements =
+ document.querySelectorAll('[' + sessionType + '-visibility]');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var visibility = element.getAttribute(sessionType + '-visibility');
@@ -99,54 +101,60 @@ cr.define('uiAccountTweaks', function() {
}
}
- /**
- * Updates specific visibility of elements for Guest session in ChromeOS.
- * Calls applySessionTypeVisibility_ method.
- *
- * @param {Document} document Document that should processed.
- */
- UIAccountTweaks.applyGuestSessionVisibility = function(document) {
+ /**
+ * Updates specific visibility of elements for Guest session in
+ * ChromeOS.
+ * Calls applySessionTypeVisibility_ method.
+ *
+ * @param {Document} document Document that should processed.
+ */
+ UIAccountTweaks.applyGuestSessionVisibility =
+ function(document) {
if (!UIAccountTweaks.loggedInAsGuest())
return;
UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_GUEST);
}
- /**
- * Updates specific visibility of elements for Public account session in
- * ChromeOS. Calls applySessionTypeVisibility_ method.
- *
- * @param {Document} document Document that should processed.
- */
- UIAccountTweaks.applyPublicSessionVisibility = function(document) {
+ /**
+ * Updates specific visibility of elements for Public account
+ * session in
+ * ChromeOS. Calls applySessionTypeVisibility_ method.
+ *
+ * @param {Document} document Document that should processed.
+ */
+ UIAccountTweaks.applyPublicSessionVisibility =
+ function(document) {
if (!UIAccountTweaks.loggedInAsPublicAccount())
return;
UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_PUBLIC);
}
- /**
- * Disables and marks page elements for specified session type.
- * Adds #-disabled css class to all elements within given subtree,
- * disables interactive elements (input/select/button), and removes href
- * attribute from <a> elements.
- *
- * @param {!Element} element Root element of DOM subtree that should be
- * disabled.
- * @param {string} sessionType session type specificator.
- */
- UIAccountTweaks.disableElementsForSessionType = function(element,
- sessionType) {
+ /**
+ * Disables and marks page elements for specified session
+ * type.
+ * Adds #-disabled css class to all elements within given
+ * subtree,
+ * disables interactive elements (input/select/button), and
+ * removes href
+ * attribute from <a> elements.
+ *
+ * @param {!Element} element Root element of DOM subtree that
+ * should be
+ * disabled.
+ * @param {string} sessionType session type specificator.
+ */
+ UIAccountTweaks.disableElementsForSessionType = function(
+ element, sessionType) {
UIAccountTweaks.disableElementForSessionType_(element, sessionType);
// Walk the tree, searching each ELEMENT node.
- var walker = document.createTreeWalker(element,
- NodeFilter.SHOW_ELEMENT,
- null,
- false);
+ var walker = document.createTreeWalker(
+ element, NodeFilter.SHOW_ELEMENT, null, false);
var node = walker.nextNode();
while (node) {
UIAccountTweaks.disableElementForSessionType_(
- /** @type {!Element} */(node), sessionType);
+ /** @type {!Element} */ (node), sessionType);
node = walker.nextNode();
}
};
@@ -161,23 +169,18 @@ cr.define('uiAccountTweaks', function() {
* @param {!Element} element Element that should be disabled.
* @param {string} sessionType account session Type specificator.
*/
- UIAccountTweaks.disableElementForSessionType_ = function(element,
- sessionType) {
+ UIAccountTweaks.disableElementForSessionType_ = function(
+ element, sessionType) {
element.classList.add(sessionType + '-disabled');
- if (element.nodeName == 'INPUT' ||
- element.nodeName == 'SELECT' ||
+ if (element.nodeName == 'INPUT' || element.nodeName == 'SELECT' ||
element.nodeName == 'BUTTON') {
element.disabled = true;
} else if (element.nodeName == 'A') {
- element.onclick = function() {
- return false;
- };
+ element.onclick = function() { return false; };
}
};
// Export
- return {
- UIAccountTweaks: UIAccountTweaks
- };
+ return {UIAccountTweaks: UIAccountTweaks};
});

Powered by Google App Engine
This is Rietveld 408576698