OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * @param {string} label | 85 * @param {string} label |
86 * @param {!WebInspector.Setting} setting | 86 * @param {!WebInspector.Setting} setting |
87 * @param {boolean} numeric | 87 * @param {boolean} numeric |
88 * @param {number=} maxLength | 88 * @param {number=} maxLength |
89 * @param {string=} width | 89 * @param {string=} width |
90 * @param {function(string):?string=} validatorCallback | 90 * @param {function(string):?string=} validatorCallback |
91 * @param {boolean=} instant | 91 * @param {boolean=} instant |
| 92 * @return {!Element} |
92 */ | 93 */ |
93 WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
ic, maxLength, width, validatorCallback, instant) | 94 WebInspector.SettingsUI.createSettingInputField = function(label, setting, numer
ic, maxLength, width, validatorCallback, instant) |
94 { | 95 { |
95 var p = document.createElement("p"); | 96 var p = document.createElement("p"); |
96 var labelElement = p.createChild("label"); | 97 var labelElement = p.createChild("label"); |
97 labelElement.textContent = label; | 98 labelElement.textContent = label; |
98 var inputElement = p.createChild("input"); | 99 var inputElement = p.createChild("input"); |
99 inputElement.value = setting.get(); | 100 inputElement.value = setting.get(); |
100 inputElement.type = "text"; | 101 inputElement.type = "text"; |
101 if (numeric) | 102 if (numeric) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return p; | 164 return p; |
164 } | 165 } |
165 | 166 |
166 /** | 167 /** |
167 * @param {string} label | 168 * @param {string} label |
168 * @param {!WebInspector.Setting} setting | 169 * @param {!WebInspector.Setting} setting |
169 * @param {number=} maxLength | 170 * @param {number=} maxLength |
170 * @param {string=} width | 171 * @param {string=} width |
171 * @param {!WebInspector.Setting=} toggleSetting | 172 * @param {!WebInspector.Setting=} toggleSetting |
172 * @param {string=} defaultText | 173 * @param {string=} defaultText |
| 174 * @return {!Element} |
173 */ | 175 */ |
174 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength,
width, toggleSetting, defaultText) | 176 WebInspector.SettingsUI.createSettingLabel = function(label, setting, maxLength,
width, toggleSetting, defaultText) |
175 { | 177 { |
176 var p = document.createElement("p"); | 178 var p = document.createElement("p"); |
177 var labelElement = p.createChild("span"); | 179 var labelElement = p.createChild("span"); |
178 labelElement.textContent = label; | 180 labelElement.textContent = label; |
179 if (label) | 181 if (label) |
180 labelElement.style.marginRight = "5px"; | 182 labelElement.style.marginRight = "5px"; |
181 var spanElement = p.createChild("span"); | 183 var spanElement = p.createChild("span"); |
182 spanElement.textContent = setting.get(); | 184 spanElement.textContent = setting.get(); |
(...skipping 10 matching lines...) Expand all Loading... |
193 var text = toggleSetting && !toggleSetting.get() ? (defaultText || "") :
setting.get(); | 195 var text = toggleSetting && !toggleSetting.get() ? (defaultText || "") :
setting.get(); |
194 spanElement.title = text; | 196 spanElement.title = text; |
195 if (maxLength && text.length > maxLength) | 197 if (maxLength && text.length > maxLength) |
196 text = text.substring(0, maxLength - 2) + "..."; | 198 text = text.substring(0, maxLength - 2) + "..."; |
197 spanElement.textContent = text; | 199 spanElement.textContent = text; |
198 } | 200 } |
199 | 201 |
200 return p; | 202 return p; |
201 } | 203 } |
202 | 204 |
| 205 /** |
| 206 * @param {string} name |
| 207 * @param {!Element} element |
| 208 * @return {!Element} |
| 209 */ |
203 WebInspector.SettingsUI.createCustomSetting = function(name, element) | 210 WebInspector.SettingsUI.createCustomSetting = function(name, element) |
204 { | 211 { |
205 var p = document.createElement("p"); | 212 var p = document.createElement("p"); |
206 var fieldsetElement = document.createElement("fieldset"); | 213 var fieldsetElement = document.createElement("fieldset"); |
207 fieldsetElement.createChild("label").textContent = name; | 214 fieldsetElement.createChild("label").textContent = name; |
208 fieldsetElement.appendChild(element); | 215 fieldsetElement.appendChild(element); |
209 p.appendChild(fieldsetElement); | 216 p.appendChild(fieldsetElement); |
210 return p; | 217 return p; |
211 } | 218 } |
212 | 219 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 288 |
282 WebInspector.UISettingDelegate.prototype = { | 289 WebInspector.UISettingDelegate.prototype = { |
283 /** | 290 /** |
284 * @return {?Element} | 291 * @return {?Element} |
285 */ | 292 */ |
286 settingElement: function() | 293 settingElement: function() |
287 { | 294 { |
288 return null; | 295 return null; |
289 } | 296 } |
290 } | 297 } |
OLD | NEW |