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

Side by Side Diff: chrome/browser/resources/shared/js/util.js

Issue 10796115: Enabled Selection (ctrl-A) on login password (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code cleanup Created 8 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * The global object. 6 * The global object.
7 * @type {!Object} 7 * @type {!Object}
8 * @const 8 * @const
9 */ 9 */
10 var global = this; 10 var global = this;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (afterA == b) { 100 if (afterA == b) {
101 swapDomNodes(b, a); 101 swapDomNodes(b, a);
102 return; 102 return;
103 } 103 }
104 var aParent = a.parentNode; 104 var aParent = a.parentNode;
105 b.parentNode.replaceChild(a, b); 105 b.parentNode.replaceChild(a, b);
106 aParent.insertBefore(b, afterA); 106 aParent.insertBefore(b, afterA);
107 } 107 }
108 108
109 /** 109 /**
110 * Disables text selection and dragging. 110 * Disables text selection and dragging, with optional whitelist callbacks.
111 * @param {function(Event):boolean=} opt_allowSelectStart if this function is
Dan Beam 2012/07/24 23:07:49 Capitalize the first word after each parameter nam
Harry McCleave 2012/07/24 23:21:15 Done.
112 * defined and returns true, will allow the SelectStart event to be processed
113 * @param {function(Event):boolean=} opt_allowDragStart if this funcion is
114 * defined and returns true, will allow the DragStart event to be processed
111 */ 115 */
112 function disableTextSelectAndDrag() { 116 function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) {
113 // Disable text selection. 117 // Disable text selection.
114 document.onselectstart = function(e) { 118 document.onselectstart = function(e) {
115 e.preventDefault(); 119 if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e)))
116 } 120 e.preventDefault();
121 };
117 122
118 // Disable dragging. 123 // Disable dragging.
119 document.ondragstart = function(e) { 124 document.ondragstart = function(e) {
120 e.preventDefault(); 125 if (!(opt_allowDragStart && opt_allowDragStart.call(this, e)))
121 } 126 e.preventDefault();
127 };
122 } 128 }
123 129
124 /** 130 /**
125 * Check the directionality of the page. 131 * Check the directionality of the page.
126 * @return {boolean} True if Chrome is running an RTL UI. 132 * @return {boolean} True if Chrome is running an RTL UI.
127 */ 133 */
128 function isRTL() { 134 function isRTL() {
129 return document.documentElement.dir == 'rtl'; 135 return document.documentElement.dir == 'rtl';
130 } 136 }
131 137
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 * @param {string} value The value of the param. 203 * @param {string} value The value of the param.
198 * @return {string} The new URL. 204 * @return {string} The new URL.
199 */ 205 */
200 function appendParam(url, key, value) { 206 function appendParam(url, key, value) {
201 var param = encodeURIComponent(key) + '=' + encodeURIComponent(value); 207 var param = encodeURIComponent(key) + '=' + encodeURIComponent(value);
202 208
203 if (url.indexOf('?') == -1) 209 if (url.indexOf('?') == -1)
204 return url + '?' + param; 210 return url + '?' + param;
205 return url + '&' + param; 211 return url + '&' + param;
206 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698