diff options
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-dialogs/www')
13 files changed, 156 insertions, 50 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js index 8936a5c2..8936a5c2 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js index 401049e8..da2e75d1 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js @@ -21,20 +21,24 @@ module.exports = function (quantity) { var count = 0, - beepObj, - play = function () { - //create new object every time due to strage playback behaviour - beepObj = new Audio('local:///chrome/plugin/cordova-plugin-dialogs/notification-beep.wav'); - beepObj.addEventListener("ended", callback); - beepObj.play(); - }, - callback = function () { - if (--count > 0) { - play(); - } else { - delete beepObj; - } - }; + beepObj; + + function callback() { + if (--count > 0) { + play(); + } else { + beepObj.removeEventListener("ended", callback); + beepObj = null; + } + } + + function play() { + //create new object every time due to strage playback behaviour + beepObj = new Audio('local:///chrome/plugin/cordova-plugin-dialogs/notification-beep.wav'); + beepObj.addEventListener("ended", callback); + beepObj.play(); + } + count += quantity || 1; if (count > 0) { play(); diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/notification-beep.wav b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/notification-beep.wav Binary files differindex d0ad085f..d0ad085f 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/notification-beep.wav +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/notification-beep.wav diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/browser/notification.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/browser/notification.js index e8753093..1fdfafd7 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/browser/notification.js +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/browser/notification.js @@ -65,6 +65,21 @@ module.exports.prompt = window.navigator.notification.prompt = function(message, }; +var audioContext = (function() { + // Determine if the Audio API is supported by this browser + var AudioApi = window.AudioContext; + if (!AudioApi) { + AudioApi = window.webkitAudioContext; + } + + if (AudioApi) { + // The Audio API is supported, so create a singleton instance of the AudioContext + return new AudioApi(); + } + + return undefined; +}()); + module.exports.beep = window.navigator.notification.beep = function(times) { if (times > 0) { var BEEP_DURATION = 700; @@ -98,18 +113,3 @@ module.exports.beep = window.navigator.notification.beep = function(times) { } } }; - -var audioContext = (function() { - // Determine if the Audio API is supported by this browser - var AudioApi = window.AudioContext; - if (!AudioApi) { - AudioApi = window.webkitAudioContext; - } - - if (AudioApi) { - // The Audio API is supported, so create a singleton instance of the AudioContext - return new AudioApi(); - } - - return undefined; -}()); diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger-press.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger-press.png Binary files differindex d7529b5b..d7529b5b 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger-press.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger-press.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger.png Binary files differindex 400e3ae3..400e3ae3 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/danger.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/default.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/default.png Binary files differindex 2ff298a1..2ff298a1 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/default.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/default.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/gradient.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/gradient.png Binary files differindex b2885450..b2885450 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/gradient.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/gradient.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/notification.css b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/notification.css index 34d92b88..34d92b88 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/notification.css +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/notification.css diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png Binary files differindex af03f569..af03f569 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/recommend.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/recommend.png Binary files differindex 42aed390..42aed390 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/recommend.png +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/recommend.png diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/notification.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/notification.js index c3f70d07..4db8f0f2 100755..100644 --- a/StoneIsland/plugins/cordova-plugin-dialogs/www/notification.js +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/notification.js @@ -37,9 +37,10 @@ module.exports = { * @param {String} buttonLabel Label of the close button (default: OK) */ alert: function(message, completeCallback, title, buttonLabel) { - var _title = (title || "Alert"); + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Alert"); var _buttonLabel = (buttonLabel || "OK"); - exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]); + exec(completeCallback, null, "Notification", "alert", [_message, _title, _buttonLabel]); }, /** @@ -52,7 +53,8 @@ module.exports = { * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel']) */ confirm: function(message, resultCallback, title, buttonLabels) { - var _title = (title || "Confirm"); + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Confirm"); var _buttonLabels = (buttonLabels || ["OK", "Cancel"]); // Strings are deprecated! @@ -60,23 +62,9 @@ module.exports = { console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array)."); } - // Some platforms take an array of button label names. - // Other platforms take a comma separated list. - // For compatibility, we convert to the desired type based on the platform. - if (platform.id == "amazon-fireos" || platform.id == "android" || platform.id == "ios" || - platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu" || - platform.id == "windows8" || platform.id == "windows") { + _buttonLabels = convertButtonLabels(_buttonLabels); - if (typeof _buttonLabels === 'string') { - _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here - } - } else { - if (Array.isArray(_buttonLabels)) { - var buttonLabelArray = _buttonLabels; - _buttonLabels = buttonLabelArray.toString(); - } - } - exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]); + exec(resultCallback, null, "Notification", "confirm", [_message, _title, _buttonLabels]); }, /** @@ -92,9 +80,17 @@ module.exports = { * @param {String} defaultText Textbox input value (default: empty string) */ prompt: function(message, resultCallback, title, buttonLabels, defaultText) { - var _message = (message || "Prompt message"); - var _title = (title || "Prompt"); + var _message = (typeof message === "string" ? message : JSON.stringify(message)); + var _title = (typeof title === "string" ? title : "Prompt"); var _buttonLabels = (buttonLabels || ["OK","Cancel"]); + + // Strings are deprecated! + if (typeof _buttonLabels === 'string') { + console.log("Notification.prompt(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array)."); + } + + _buttonLabels = convertButtonLabels(_buttonLabels); + var _defaultText = (defaultText || ""); exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]); }, @@ -110,3 +106,25 @@ module.exports = { exec(null, null, "Notification", "beep", [ defaultedCount ]); } }; + +function convertButtonLabels(buttonLabels) { + + // Some platforms take an array of button label names. + // Other platforms take a comma separated list. + // For compatibility, we convert to the desired type based on the platform. + if (platform.id == "amazon-fireos" || platform.id == "android" || platform.id == "ios" || + platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu" || + platform.id == "windows8" || platform.id == "windows") { + + if (typeof buttonLabels === 'string') { + buttonLabels = buttonLabels.split(","); // not crazy about changing the var type here + } + } else { + if (Array.isArray(buttonLabels)) { + var buttonLabelArray = buttonLabels; + buttonLabels = buttonLabelArray.toString(); + } + } + + return buttonLabels; +} diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/windows/notification.css b/StoneIsland/plugins/cordova-plugin-dialogs/www/windows/notification.css new file mode 100644 index 00000000..785039ba --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/windows/notification.css @@ -0,0 +1,84 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +.dlgWrap { + position: absolute; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.25); + z-index: 100000; + top: 0; +} + +.dlgContainer { + width: 100%; + min-height: 180px; + height: auto; + overflow: auto; + background-color: white; + position: relative; + line-height: 2; + top: 50%; + transform: translateY(-50%); + padding: 0 30%; +} + +.dlgContainer #lbl-title { + font-size: 24pt; +} + +.dlgContainer #prompt-input { + width: 100%; +} + +.dlgButton { + margin: 8px 0 0 16px; + float: right; + font-size: 11pt; + background-color: #cccccc; + border: none; + font-weight: 600; + font-family: "Segoe UI", Arial, sans-serif; + padding: 0 22px; +} + +.dlgButton.dlgButtonFirst { + color: white; + background-color: #464646; +} + +.dlgContainer.dlgContainer-windows { + width: 50%; + max-width: 680px; + padding: 0 5%; + top: 50%; + left: 50%; + position: fixed; + transform: translate(-50%, -50%); + border: 1px solid rgb(24, 160, 191); + border-image: none; + box-shadow: 0 0 14px 6px rgba(0,0,0,0.16); + text-transform: none; +} + +.dlgContainer.dlgContainer-phone { + padding: 0 5%; +} |
