diff options
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-dialogs/www')
12 files changed, 591 insertions, 0 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js new file mode 100644 index 00000000..8936a5c2 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/android/notification.js @@ -0,0 +1,74 @@ +/* + * + * 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. + * +*/ + +var exec = require('cordova/exec'); + +/** + * Provides Android enhanced notification API. + */ +module.exports = { + activityStart : function(title, message) { + // If title and message not specified then mimic Android behavior of + // using default strings. + if (typeof title === "undefined" && typeof message == "undefined") { + title = "Busy"; + message = 'Please wait...'; + } + + exec(null, null, 'Notification', 'activityStart', [ title, message ]); + }, + + /** + * Close an activity dialog + */ + activityStop : function() { + exec(null, null, 'Notification', 'activityStop', []); + }, + + /** + * Display a progress dialog with progress bar that goes from 0 to 100. + * + * @param {String} + * title Title of the progress dialog. + * @param {String} + * message Message to display in the dialog. + */ + progressStart : function(title, message) { + exec(null, null, 'Notification', 'progressStart', [ title, message ]); + }, + + /** + * Close the progress dialog. + */ + progressStop : function() { + exec(null, null, 'Notification', 'progressStop', []); + }, + + /** + * Set the progress dialog value. + * + * @param {Number} + * value 0-100 + */ + progressValue : function(value) { + exec(null, null, 'Notification', 'progressValue', [ value ]); + } +}; diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js new file mode 100644 index 00000000..401049e8 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/blackberry10/beep.js @@ -0,0 +1,42 @@ +/* + * + * 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. + * +*/ + +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; + } + }; + 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 differnew file mode 100644 index 00000000..d0ad085f --- /dev/null +++ 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 new file mode 100644 index 00000000..e8753093 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/browser/notification.js @@ -0,0 +1,115 @@ +/* + * + * 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. + * +*/ + +// Platform: browser +window.navigator.notification = window.navigator.notification || {}; + +module.exports.alert = window.navigator.notification.alert = function(message, callback) { + // `notification.alert` executes asynchronously + setTimeout(function() { + window.alert(message); + if (callback) { + callback(); + } + }, 0); +}; + + +module.exports.confirm = window.navigator.notification.confirm = function(message, callback) { + // `notification.confirm` executes asynchronously + setTimeout(function() { + var result = window.confirm(message); + if (callback) { + if (result) { + callback(1); // OK + } + else { + callback(2); // Cancel + } + } + }, 0); +}; + + +module.exports.prompt = window.navigator.notification.prompt = function(message, callback, title, buttonLabels, defaultText) { + // `notification.prompt` executes asynchronously + setTimeout(function() { + var result = window.prompt(message, defaultText || ''); + if (callback) { + if (result === null) { + callback({ buttonIndex: 2, input1: '' }); // Cancel + } + else { + callback({ buttonIndex: 1, input1: result }); // OK + } + } + }, 0); +}; + + +module.exports.beep = window.navigator.notification.beep = function(times) { + if (times > 0) { + var BEEP_DURATION = 700; + var BEEP_INTERVAL = 300; + + if (audioContext) { + // Start a beep, using the Audio API + var osc = audioContext.createOscillator(); + osc.type = 0; // sounds like a "beep" + osc.connect(audioContext.destination); + osc.start(0); + + setTimeout(function() { + // Stop the beep after the BEEP_DURATION + osc.stop(0); + + if (--times > 0) { + // Beep again, after a pause + setTimeout(function() { + navigator.notification.beep(times); + }, BEEP_INTERVAL); + } + + }, BEEP_DURATION); + } + else if (typeof(console) !== 'undefined' && typeof(console.log) === 'function') { + // Audio API isn't supported, so just write `beep` to the console + for (var i = 0; i < times; i++) { + console.log('Beep!'); + } + } + } +}; + +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 differnew file mode 100644 index 00000000..d7529b5b --- /dev/null +++ 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 differnew file mode 100644 index 00000000..400e3ae3 --- /dev/null +++ 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 differnew file mode 100644 index 00000000..2ff298a1 --- /dev/null +++ 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 differnew file mode 100644 index 00000000..b2885450 --- /dev/null +++ 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 new file mode 100644 index 00000000..34d92b88 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/notification.css @@ -0,0 +1,248 @@ +/* + * + * 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. + * +*/ + +/* Main dialog setup */ +form[role="dialog"] { + background: + url(../img/pattern.png) repeat left top, + url(../img/gradient.png) no-repeat left top / 100% 100%; + overflow: hidden; + position: absolute; + z-index: 100; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding: 1.5rem 0 7rem; + font-family: "MozTT", Sans-serif; + font-size: 0; + /* Using font-size: 0; we avoid the unwanted visual space (about 3px) + created by white-spaces and break lines in the code betewen inline-block elements */ + color: #fff; + text-align: left; +} + +form[role="dialog"]:before { + content: ""; + display: inline-block; + vertical-align: middle; + width: 0.1rem; + height: 100%; + margin-left: -0.1rem; +} + +form[role="dialog"] > section { + font-weight: lighter; + font-size: 1.8rem; + color: #FAFAFA; + padding: 0 1.5rem; + -moz-box-sizing: padding-box; + width: 100%; + display: inline-block; + overflow-y: scroll; + max-height: 100%; + vertical-align: middle; + white-space: normal; +} + +form[role="dialog"] h1 { + font-weight: normal; + font-size: 1.6rem; + line-height: 1.5em; + color: #fff; + margin: 0; + padding: 0 1.5rem 1rem; + border-bottom: 0.1rem solid #686868; +} + +/* Menu & buttons setup */ +form[role="dialog"] menu { + margin: 0; + padding: 1.5rem; + padding-bottom: 0.5rem; + border-top: solid 0.1rem rgba(255, 255, 255, 0.1); + background: #2d2d2d url(../img/pattern.png) repeat left top; + display: block; + overflow: hidden; + position: absolute; + left: 0; + right: 0; + bottom: 0; + text-align: center; +} + +form[role="dialog"] menu button::-moz-focus-inner { + border: none; + outline: none; +} +form[role="dialog"] menu button { + width: 100%; + height: 2.4rem; + margin: 0 0 1rem; + padding: 0 1.5rem; + -moz-box-sizing: border-box; + display: inline-block; + vertical-align: middle; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + background: #fafafa url(../img/default.png) repeat-x left bottom/ auto 100%; + border: 0.1rem solid #a6a6a6; + border-radius: 0.3rem; + font: 500 1.2rem/2.4rem 'MozTT', Sans-serif; + color: #333; + text-align: center; + text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,0.3); + text-decoration: none; + outline: none; +} + +/* Press (default & recommend) */ +form[role="dialog"] menu button:active, +form[role="dialog"] menu button.recommend:active, +a.recommend[role="button"]:active { + border-color: #008aaa; + color: #333; +} + +/* Recommend */ +form[role="dialog"] menu button.recommend { + background-image: url(../img/recommend.png); + background-color: #00caf2; + border-color: #008eab; +} + +/* Danger */ +form[role="dialog"] menu button.danger, +a.danger[role="button"] { + background-image: url(../img/danger.png); + background-color: #b70404; + color: #fff; + text-shadow: none; + border-color: #820000; +} + +/* Danger Press */ +form[role="dialog"] menu button.danger:active { + background-image: url(../img/danger-press.png); + background-color: #890707; +} + +/* Disabled */ +form[role="dialog"] > menu > button[disabled] { + background: #5f5f5f; + color: #4d4d4d; + text-shadow: none; + border-color: #4d4d4d; + pointer-events: none; +} + + +form[role="dialog"] menu button:nth-child(even) { + margin-left: 1rem; +} + +form[role="dialog"] menu button, +form[role="dialog"] menu button:nth-child(odd) { + margin: 0 0 1rem 0; +} + +form[role="dialog"] menu button { + width: calc((100% - 1rem) / 2); +} + +form[role="dialog"] menu button.full { + width: 100%; +} + +/* Specific component code */ +form[role="dialog"] p { + word-wrap: break-word; + margin: 1rem 0 0; + padding: 0 1.5rem 1rem; + line-height: 3rem; +} + +form[role="dialog"] p img { + float: left; + margin-right: 2rem; +} + +form[role="dialog"] p strong { + font-weight: lighter; +} + +form[role="dialog"] p small { + font-size: 1.4rem; + font-weight: normal; + color: #cbcbcb; + display: block; +} + +form[role="dialog"] dl { + border-top: 0.1rem solid #686868; + margin: 1rem 0 0; + overflow: hidden; + padding-top: 1rem; + font-size: 1.6rem; + line-height: 2.2rem; +} + +form[role="dialog"] dl > dt { + clear: both; + float: left; + width: 7rem; + padding-left: 1.5rem; + font-weight: 500; + text-align: left; +} + +form[role="dialog"] dl > dd { + padding-right: 1.5rem; + font-weight: 300; + text-overflow: ellipsis; + vertical-align: top; + overflow: hidden; +} + +/* input areas */ +input[type="text"], +input[type="password"], +input[type="email"], +input[type="tel"], +input[type="search"], +input[type="url"], +input[type="number"], +textarea { + -moz-box-sizing: border-box; + display: block; + overflow: hidden; + width: 100%; + height: 3rem; + resize: none; + padding: 0 1rem; + font-size: 1.6rem; + line-height: 3rem; + border: 0.1rem solid #ccc; + border-radius: 0.3rem; + box-shadow: none; /* override the box-shadow from the system (performance issue) */ + background: #fff url(input_areas/images/ui/shadow.png) repeat-x; +} diff --git a/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png b/StoneIsland/plugins/cordova-plugin-dialogs/www/firefoxos/pattern.png Binary files differnew file mode 100644 index 00000000..af03f569 --- /dev/null +++ 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 differnew file mode 100644 index 00000000..42aed390 --- /dev/null +++ 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 new file mode 100644 index 00000000..c3f70d07 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-dialogs/www/notification.js @@ -0,0 +1,112 @@ +/* + * + * 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. + * +*/ + +var exec = require('cordova/exec'); +var platform = require('cordova/platform'); + +/** + * Provides access to notifications on the device. + */ + +module.exports = { + + /** + * Open a native alert dialog, with a customizable title and button text. + * + * @param {String} message Message to print in the body of the alert + * @param {Function} completeCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the alert dialog (default: Alert) + * @param {String} buttonLabel Label of the close button (default: OK) + */ + alert: function(message, completeCallback, title, buttonLabel) { + var _title = (title || "Alert"); + var _buttonLabel = (buttonLabel || "OK"); + exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]); + }, + + /** + * Open a native confirm dialog, with a customizable title and button text. + * The result that the user selects is returned to the result callback. + * + * @param {String} message Message to print in the body of the alert + * @param {Function} resultCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the alert dialog (default: Confirm) + * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel']) + */ + confirm: function(message, resultCallback, title, buttonLabels) { + var _title = (title || "Confirm"); + var _buttonLabels = (buttonLabels || ["OK", "Cancel"]); + + // Strings are deprecated! + if (typeof _buttonLabels === 'string') { + 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") { + + 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]); + }, + + /** + * Open a native prompt dialog, with a customizable title and button text. + * The following results are returned to the result callback: + * buttonIndex Index number of the button selected. + * input1 The text entered in the prompt dialog box. + * + * @param {String} message Dialog message to display (default: "Prompt message") + * @param {Function} resultCallback The callback that is called when user clicks on a button. + * @param {String} title Title of the dialog (default: "Prompt") + * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"]) + * @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 _buttonLabels = (buttonLabels || ["OK","Cancel"]); + var _defaultText = (defaultText || ""); + exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]); + }, + + /** + * Causes the device to beep. + * On Android, the default notification ringtone is played "count" times. + * + * @param {Integer} count The number of beeps. + */ + beep: function(count) { + var defaultedCount = count || 1; + exec(null, null, "Notification", "beep", [ defaultedCount ]); + } +}; |
