Permalink
Browse files

Merge pull request #6940 from etiennesegonzac/nightly-2012-12-11

Nightly 2012 12 11
  • Loading branch information...
2 parents c2c9bc9 + cb1d3b7 commit 460ba0c43e1a0c942aedf272ec0f3cbe20905ed5 @etiennesegonzac etiennesegonzac committed Dec 11, 2012
Showing with 1,464 additions and 729 deletions.
  1. +34 −1 apps/bluetooth/js/transfer.js
  2. +4 −1 apps/bluetooth/locales/bluetooth.en-US.properties
  3. +12 −0 apps/bluetooth/transfer.html
  4. +46 −48 apps/browser/index.html
  5. +1 −1 apps/browser/js/browser.js
  6. +17 −44 apps/browser/js/modal_dialog.js
  7. +26 −37 apps/browser/style/browser.css
  8. BIN apps/browser/style/images/add.png
  9. BIN apps/browser/style/images/back-pressed.png
  10. BIN apps/browser/style/images/back.png
  11. BIN apps/browser/style/images/bookmark.png
  12. BIN apps/browser/style/images/drawer-collapse.png
  13. BIN apps/browser/style/images/forward.png
  14. BIN apps/browser/style/images/iconaction_back_50x50.png
  15. BIN apps/browser/style/images/iconaction_bookmark_30x30.png
  16. BIN apps/browser/style/images/iconaction_browser_back_30x30.png
  17. BIN apps/browser/style/images/iconaction_browser_backpressed_30x30.png
  18. BIN apps/browser/style/images/iconaction_browser_forward_30x30.png
  19. BIN apps/browser/style/images/iconaction_new_30x30.png
  20. BIN apps/browser/style/images/iconaction_settings_30x30.png
  21. BIN apps/browser/style/images/settings.png
  22. +0 −131 apps/browser/style/modal_dialog.css
  23. +85 −56 apps/calendar/js/ext/ical.js
  24. +13 −1 apps/calendar/js/models/event.js
  25. +22 −30 apps/calendar/js/provider/abstract.js
  26. +54 −1 apps/calendar/js/provider/caldav.js
  27. +0 −4 apps/calendar/js/provider/local.js
  28. +15 −1 apps/calendar/js/service/caldav.js
  29. +2 −1 apps/calendar/js/store/calendar.js
  30. +13 −3 apps/calendar/js/views/modify_event.js
  31. BIN apps/calendar/style/icons/ActionIcons_30x30_back_nav.png
  32. BIN apps/calendar/style/icons/ActionIcons_30x30_done.png
  33. BIN apps/calendar/style/icons/ActionIcons_30x30_forward_nav.png
  34. BIN apps/calendar/style/icons/ActionIcons_30x30_refresh.png
  35. BIN apps/calendar/style/icons/ActionIcons_30x30_settings.png
  36. +4 −0 apps/calendar/style/modify_account_view.css
  37. +1 −1 apps/calendar/style/modify_event_view.css
  38. +0 −6 apps/calendar/style/ui.css
  39. +17 −0 apps/calendar/test/unit/models/event_test.js
  40. +71 −2 apps/calendar/test/unit/provider/caldav_test.js
  41. +14 −4 apps/calendar/test/unit/service/caldav_test.js
  42. +0 −1 apps/calendar/test/unit/store/calendar_test.js
  43. +9 −2 apps/calendar/test/unit/support/factories/all.js
  44. +55 −12 apps/calendar/test/unit/views/modify_event_test.js
  45. +3 −1 apps/camera/js/camera.js
  46. BIN apps/camera/style/images/camera.png
  47. BIN apps/camera/style/images/flash_auto.png
  48. BIN apps/camera/style/images/flash_off.png
  49. BIN apps/camera/style/images/flash_on.png
  50. BIN apps/camera/style/images/flash_torch.png
  51. BIN apps/camera/style/images/grid.png
  52. BIN apps/camera/style/images/toggle_back.png
  53. BIN apps/camera/style/images/toggle_front.png
  54. BIN apps/camera/style/images/video.png
  55. BIN apps/communications/contacts/style/gphx/bitmap/default/block-list/fav.png
  56. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/call.png
  57. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/fb_profile.png
  58. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/link.png
  59. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/location.png
  60. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/mail.png
  61. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/plus_sign.png
  62. BIN apps/communications/contacts/style/gphx/bitmap/default/buttons/sms.png
  63. BIN apps/communications/contacts/style/gphx/bitmap/default/forms/add.png
  64. BIN apps/communications/contacts/style/gphx/bitmap/default/forms/check-default.png
  65. BIN apps/communications/contacts/style/gphx/bitmap/default/forms/delete.png
  66. BIN apps/communications/contacts/style/gphx/bitmap/default/forms/undo.png
  67. BIN apps/communications/contacts/style/gphx/bitmap/default/lists/favorites.png
  68. BIN apps/communications/contacts/style/gphx/bitmap/default/lists/tick.png
  69. BIN apps/communications/contacts/style/gphx/bitmap/default/vw-header/icons/fav-star.png
  70. BIN apps/communications/contacts/style/gphx/bitmap/default/vw-header/icons/settings.png
  71. BIN apps/communications/contacts/style/images/arrow_big.png
  72. BIN apps/communications/contacts/style/images/arrow_small.png
  73. BIN apps/communications/contacts/style/images/icon-fav-button.png
  74. BIN apps/communications/contacts/style/images/import_SIM.png
  75. +2 −2 apps/communications/dialer/js/handled_call.js
  76. +92 −26 apps/communications/dialer/js/keypad.js
  77. +18 −3 apps/communications/dialer/js/oncall.js
  78. BIN apps/communications/dialer/style/images/ActionIcon_40x40_addcontact.png
  79. BIN apps/communications/dialer/style/images/ActionIcon_40x40_bluetooth.png
  80. BIN apps/communications/dialer/style/images/ActionIcon_40x40_bluetooth_active.png
  81. BIN apps/communications/dialer/style/images/ActionIcon_40x40_contacts.png
  82. BIN apps/communications/dialer/style/images/ActionIcon_40x40_dialpad.png
  83. BIN apps/communications/dialer/style/images/ActionIcon_40x40_hangup.png
  84. BIN apps/communications/dialer/style/images/ActionIcon_40x40_mute.png
  85. BIN apps/communications/dialer/style/images/ActionIcon_40x40_mute_active.png
  86. BIN apps/communications/dialer/style/images/ActionIcon_40x40_pause.png
  87. BIN apps/communications/dialer/style/images/ActionIcon_40x40_pickup.png
  88. BIN apps/communications/dialer/style/images/ActionIcon_40x40_recents.png
  89. BIN apps/communications/dialer/style/images/ActionIcons_30x30_dismiss_keyboard.png
  90. BIN apps/communications/dialer/style/images/CallLog_30x30_incoming.png
  91. BIN apps/communications/dialer/style/images/CallLog_30x30_missed.png
  92. BIN apps/communications/dialer/style/images/CallLog_30x30_missed_grey.png
  93. BIN apps/communications/dialer/style/images/CallLog_30x30_outgoing.png
  94. BIN apps/communications/dialer/style/images/DialerIcon_35x35_paused.png
  95. BIN apps/communications/dialer/style/images/contacts.png
  96. BIN apps/communications/dialer/style/images/dialer_icon_delete.png
  97. BIN apps/communications/dialer/style/images/dialer_icon_delete_active.png
  98. BIN apps/communications/dialer/style/images/dialpad.png
  99. BIN apps/communications/dialer/style/images/icon_arrow.png
  100. BIN apps/communications/dialer/style/images/incoming-call.png
  101. BIN apps/communications/dialer/style/images/incoming_icon.png
  102. BIN apps/communications/dialer/style/images/outgoing_icon.png
  103. BIN apps/communications/dialer/style/images/recents.png
  104. BIN apps/communications/dialer/style/images/timeline_checkbox_off.png
  105. BIN apps/communications/dialer/style/images/timeline_checkbox_on.png
  106. +12 −2 apps/communications/dialer/style/oncall.css
  107. BIN apps/communications/ftu/css/images/privacy_sprite.png
  108. +71 −6 apps/communications/ftu/css/style.css
  109. +70 −4 apps/communications/ftu/index.html
  110. +68 −14 apps/communications/ftu/js/navigation.js
  111. +15 −0 apps/communications/ftu/js/ui.js
  112. +21 −5 apps/communications/ftu/locales/ftu.en-US.properties
  113. +1 −0 apps/email/autoconfig/hotmail.co.jp
  114. +1 −0 apps/email/autoconfig/hotmail.co.uk
  115. +1 −0 apps/email/autoconfig/hotmail.com
  116. +1 −0 apps/email/autoconfig/hotmail.com.br
  117. +1 −0 apps/email/autoconfig/hotmail.de
  118. +1 −0 apps/email/autoconfig/hotmail.es
  119. +1 −0 apps/email/autoconfig/hotmail.fr
  120. +1 −0 apps/email/autoconfig/hotmail.it
  121. +1 −0 apps/email/autoconfig/live.co.jp
  122. +1 −0 apps/email/autoconfig/live.co.uk
  123. +1 −0 apps/email/autoconfig/live.com
  124. +1 −0 apps/email/autoconfig/live.de
  125. +1 −0 apps/email/autoconfig/live.fr
  126. +1 −0 apps/email/autoconfig/live.it
  127. +1 −0 apps/email/autoconfig/live.jp
  128. +1 −0 apps/email/autoconfig/msn.com
  129. +27 −0 apps/email/autoconfig/outlook.com
  130. +10 −8 apps/email/js/ext/gaia-email-opt.js
  131. BIN apps/email/style/images/add-contact.png
  132. BIN apps/email/style/images/icons/delete.png
  133. BIN apps/email/style/images/icons/download.png
  134. BIN apps/email/style/images/icons/edit-mode.png
  135. BIN apps/email/style/images/icons/forward.png
  136. BIN apps/email/style/images/icons/message-list-attachment.png
  137. BIN apps/email/style/images/icons/message-list-star.png
  138. BIN apps/email/style/images/icons/move.png
  139. BIN apps/email/style/images/icons/refresh.png
  140. BIN apps/email/style/images/icons/search.png
  141. BIN apps/email/style/images/icons/settings.png
  142. BIN apps/email/style/images/icons/star.png
  143. +15 −15 apps/gallery/style/gallery.css
  144. BIN apps/gallery/style/images/actionicon_cancel.png
  145. BIN apps/gallery/style/images/actionicon_crop11.png
  146. BIN apps/gallery/style/images/actionicon_crop23.png
  147. BIN apps/gallery/style/images/actionicon_crop32.png
  148. BIN apps/gallery/style/images/actionicon_cropfree.png
  149. BIN apps/gallery/style/images/actionicon_done.png
  150. BIN apps/gallery/style/images/actionicon_grid_view.png
  151. BIN apps/gallery/style/images/back.png
  152. BIN apps/gallery/style/images/camera.png
  153. BIN apps/gallery/style/images/delete.png
  154. BIN apps/gallery/style/images/edit.png
  155. BIN apps/gallery/style/images/iconaction_camera_30x30.png
  156. BIN apps/gallery/style/images/iconaction_camera_crop1x1_30x30.png
  157. BIN apps/gallery/style/images/iconaction_camera_crop2x3_30x30.png
  158. BIN apps/gallery/style/images/iconaction_camera_crop3x2_30x30.png
  159. BIN apps/gallery/style/images/iconaction_camera_freecrop_30x30.png
  160. BIN apps/gallery/style/images/iconaction_camera_gridview_30x30.png
  161. BIN apps/gallery/style/images/iconaction_delete_30x30.png
  162. BIN apps/gallery/style/images/iconaction_done_30x30.png
  163. BIN apps/gallery/style/images/iconaction_edit_30x30.png
  164. BIN apps/gallery/style/images/iconaction_select_30x30.png
  165. BIN apps/gallery/style/images/iconaction_share_30x30.png
  166. BIN apps/gallery/style/images/{actionicon_undo.png → iconaction_undo_30x30.png}
  167. BIN apps/gallery/style/images/select.png
  168. BIN apps/gallery/style/images/share.png
  169. +2 −2 apps/gallery/style/open.css
  170. +6 −7 apps/homescreen/everything.me/js/etmmanager.js
  171. +1 −1 apps/homescreen/index.html
  172. +3 −2 apps/homescreen/js/bookmark.js
  173. +2 −1 apps/homescreen/manifest.webapp
  174. +8 −0 apps/keyboard/style/keyboard.css
  175. +2 −8 apps/settings/index.html
  176. +23 −16 apps/settings/js/call.js
  177. +1 −14 apps/settings/js/carrier.js
  178. +110 −16 apps/settings/js/connectivity.js
  179. +2 −1 apps/settings/js/hotspot.js
  180. +2 −1 apps/settings/js/icc.js
  181. +2 −1 apps/settings/js/icc_menu.js
  182. +15 −14 apps/settings/js/sound.js
  183. +1 −3 apps/settings/locales/settings.en-US.properties
  184. BIN apps/settings/style/images/icons_sprite.png
  185. +1 −1 apps/system/js/modal_dialog.js
  186. +80 −58 apps/system/js/sound_manager.js
  187. +130 −46 apps/system/js/window_manager.js
  188. +1 −0 apps/system/style/simcard.css
  189. +5 −0 apps/system/style/sound_manager/sound_manager.css
  190. BIN apps/system/style/statusbar/images/icons.png
  191. BIN apps/system/style/update_manager/images/grey-noise-bg.png
  192. BIN apps/system/style/update_manager/images/loader.png
  193. +63 −57 apps/system/style/update_manager/update_manager.css
  194. +1 −1 build/webapp-manifests.js
  195. +0 −2 external-apps/mochitest/manifest.webapp
  196. +1 −1 shared/js/l10n.js
  197. +3 −1 shared/style/confirm.css
  198. +43 −0 shared/style/confirm/long_content.html
  199. BIN shared/style/headers/images/icons/add.png
  200. BIN shared/style/headers/images/icons/back-rtl.png
  201. BIN shared/style/headers/images/icons/back.png
  202. BIN shared/style/headers/images/icons/close.png
  203. BIN shared/style/headers/images/icons/edit.png
  204. BIN shared/style/headers/images/icons/menu.png
  205. BIN shared/style/headers/images/icons/reply-all.png
  206. BIN shared/style/headers/images/icons/reply.png
  207. BIN shared/style/headers/images/icons/send.png
  208. BIN shared/style/headers/images/icons/user.png
  209. BIN shared/style/headers/images/ui/dark/header.png
  210. BIN shared/style/headers/images/ui/dark/negative.png
  211. +1 −1 test_apps/test-container/index.html
@@ -32,6 +32,12 @@ window.addEventListener('localized', function showPanel() {
document.getElementById('enable-bluetooth-button-turn-on');
var dialogAlertView = document.getElementById('alert-view');
var alertOkButton = document.getElementById('alert-button-ok');
+ var dialogConfirmPairing =
+ document.getElementById('enable-bluetooth-settings-view');
+ var pairingCancelButton =
+ document.getElementById('enable-bluetooth-settings-button-cancel');
+ var pairingOkButton =
+ document.getElementById('enable-bluetooth-settings-button-ok');
var deviceSelect = null;
var dialogDeviceSelector = document.getElementById('value-selector');
var deviceSelectorContainers =
@@ -137,6 +143,33 @@ window.addEventListener('localized', function showPanel() {
endTransfer();
}
+ function showPairingConfirmation(msg) {
+ debug(msg);
+ dialogConfirmPairing.hidden = false;
+ pairingCancelButton.addEventListener('click',
+ confirmPairingDevice.bind(this, false));
+ pairingOkButton.addEventListener('click',
+ confirmPairingDevice.bind(this, true));
+ }
+
+ function confirmPairingDevice(enabled) {
+ dialogConfirmPairing.hidden = true;
+ pairingCancelButton.removeEventListener('click', confirmPairingDevice);
+ pairingOkButton.removeEventListener('click', confirmPairingDevice);
+ if (enabled) {
+ // Launch Settings App to Bluetooth settings.
+ var activityRequest = new MozActivity({
+ name: 'configure',
+ data: {
+ target: 'device',
+ section: 'bluetooth'
+ }
+ });
+ }
+ activity.postError('cancelled');
+ endTransfer();
+ }
+
function endTransfer() {
bluetoothCancelButton.removeEventListener('click', cancelTransfer);
bluetoothTurnOnButton.removeEventListener('click', turnOnBluetooth);
@@ -151,7 +184,7 @@ window.addEventListener('localized', function showPanel() {
if (length == 0) {
var msg = 'There is no paired device!' +
' Please pair your bluetooth device first.';
- cannotTransfer(msg);
+ showPairingConfirmation(msg);
return;
}
// Put the list to value selector
@@ -7,4 +7,7 @@ turn-on = Turn On
error-transfer-title = Bluetooth file transfer failed
error-transfer-settings = Bluetooth file transfer failed. Check that the Bluetooth settings are correct.
ok = OK
-choose-option = Choose your option
+choose-option = Choose your option
+no-devices-paired-title = No Bluetooth devices paired.
+no-devices-paired-settings = Would you like to pair a device now?
+pair-device = Pair device
@@ -48,6 +48,18 @@ <h3 data-l10n-id="error-transfer-title">Bluetooth file transfer failed</h3>
<button class="negative" id="alert-button-ok" data-l10n-id="ok">OK</button>
</menu>
</section>
+ <section role="dialog" id="enable-bluetooth-settings-view" hidden>
+ <div>
+ <h3 data-l10n-id="no-devices-paired-title">No Bluetooth devices paired.</h3>
+ <p data-l10n-id="no-devices-paired-settings">
+ Would you like to pair a device now?
+ </p>
+ </div>
+ <menu data-items="2">
+ <button id="enable-bluetooth-settings-button-cancel" data-l10n-id="cancel">Cancel</button>
+ <button class="negative" id="enable-bluetooth-settings-button-ok" data-l10n-id="pair-device">Pair device</button>
+ </menu>
+ </section>
<!-- Overwrite Value Selector -->
<div id="value-selector" hidden>
<form id="select-option-popup" role="dialog">
View
@@ -5,7 +5,7 @@
<meta http-equiv="pragma" content="no-cache">
<title>Browser</title>
<link rel="stylesheet" href="style/browser.css" type="text/css">
- <link rel="stylesheet" href="style/modal_dialog.css" type="text/css">
+ <link rel="stylesheet" href="shared/style/confirm.css" type="text/css">
<link rel="stylesheet" href="style/action_menu.css" type="text/css">
<link rel="stylesheet" href="shared/style/headers.css">
<link rel="stylesheet" href="style/authentication_dialog.css" type="text/css">
@@ -89,53 +89,6 @@ <h3 data-l10n-id="this-is-embarrassing">Well, this is embarrassing.</h3>
</menu>
</div>
- <div id="screen">
- <div id="modal-dialog">
- <div id="modal-dialog-table">
- <div id="modal-dialog-tablecell">
- <div id="modal-dialog-alert">
- <div class="modal-dialog-message-container">
- <span id="modal-dialog-alert-message"></span>
- </div>
- <button id="modal-dialog-alert-ok" data-l10n-id="ok">OK</button>
- </div>
-
- <div id="modal-dialog-confirm">
- <div class="modal-dialog-message-container">
- <span id="modal-dialog-confirm-message"></span>
- </div>
- <button id="modal-dialog-confirm-ok" data-l10n-id="ok">OK</button>
- <button id="modal-dialog-confirm-cancel" data-l10n-id="cancel">
- Cancel
- </button>
- </div>
-
- <div id="modal-dialog-prompt">
- <div class="modal-dialog-message-container">
- <span id="modal-dialog-prompt-message"></span>
- <input id="modal-dialog-prompt-input" />
- </div>
- <button id="modal-dialog-prompt-ok" data-l10n-id="ok">OK</button>
- <button id="modal-dialog-prompt-cancel" data-l10n-id="cancel">
- Cancel
- </button>
- </div>
-
- <div id="modal-dialog-custom-prompt">
- <div class="modal-dialog-message-container">
- <span id="modal-dialog-custom-prompt-message"></span>
- </div>
- <label>
- <input id="modal-dialog-custom-prompt-checkbox" type="checkbox" hidden />
- <span></span>
- </label>
- <div id="modal-dialog-custom-prompt-buttons"></div>
- </div>
-
- </div>
- </div>
- </div>
- </div>
</div>
</div>
@@ -207,6 +160,51 @@ <h1 l10n-id="login-to-a-website">Login to a website</h1>
</label>
</section>
+ <form role="dialog" id="modal-dialog-confirm" data-type="confirm" hidden>
+ <section>
+ <p><span id="modal-dialog-confirm-message"></span></p>
+ </section>
+ <menu>
+ <button id="modal-dialog-confirm-cancel" data-l10n-id="cancel">Cancel</button>
+ <button id="modal-dialog-confirm-ok" data-l10n-id="ok">OK</button>
+ </menu>
+ </form>
+
+ <form role="dialog" id="modal-dialog-alert" data-type="confirm" hidden>
+ <section>
+ <p><span id="modal-dialog-alert-message"></span></p>
+ </section>
+ <menu>
+ <button id="modal-dialog-alert-ok" class="full" data-l10n-id="ok">OK</button>
+ </menu>
+ </form>
+
+ <form role="dialog" id="modal-dialog-prompt" data-type="confirm" hidden>
+ <section>
+ <p>
+ <span id="modal-dialog-prompt-message"></span>
+ <input id="modal-dialog-prompt-input" />
+ </p>
+ </section>
+ <menu>
+ <button id="modal-dialog-prompt-cancel" data-l10n-id="cancel">
+ Cancel
+ </button>
+ <button id="modal-dialog-prompt-ok" data-l10n-id="ok">OK</button>
+ </menu>
+ </form>
+
+ <form role="dialog" id="modal-dialog-custom-prompt" data-type="confirm" hidden>
+ <section>
+ <p><span id="modal-dialog-custom-prompt-message"></span></p>
+ <label>
+ <input id="modal-dialog-custom-prompt-checkbox" type="checkbox" />
+ <span></span>
+ </label>
+ </section>
+ <menu id="modal-dialog-custom-prompt-buttons"></menu>
+ </form>
+
<section role="region" id="settings" class="skin-organic">
<header id="settings-header">
<button id="settings-done-button"><span class="icon icon-back"></span></button>
@@ -128,7 +128,7 @@ var Browser = {
this.handleWindowResize();
- ModalDialog.init(false);
+ ModalDialog.init();
AuthenticationDialog.init(false);
// Load homepage once Places is initialised
@@ -15,8 +15,6 @@ var ModalDialog = {
// DOM
elements: {},
- boundToWindow: false,
-
// Get all elements when inited.
getAllElements: function md_getAllElements() {
var elementsID = ['alert', 'alert-ok', 'alert-message',
@@ -36,29 +34,18 @@ var ModalDialog = {
this.elements[toCamelCase(name)] =
document.getElementById(this.prefix + name);
}, this);
-
- this.screen = document.getElementById('screen');
},
// Save the events returned by mozbrowsershowmodalprompt for later use.
// The events are stored according to webapp origin
// e.g., 'http://uitest.gaiamobile.org': evt
currentEvents: {},
- init: function md_init(bindToWindow) {
+ init: function md_init() {
// Get all elements initially.
this.getAllElements();
var elements = this.elements;
- this.boundToWindow = bindToWindow || false;
-
- // Bind events
- if (this.boundToWindow) {
- window.addEventListener('mozbrowsershowmodalprompt', this);
- window.addEventListener('appopen', this);
- window.addEventListener('appwillclose', this);
- }
-
for (var id in elements) {
if (elements[id].tagName.toLowerCase() == 'button') {
elements[id].addEventListener('click', this);
@@ -83,26 +70,17 @@ var ModalDialog = {
break;
case 'click':
+ if (evt.currentTarget.nodeName == "BUTTON" ||
+ evt.currentTarget == elements.customPromptButtons) {
+ evt.preventDefault();
+ }
if (evt.currentTarget === elements.confirmCancel ||
evt.currentTarget === elements.promptCancel) {
this.cancelHandler();
} else {
this.confirmHandler(evt.target);
}
break;
-
- case 'appopen':
- this.show(evt.detail.origin);
- break;
-
- case 'appwillclose':
- // Do nothing if the app is closed at background.
- if (evt.detail.origin !== this.currentOrigin)
- return;
-
- // Reset currentOrigin
- this.hide();
- break;
}
},
@@ -113,7 +91,6 @@ var ModalDialog = {
var message = evt.detail.message;
var elements = this.elements;
- this.screen.classList.add('modal-dialog');
function escapeHTML(str) {
var span = document.createElement('span');
@@ -130,18 +107,18 @@ var ModalDialog = {
switch (type) {
case 'alert':
elements.alertMessage.innerHTML = message;
- elements.alert.classList.add('visible');
+ elements.alert.hidden = false;
break;
case 'prompt':
- elements.prompt.classList.add('visible');
+ elements.prompt.hidden = false;
elements.promptInput.value = evt.detail.initialValue;
elements.promptMessage.innerHTML = message;
break;
case 'custom-prompt':
var prompt = evt.detail;
- elements.customPrompt.classList.add('visible');
+ elements.customPrompt.hidden = false;
elements.customPromptMessage.innerHTML = prompt.message;
// Display custom list of buttons
@@ -174,12 +151,12 @@ var ModalDialog = {
checkbox.removeAttribute('checked');
}
// We assume that checkbox custom message is already translated
- checkbox.nextSibling.textContent = prompt.checkboxMessage;
+ checkbox.nextElementSibling.textContent = prompt.checkboxMessage;
}
break;
case 'confirm':
- elements.confirm.classList.add('visible');
+ elements.confirm.hidden = false;
elements.confirmMessage.innerHTML = message;
break;
}
@@ -190,27 +167,24 @@ var ModalDialog = {
if (!evt)
return;
var type = evt.detail.promptType;
- this.elements[type].classList.remove('visible');
this.currentOrigin = null;
- this.screen.classList.remove('modal-dialog');
},
// When user clicks OK button on alert/confirm/prompt
confirmHandler: function md_confirmHandler(target) {
- this.screen.classList.remove('modal-dialog');
var elements = this.elements;
var evt = this.currentEvents[this.currentOrigin];
var type = evt.detail.promptType;
switch (type) {
case 'alert':
- elements.alert.classList.remove('visible');
+ elements.alert.hidden = true;
break;
case 'prompt':
evt.detail.returnValue = elements.promptInput.value;
- elements.prompt.classList.remove('visible');
+ elements.prompt.hidden = true;
break;
case 'custom-prompt':
@@ -220,12 +194,12 @@ var ModalDialog = {
if (evt.showCheckbox)
returnValue.checked = elements.customPromptCheckbox.checked;
evt.detail.returnValue = returnValue;
- elements.customPrompt.classList.remove('visible');
+ elements.customPrompt.hidden = true;
break;
case 'confirm':
evt.detail.returnValue = true;
- elements.confirm.classList.remove('visible');
+ elements.confirm.hidden = true;
break;
}
@@ -239,25 +213,24 @@ var ModalDialog = {
// when the user try to escape the dialog with the escape key
cancelHandler: function md_cancelHandler() {
var evt = this.currentEvents[this.currentOrigin];
- this.screen.classList.remove('modal-dialog');
var elements = this.elements;
var type = evt.detail.promptType;
switch (type) {
case 'alert':
- elements.alert.classList.remove('visible');
+ elements.alert.hidden = true;
break;
case 'prompt':
/* return null when click cancel */
evt.detail.returnValue = null;
- elements.prompt.classList.remove('visible');
+ elements.prompt.hidden = true;
break;
case 'confirm':
/* return false when click cancel */
evt.detail.returnValue = false;
- elements.confirm.classList.remove('visible');
+ elements.confirm.hidden = true;
break;
}
Oops, something went wrong.

0 comments on commit 460ba0c

Please sign in to comment.