| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 var footnote = this.element.createChild("p", "help-footnote"); | 202 var footnote = this.element.createChild("p", "help-footnote"); |
| 203 var footnoteLink = footnote.createChild("a"); | 203 var footnoteLink = footnote.createChild("a"); |
| 204 footnoteLink.href = "https://developers.google.com/chrome-developer-tools/do
cs/mobile-emulation"; | 204 footnoteLink.href = "https://developers.google.com/chrome-developer-tools/do
cs/mobile-emulation"; |
| 205 footnoteLink.target = "_blank"; | 205 footnoteLink.target = "_blank"; |
| 206 footnoteLink.createTextChild(WebInspector.UIString("More information about s
creen emulation")); | 206 footnoteLink.createTextChild(WebInspector.UIString("More information about s
creen emulation")); |
| 207 } | 207 } |
| 208 | 208 |
| 209 WebInspector.OverridesView.DeviceTab.prototype = { | 209 WebInspector.OverridesView.DeviceTab.prototype = { |
| 210 _createDeviceElement: function() | 210 _createDeviceElement: function() |
| 211 { | 211 { |
| 212 var fieldsetElement = document.createElement("fieldset"); | 212 var fieldsetElement = createElement("fieldset"); |
| 213 fieldsetElement.id = "metrics-override-section"; | 213 fieldsetElement.id = "metrics-override-section"; |
| 214 | 214 |
| 215 var deviceModelElement = fieldsetElement.createChild("p", "overrides-dev
ice-model-section"); | 215 var deviceModelElement = fieldsetElement.createChild("p", "overrides-dev
ice-model-section"); |
| 216 deviceModelElement.createChild("span").textContent = WebInspector.UIStri
ng("Model:"); | 216 deviceModelElement.createChild("span").textContent = WebInspector.UIStri
ng("Model:"); |
| 217 | 217 |
| 218 var deviceSelectElement = WebInspector.OverridesUI.createDeviceSelect(do
cument, this._showTitleDialog.bind(this)); | 218 var deviceSelectElement = WebInspector.OverridesUI.createDeviceSelect(do
cument, this._showTitleDialog.bind(this)); |
| 219 var buttons = deviceSelectElement.querySelectorAll("button"); | 219 var buttons = deviceSelectElement.querySelectorAll("button"); |
| 220 for (var i = 0; i < buttons.length; ++i) | 220 for (var i = 0; i < buttons.length; ++i) |
| 221 buttons[i].classList.add("text-button"); | 221 buttons[i].classList.add("text-button"); |
| 222 deviceModelElement.appendChild(deviceSelectElement); | 222 deviceModelElement.appendChild(deviceSelectElement); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * @constructor | 275 * @constructor |
| 276 * @extends {WebInspector.DialogDelegate} | 276 * @extends {WebInspector.DialogDelegate} |
| 277 * @param {!function(string)} callback | 277 * @param {!function(string)} callback |
| 278 */ | 278 */ |
| 279 WebInspector.OverridesView.DeviceTab.CustomDeviceTitleDialog = function(callback
) | 279 WebInspector.OverridesView.DeviceTab.CustomDeviceTitleDialog = function(callback
) |
| 280 { | 280 { |
| 281 WebInspector.DialogDelegate.call(this); | 281 WebInspector.DialogDelegate.call(this); |
| 282 | 282 |
| 283 this.element = document.createElementWithClass("div", "custom-device-title-d
ialog"); | 283 this.element = createElementWithClass("div", "custom-device-title-dialog"); |
| 284 this.element.createChild("label").textContent = WebInspector.UIString("Save
as: "); | 284 this.element.createChild("label").textContent = WebInspector.UIString("Save
as: "); |
| 285 | 285 |
| 286 this._input = this.element.createChild("input"); | 286 this._input = this.element.createChild("input"); |
| 287 this._input.setAttribute("type", "text"); | 287 this._input.setAttribute("type", "text"); |
| 288 this._input.placeholder = WebInspector.UIString("device model name"); | 288 this._input.placeholder = WebInspector.UIString("device model name"); |
| 289 this._input.addEventListener("input", this._onInput.bind(this), false); | 289 this._input.addEventListener("input", this._onInput.bind(this), false); |
| 290 | 290 |
| 291 this._saveButton = this.element.createChild("button"); | 291 this._saveButton = this.element.createChild("button"); |
| 292 this._saveButton.textContent = WebInspector.UIString("Save"); | 292 this._saveButton.textContent = WebInspector.UIString("Save"); |
| 293 this._saveButton.addEventListener("click", this._onSaveClick.bind(this), fal
se); | 293 this._saveButton.addEventListener("click", this._onSaveClick.bind(this), fal
se); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 var fieldsetElement = WebInspector.SettingsUI.createSettingFieldset(WebI
nspector.overridesSupport.settings.overrideCSSMedia); | 355 var fieldsetElement = WebInspector.SettingsUI.createSettingFieldset(WebI
nspector.overridesSupport.settings.overrideCSSMedia); |
| 356 var mediaSelectElement = fieldsetElement.createChild("select"); | 356 var mediaSelectElement = fieldsetElement.createChild("select"); |
| 357 var mediaTypes = WebInspector.CSSStyleModel.MediaTypes; | 357 var mediaTypes = WebInspector.CSSStyleModel.MediaTypes; |
| 358 var defaultMedia = WebInspector.overridesSupport.settings.emulatedCSSMed
ia.get(); | 358 var defaultMedia = WebInspector.overridesSupport.settings.emulatedCSSMed
ia.get(); |
| 359 for (var i = 0; i < mediaTypes.length; ++i) { | 359 for (var i = 0; i < mediaTypes.length; ++i) { |
| 360 var mediaType = mediaTypes[i]; | 360 var mediaType = mediaTypes[i]; |
| 361 if (mediaType === "all") { | 361 if (mediaType === "all") { |
| 362 // "all" is not a device-specific media type. | 362 // "all" is not a device-specific media type. |
| 363 continue; | 363 continue; |
| 364 } | 364 } |
| 365 var option = document.createElement("option"); | 365 var option = createElement("option"); |
| 366 option.text = mediaType; | 366 option.text = mediaType; |
| 367 option.value = mediaType; | 367 option.value = mediaType; |
| 368 mediaSelectElement.add(option); | 368 mediaSelectElement.add(option); |
| 369 if (mediaType === defaultMedia) | 369 if (mediaType === defaultMedia) |
| 370 mediaSelectElement.selectedIndex = mediaSelectElement.options.le
ngth - 1; | 370 mediaSelectElement.selectedIndex = mediaSelectElement.options.le
ngth - 1; |
| 371 } | 371 } |
| 372 | 372 |
| 373 mediaSelectElement.addEventListener("change", this._emulateMediaChanged.
bind(this, mediaSelectElement), false); | 373 mediaSelectElement.addEventListener("change", this._emulateMediaChanged.
bind(this, mediaSelectElement), false); |
| 374 var fragment = document.createDocumentFragment(); | 374 var fragment = createDocumentFragment(); |
| 375 fragment.appendChild(checkbox); | 375 fragment.appendChild(checkbox); |
| 376 fragment.appendChild(fieldsetElement); | 376 fragment.appendChild(fieldsetElement); |
| 377 this.element.appendChild(fragment); | 377 this.element.appendChild(fragment); |
| 378 }, | 378 }, |
| 379 | 379 |
| 380 _emulateMediaChanged: function(select) | 380 _emulateMediaChanged: function(select) |
| 381 { | 381 { |
| 382 var media = select.options[select.selectedIndex].value; | 382 var media = select.options[select.selectedIndex].value; |
| 383 WebInspector.overridesSupport.settings.emulatedCSSMedia.set(media); | 383 WebInspector.overridesSupport.settings.emulatedCSSMedia.set(media); |
| 384 }, | 384 }, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 var cellElement = rowElement.createChild("td"); | 516 var cellElement = rowElement.createChild("td"); |
| 517 cellElement = rowElement.createChild("td"); | 517 cellElement = rowElement.createChild("td"); |
| 518 cellElement.createTextChild(WebInspector.UIString("Lat = ")); | 518 cellElement.createTextChild(WebInspector.UIString("Lat = ")); |
| 519 this._latitudeElement = WebInspector.SettingsUI.createInput(cellElement,
"geolocation-override-latitude", String(geolocation.latitude), this._applyGeolo
cationUserInput.bind(this), true); | 519 this._latitudeElement = WebInspector.SettingsUI.createInput(cellElement,
"geolocation-override-latitude", String(geolocation.latitude), this._applyGeolo
cationUserInput.bind(this), true); |
| 520 cellElement.createTextChild(" , "); | 520 cellElement.createTextChild(" , "); |
| 521 cellElement.createTextChild(WebInspector.UIString("Lon = ")); | 521 cellElement.createTextChild(WebInspector.UIString("Lon = ")); |
| 522 this._longitudeElement = WebInspector.SettingsUI.createInput(cellElement
, "geolocation-override-longitude", String(geolocation.longitude), this._applyGe
olocationUserInput.bind(this), true); | 522 this._longitudeElement = WebInspector.SettingsUI.createInput(cellElement
, "geolocation-override-longitude", String(geolocation.longitude), this._applyGe
olocationUserInput.bind(this), true); |
| 523 rowElement = tableElement.createChild("tr"); | 523 rowElement = tableElement.createChild("tr"); |
| 524 cellElement = rowElement.createChild("td"); | 524 cellElement = rowElement.createChild("td"); |
| 525 cellElement.colSpan = 2; | 525 cellElement.colSpan = 2; |
| 526 var geolocationErrorLabelElement = document.createElement("label"); | 526 var geolocationErrorLabelElement = createElement("label"); |
| 527 var geolocationErrorCheckboxElement = geolocationErrorLabelElement.creat
eChild("input"); | 527 var geolocationErrorCheckboxElement = geolocationErrorLabelElement.creat
eChild("input"); |
| 528 geolocationErrorCheckboxElement.id = "geolocation-error"; | 528 geolocationErrorCheckboxElement.id = "geolocation-error"; |
| 529 geolocationErrorCheckboxElement.type = "checkbox"; | 529 geolocationErrorCheckboxElement.type = "checkbox"; |
| 530 geolocationErrorCheckboxElement.checked = !geolocation || geolocation.er
ror; | 530 geolocationErrorCheckboxElement.checked = !geolocation || geolocation.er
ror; |
| 531 geolocationErrorCheckboxElement.addEventListener("click", this._applyGeo
locationUserInput.bind(this), false); | 531 geolocationErrorCheckboxElement.addEventListener("click", this._applyGeo
locationUserInput.bind(this), false); |
| 532 geolocationErrorLabelElement.createTextChild(WebInspector.UIString("Emul
ate position unavailable")); | 532 geolocationErrorLabelElement.createTextChild(WebInspector.UIString("Emul
ate position unavailable")); |
| 533 this._geolocationErrorElement = geolocationErrorCheckboxElement; | 533 this._geolocationErrorElement = geolocationErrorCheckboxElement; |
| 534 cellElement.appendChild(geolocationErrorLabelElement); | 534 cellElement.appendChild(geolocationErrorLabelElement); |
| 535 | 535 |
| 536 return fieldsetElement; | 536 return fieldsetElement; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 /** | 731 /** |
| 732 * @param {!Object} overridesSupport | 732 * @param {!Object} overridesSupport |
| 733 * @return {!Promise} | 733 * @return {!Promise} |
| 734 */ | 734 */ |
| 735 reveal: function(overridesSupport) | 735 reveal: function(overridesSupport) |
| 736 { | 736 { |
| 737 WebInspector.inspectorView.showViewInDrawer("emulation"); | 737 WebInspector.inspectorView.showViewInDrawer("emulation"); |
| 738 return Promise.resolve(); | 738 return Promise.resolve(); |
| 739 } | 739 } |
| 740 } | 740 } |
| OLD | NEW |