Merge branch 'dev'
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index fd813a7..ce0cb0b 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -28,3 +28,16 @@
* Rename CHANGELOG.md -> RELEASENOTES.md
* [CB-4592] [Blackberry10] Added beep support
* [CB-4752] Incremented plugin version on dev branch.
+
+ ### 0.2.3 (Oct 28, 2013)
+* CB-5128: added repo + issue tag to plugin.xml for dialogs plugin
+* new plugin execute arguments supported
+* new plugin style
+* smaller fonts styling input
+* img files copied inside plugin
+* style added
+* prompt added
+* styling from James
+* fixed "exec" calls addedd css, but not working yet
+* first (blind) try
+* [CB-4915] Incremented plugin version on dev branch.
diff --git a/plugin.xml b/plugin.xml
index 2bdbb3f..d554456 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,17 +2,39 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="org.apache.cordova.dialogs"
- version="0.2.2">
+ version="0.2.3">
<name>Notification</name>
<description>Cordova Notification Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,notification</keywords>
+ <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git</repo>
+ <issue>https://issues.apache.org/jira/browse/CB/component/12320642</issue>
<js-module src="www/notification.js" name="notification">
<merges target="navigator.notification" />
</js-module>
+ <!-- firefoxos -->
+ <platform name="firefoxos">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Notification">
+ <param name="firefoxos-package" value="Notification" />
+ </feature>
+ </config-file>
+
+ <asset src="www/firefoxos/notification.css" target="css/notification.css" />
+ <asset src="www/firefoxos/danger-press.png" target="css/danger-press.png" />
+ <asset src="www/firefoxos/danger.png" target="css/danger.png" />
+ <asset src="www/firefoxos/default.png" target="css/default.png" />
+ <asset src="www/firefoxos/gradient.png" target="css/gradient.png" />
+ <asset src="www/firefoxos/pattern.png" target="css/pattern.png" />
+ <asset src="www/firefoxos/recommend.png" target="css/recommend.png" />
+ <js-module src="src/firefoxos/notification.js" name="dialogs-impl">
+ <runs />
+ </js-module>
+ </platform>
+
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
diff --git a/src/firefoxos/notification.js b/src/firefoxos/notification.js
new file mode 100644
index 0000000..7362934
--- /dev/null
+++ b/src/firefoxos/notification.js
@@ -0,0 +1,107 @@
+function _empty() {}
+
+function modal(message, callback, title, buttonLabels, domObjects) {
+ /*
+ <form role="dialog">
+ <section>
+ <h1>Some Title</h1>
+ <p>Can't find a proper question for that ...</p>
+ </section>
+ <menu>
+ <button>Cancel</button>
+ <button class="danger">Delete</button>
+ <button class="recommend">Recommend</button>
+ <button>Standard</button>
+ </menu>
+ </form>
+ */
+ // create a modal window
+ var box = document.createElement('form');
+ box.setAttribute('role', 'dialog');
+ // prepare and append empty section
+ var section = document.createElement('section');
+ box.appendChild(section);
+ // add title
+ var boxtitle = document.createElement('h1');
+ boxtitle.appendChild(document.createTextNode(title));
+ section.appendChild(boxtitle);
+ // add message
+ var boxMessage = document.createElement('p');
+ boxMessage.appendChild(document.createTextNode(message));
+ section.appendChild(boxMessage);
+ // inject what's needed
+ if (domObjects) {
+ section.appendChild(domObjects);
+ }
+ // add buttons and assign callbackButton on click
+ var menu = document.createElement('menu');
+ box.appendChild(menu);
+ for (var index = 0; index < buttonLabels.length; index++) {
+ // TODO: last button listens to the cancel key
+ addButton(buttonLabels[index], index, (index === 0));
+ }
+ document.body.appendChild(box);
+
+ function addButton(label, index, recommended) {
+ var button = document.createElement('button');
+ button.appendChild(document.createTextNode(label));
+ button.labelIndex = index;
+ button.addEventListener('click', callbackButton, false);
+ if (recommended) {
+ // TODO: default one listens to Enter key
+ button.classList.add('recommend');
+ }
+ menu.appendChild(button);
+ }
+
+ // call callback and destroy modal
+ function callbackButton() {
+ callback(this.labelIndex);
+ box.parentNode.removeChild(box);
+ }
+}
+
+var Notification = {
+ vibrate: function(milliseconds) {
+ navigator.vibrate(milliseconds);
+ },
+ alert: function(successCallback, errorCallback, args) {
+ var message = args[0];
+ var title = args[1];
+ var _buttonLabels = [args[2]];
+ var _callback = (successCallback || _empty);
+ modal(message, _callback, title, _buttonLabels);
+ },
+ confirm: function(successCallback, errorCallback, args) {
+ var message = args[0];
+ var title = args[1];
+ var buttonLabels = args[2];
+ var _callback = (successCallback || _empty);
+ modal(message, _callback, title, buttonLabels);
+ },
+ prompt: function(successCallback, errorCallback, args) {
+ console.log(args);
+ var message = args[0];
+ var title = args[1];
+ var buttonLabels = args[2];
+ var defaultText = args[3];
+ var _tempcallback = (successCallback || _empty);
+ function _callback(labelIndex) {
+ var content = document.getElementById('prompt-input').value;
+ successCallback(labelIndex, content);
+ }
+ var inputParagraph = document.createElement('p');
+ inputParagraph.classList.add('input');
+ var inputElement = document.createElement('input');
+ inputElement.setAttribute('type', 'text');
+ inputElement.id = 'prompt-input';
+ if (defaultText) {
+ inputElement.setAttribute('placeholder', defaultText);
+ }
+ inputParagraph.appendChild(inputElement);
+ modal(message, _callback, title, buttonLabels, inputParagraph);
+ }
+};
+
+module.exports = Notification;
+require('cordova/firefoxos/commandProxy').add('Notification', Notification);
diff --git a/www/firefoxos/danger-press.png b/www/firefoxos/danger-press.png
new file mode 100644
index 0000000..d7529b5
--- /dev/null
+++ b/www/firefoxos/danger-press.png
Binary files differ
diff --git a/www/firefoxos/danger.png b/www/firefoxos/danger.png
new file mode 100644
index 0000000..400e3ae
--- /dev/null
+++ b/www/firefoxos/danger.png
Binary files differ
diff --git a/www/firefoxos/default.png b/www/firefoxos/default.png
new file mode 100644
index 0000000..2ff298a
--- /dev/null
+++ b/www/firefoxos/default.png
Binary files differ
diff --git a/www/firefoxos/gradient.png b/www/firefoxos/gradient.png
new file mode 100644
index 0000000..b288545
--- /dev/null
+++ b/www/firefoxos/gradient.png
Binary files differ
diff --git a/www/firefoxos/notification.css b/www/firefoxos/notification.css
new file mode 100644
index 0000000..af940de
--- /dev/null
+++ b/www/firefoxos/notification.css
@@ -0,0 +1,227 @@
+/* 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/www/firefoxos/pattern.png b/www/firefoxos/pattern.png
new file mode 100644
index 0000000..af03f56
--- /dev/null
+++ b/www/firefoxos/pattern.png
Binary files differ
diff --git a/www/firefoxos/recommend.png b/www/firefoxos/recommend.png
new file mode 100644
index 0000000..42aed39
--- /dev/null
+++ b/www/firefoxos/recommend.png
Binary files differ
diff --git a/www/notification.js b/www/notification.js
index c16c367..ae4e77d 100644
--- a/www/notification.js
+++ b/www/notification.js
@@ -63,7 +63,7 @@
// 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 == "android" || platform.id == "ios" || platform.id == "windowsphone") {
+ if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "firefoxos") {
if (typeof _buttonLabels === 'string') {
var buttonLabelString = _buttonLabels;
_buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here