Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added 3.3 dir

  • Loading branch information...
commit fe08348d9610d3bf8535986f229d67656242b0b5 1 parent 31738ac
authored September 05, 2012

Showing 70 changed files with 2,435 additions and 0 deletions. Show diff stats Hide diff stats

  1. 0  titanium/{ → 3.1}/desktop/app.js
  2. 0  titanium/{ → 3.1}/desktop/index.html
  3. 0  titanium/{ → 3.1}/desktop/pubnub.js
  4. 0  titanium/{ → 3.1}/mobile/README
  5. 0  titanium/{ → 3.1}/mobile/app.js
  6. 0  titanium/{ → 3.1}/mobile/chat-example-app/.project
  7. 0  titanium/{ → 3.1}/mobile/chat-example-app/CHANGELOG.txt
  8. 0  titanium/{ → 3.1}/mobile/chat-example-app/LICENSE
  9. 0  titanium/{ → 3.1}/mobile/chat-example-app/LICENSE.txt
  10. 0  titanium/{ → 3.1}/mobile/chat-example-app/README
  11. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/KS_nav_ui.png
  12. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/KS_nav_views.png
  13. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/appicon.png
  14. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/default.png
  15. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-long-land-hdpi/default.png
  16. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-long-land-ldpi/default.png
  17. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-long-port-hdpi/default.png
  18. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-long-port-ldpi/default.png
  19. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-land-hdpi/default.png
  20. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-land-ldpi/default.png
  21. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-land-mdpi/default.png
  22. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-port-hdpi/default.png
  23. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-port-ldpi/default.png
  24. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/android/images/res-notlong-port-mdpi/default.png
  25. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/app.js
  26. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/iphone/Default-Landscape.png
  27. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/iphone/Default-Portrait.png
  28. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/iphone/Default.png
  29. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/iphone/Default@2x.png
  30. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/iphone/appicon.png
  31. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/pubnub-chat.js
  32. 0  titanium/{ → 3.1}/mobile/chat-example-app/Resources/pubnub.js
  33. 0  titanium/{ → 3.1}/mobile/chat-example-app/manifest
  34. 0  titanium/{ → 3.1}/mobile/chat-example-app/tiapp.xml
  35. 0  titanium/{ → 3.1}/mobile/pubnub.js
  36. 84  titanium/3.3/desktop/app.js
  37. 75  titanium/3.3/desktop/index.html
  38. 496  titanium/3.3/desktop/pubnub.js
  39. 119  titanium/3.3/mobile/README
  40. 48  titanium/3.3/mobile/app.js
  41. 23  titanium/3.3/mobile/chat-example-app/.project
  42. 1  titanium/3.3/mobile/chat-example-app/CHANGELOG.txt
  43. 219  titanium/3.3/mobile/chat-example-app/LICENSE
  44. 1  titanium/3.3/mobile/chat-example-app/LICENSE.txt
  45. 18  titanium/3.3/mobile/chat-example-app/README
  46. BIN  titanium/3.3/mobile/chat-example-app/Resources/KS_nav_ui.png
  47. BIN  titanium/3.3/mobile/chat-example-app/Resources/KS_nav_views.png
  48. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/appicon.png
  49. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/default.png
  50. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-long-land-hdpi/default.png
  51. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-long-land-ldpi/default.png
  52. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-long-port-hdpi/default.png
  53. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-long-port-ldpi/default.png
  54. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-land-hdpi/default.png
  55. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-land-ldpi/default.png
  56. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-land-mdpi/default.png
  57. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-port-hdpi/default.png
  58. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-port-ldpi/default.png
  59. BIN  titanium/3.3/mobile/chat-example-app/Resources/android/images/res-notlong-port-mdpi/default.png
  60. 26  titanium/3.3/mobile/chat-example-app/Resources/app.js
  61. BIN  titanium/3.3/mobile/chat-example-app/Resources/iphone/Default-Landscape.png
  62. BIN  titanium/3.3/mobile/chat-example-app/Resources/iphone/Default-Portrait.png
  63. BIN  titanium/3.3/mobile/chat-example-app/Resources/iphone/Default.png
  64. BIN  titanium/3.3/mobile/chat-example-app/Resources/iphone/Default@2x.png
  65. BIN  titanium/3.3/mobile/chat-example-app/Resources/iphone/appicon.png
  66. 180  titanium/3.3/mobile/chat-example-app/Resources/pubnub-chat.js
  67. 548  titanium/3.3/mobile/chat-example-app/Resources/pubnub.js
  68. 8  titanium/3.3/mobile/chat-example-app/manifest
  69. 41  titanium/3.3/mobile/chat-example-app/tiapp.xml
  70. 548  titanium/3.3/mobile/pubnub.js
0  titanium/desktop/app.js → titanium/3.1/desktop/app.js
File renamed without changes
0  titanium/desktop/index.html → titanium/3.1/desktop/index.html
File renamed without changes
0  titanium/desktop/pubnub.js → titanium/3.1/desktop/pubnub.js
File renamed without changes
0  titanium/mobile/README → titanium/3.1/mobile/README
File renamed without changes
0  titanium/mobile/app.js → titanium/3.1/mobile/app.js
File renamed without changes
0  titanium/mobile/chat-example-app/.project → titanium/3.1/mobile/chat-example-app/.project
File renamed without changes
0  titanium/mobile/chat-example-app/CHANGELOG.txt → titanium/3.1/mobile/chat-example-app/CHANGELOG.txt
File renamed without changes
0  titanium/mobile/chat-example-app/LICENSE → titanium/3.1/mobile/chat-example-app/LICENSE
File renamed without changes
0  titanium/mobile/chat-example-app/LICENSE.txt → titanium/3.1/mobile/chat-example-app/LICENSE.txt
File renamed without changes
0  titanium/mobile/chat-example-app/README → titanium/3.1/mobile/chat-example-app/README
File renamed without changes
0  ...m/mobile/chat-example-app/Resources/KS_nav_ui.png → ...1/mobile/chat-example-app/Resources/KS_nav_ui.png
File renamed without changes
0  ...obile/chat-example-app/Resources/KS_nav_views.png → ...obile/chat-example-app/Resources/KS_nav_views.png
File renamed without changes
0  ...le/chat-example-app/Resources/android/appicon.png → ...le/chat-example-app/Resources/android/appicon.png
File renamed without changes
0  ...le/chat-example-app/Resources/android/default.png → ...le/chat-example-app/Resources/android/default.png
File renamed without changes
0  ...ces/android/images/res-long-land-hdpi/default.png → ...ces/android/images/res-long-land-hdpi/default.png
File renamed without changes
0  ...ces/android/images/res-long-land-ldpi/default.png → ...ces/android/images/res-long-land-ldpi/default.png
File renamed without changes
0  ...ces/android/images/res-long-port-hdpi/default.png → ...ces/android/images/res-long-port-hdpi/default.png
File renamed without changes
0  ...ces/android/images/res-long-port-ldpi/default.png → ...ces/android/images/res-long-port-ldpi/default.png
File renamed without changes
0  .../android/images/res-notlong-land-hdpi/default.png → .../android/images/res-notlong-land-hdpi/default.png
File renamed without changes
0  .../android/images/res-notlong-land-ldpi/default.png → .../android/images/res-notlong-land-ldpi/default.png
File renamed without changes
0  .../android/images/res-notlong-land-mdpi/default.png → .../android/images/res-notlong-land-mdpi/default.png
File renamed without changes
0  .../android/images/res-notlong-port-hdpi/default.png → .../android/images/res-notlong-port-hdpi/default.png
File renamed without changes
0  .../android/images/res-notlong-port-ldpi/default.png → .../android/images/res-notlong-port-ldpi/default.png
File renamed without changes
0  .../android/images/res-notlong-port-mdpi/default.png → .../android/images/res-notlong-port-mdpi/default.png
File renamed without changes
0  titanium/mobile/chat-example-app/Resources/app.js → ...nium/3.1/mobile/chat-example-app/Resources/app.js
File renamed without changes
0  ...xample-app/Resources/iphone/Default-Landscape.png → ...xample-app/Resources/iphone/Default-Landscape.png
File renamed without changes
0  ...example-app/Resources/iphone/Default-Portrait.png → ...example-app/Resources/iphone/Default-Portrait.png
File renamed without changes
0  ...ile/chat-example-app/Resources/iphone/Default.png → ...ile/chat-example-app/Resources/iphone/Default.png
File renamed without changes
0  .../chat-example-app/Resources/iphone/Default@2x.png → .../chat-example-app/Resources/iphone/Default@2x.png
File renamed without changes
0  ...ile/chat-example-app/Resources/iphone/appicon.png → ...ile/chat-example-app/Resources/iphone/appicon.png
File renamed without changes
0  .../mobile/chat-example-app/Resources/pubnub-chat.js → .../mobile/chat-example-app/Resources/pubnub-chat.js
File renamed without changes
0  titanium/mobile/chat-example-app/Resources/pubnub.js → ...m/3.1/mobile/chat-example-app/Resources/pubnub.js
File renamed without changes
0  titanium/mobile/chat-example-app/manifest → titanium/3.1/mobile/chat-example-app/manifest
File renamed without changes
0  titanium/mobile/chat-example-app/tiapp.xml → titanium/3.1/mobile/chat-example-app/tiapp.xml
File renamed without changes
0  titanium/mobile/pubnub.js → titanium/3.1/mobile/pubnub.js
File renamed without changes
84  titanium/3.3/desktop/app.js
... ...
@@ -0,0 +1,84 @@
  1
+(function(){
  2
+
  3
+// -- 
  4
+// -- DOM ELEMENT POINTERS
  5
+// -- 
  6
+var logger            = PUBNUB.$('pubnub-logger')
  7
+,   publish_button    = PUBNUB.$('publish-button')
  8
+,   subscribe_button  = PUBNUB.$('subscribe-button')
  9
+,   subscribe_channel = PUBNUB.$('subscribe-channel')
  10
+,   publish_text      = PUBNUB.$('publish-text')
  11
+,   connected         = PUBNUB.$('pubnub-connected')
  12
+,   channel_name      = '';
  13
+
  14
+
  15
+// -- 
  16
+// -- BASIC LOG OUTPUT FUNCTION
  17
+// -- 
  18
+function log(data) {
  19
+    logger.innerHTML = 
  20
+        '\n' + log.line++ + ': ' +
  21
+        JSON.stringify(data) + (
  22
+        channel_name ?
  23
+        ' - from "' + channel_name + '" Channel.' :
  24
+        '' ) + logger.innerHTML;
  25
+}
  26
+log.line = 1;
  27
+
  28
+
  29
+// -- 
  30
+// -- SEND A MESSAGE FUNCTION
  31
+// -- 
  32
+function send_message(message) {
  33
+    PUBNUB.publish({
  34
+        channel : channel_name,
  35
+        message : message
  36
+    });
  37
+}
  38
+
  39
+
  40
+// -- 
  41
+// -- LISTING FOR MESSAGES
  42
+// -- 
  43
+function listen(channel) {
  44
+    // -- UNSUBSCRIBE FROM PREVIOUS CHANNEL
  45
+    PUBNUB.unsubscribe({ channel : channel_name});
  46
+
  47
+    // -- SAVE NEW CHANNEL NAME
  48
+    channel_name = channel || 'titanium-demo';
  49
+
  50
+    // -- SUBSCRIBE TO NEW CHANNEL
  51
+    PUBNUB.subscribe({
  52
+        channel  : channel_name,
  53
+        callback : log
  54
+    });
  55
+
  56
+    // -- UPDATE CONNECTED STATUS
  57
+    connected.innerHTML = 'CONNECTED to "' + channel_name + '"';
  58
+    PUBNUB.css( connected, { color : "green" } );
  59
+}
  60
+
  61
+
  62
+// -- 
  63
+// -- BIND SUBSCRIBE BUTTON
  64
+// -- 
  65
+PUBNUB.bind( 'mousedown,touchstart', subscribe_button, function() {
  66
+    listen(subscribe_channel.value);
  67
+} );
  68
+
  69
+
  70
+// -- 
  71
+// -- BIND PUBLISH BUTTON
  72
+// -- 
  73
+PUBNUB.bind( 'mousedown,touchstart', publish_button, function() {
  74
+    // -- PUBLISH THE VALUE OF THE TEXTBOX INPUT
  75
+    send_message( publish_text.value || 'EMPTY MESSAGE' );
  76
+} );
  77
+
  78
+
  79
+// -- 
  80
+// -- GENERAL STARTUP COMPLETE MESSAGE
  81
+// -- 
  82
+log("Startup Complete");
  83
+
  84
+})();
75  titanium/3.3/desktop/index.html
... ...
@@ -0,0 +1,75 @@
  1
+<html>
  2
+<body>
  3
+    <!-- GENERIC VANILLA STYLES -->
  4
+    <style>
  5
+        body, button, input, div {
  6
+            color: #444;
  7
+            font-family: Arial;
  8
+            font-size: 12px;
  9
+            line-height: 14px;
  10
+            margin: 5px;
  11
+            padding: 10px;
  12
+        }
  13
+
  14
+        #pubnub-logger {
  15
+            border: 2px solid #eee;
  16
+            -webkit-box-shadow: 0 0 30px #ff0;
  17
+            -webkit-border-radius: 10px;
  18
+            margin: 20px;
  19
+            padding: 10px;
  20
+        }
  21
+
  22
+        #pubnub-connected {
  23
+            color: red;
  24
+            font-weight: bold;
  25
+        }
  26
+
  27
+        button {
  28
+            width: 150px;
  29
+        }
  30
+
  31
+        input {
  32
+            width: 200px;
  33
+        }
  34
+    </style>
  35
+
  36
+
  37
+    <!-- SUBSCRIBE CHANNEL -->
  38
+    <div>
  39
+        <!-- SUBSCRIBE BUTTON -->
  40
+        <button id=subscribe-button>SUBSCRIBE TO: </button>
  41
+
  42
+        <!-- CHANNEL NAME -->
  43
+        <input id=subscribe-channel value=my-titanium-channel />
  44
+
  45
+        <!-- CONNECTION STATUS -->
  46
+        <span id=pubnub-connected>NOT CONNECTED</span>
  47
+    </div>
  48
+
  49
+
  50
+    <!-- PUBLISH MESSAGE -->
  51
+    <div>
  52
+        <!-- PUBLISH BUTTON -->
  53
+        <button id=publish-button>PUBLISH</button>
  54
+
  55
+        <!-- MESSAGE TEXT TO SEND -->
  56
+        <input id=publish-text value=text-to-send />
  57
+    </div>
  58
+
  59
+
  60
+    <!-- LOG OUTPUT AREA -->
  61
+    <pre id=pubnub-logger>...</pre>
  62
+
  63
+
  64
+    <!-- PUBNUB SETUP -->
  65
+    <div
  66
+        id=pubnub
  67
+        pub-key="demo"
  68
+        sub-key="demo"
  69
+        ssl="off"
  70
+        origin="pubsub.pubnub.com"
  71
+    ></div>
  72
+    <script src="pubnub.js"></script>
  73
+    <script src="app.js"></script>
  74
+</body>
  75
+</html>
496  titanium/3.3/desktop/pubnub.js
... ...
@@ -0,0 +1,496 @@
  1
+/*
  2
+    WAIT! - This file depends on instructions from the PUBNUB Cloud.
  3
+
  4
+    http://www.pubnub.com/account
  5
+*/
  6
+
  7
+/*
  8
+    PubNub Real Time Push APIs and Notifications Framework
  9
+    Copyright (c) 2010 Stephen Blum
  10
+    http://www.google.com/profiles/blum.stephen
  11
+
  12
+    This program is free software: you can redistribute it and/or modify
  13
+    it under the terms of the GNU General Public License as published by
  14
+    the Free Software Foundation, either version 3 of the License, or
  15
+    (at your option) any later version.
  16
+
  17
+    This program is distributed in the hope that it will be useful,
  18
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
  19
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20
+    GNU General Public License for more details.
  21
+
  22
+    You should have received a copy of the GNU General Public License
  23
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  24
+*/
  25
+
  26
+/* =-=====================================================================-= */
  27
+/* =-=====================================================================-= */
  28
+/* =-========================     DOM UTIL     ===========================-= */
  29
+/* =-=====================================================================-= */
  30
+/* =-=====================================================================-= */
  31
+
  32
+window['PUBNUB'] || (function() {
  33
+
  34
+/**
  35
+ * CONSOLE COMPATIBILITY
  36
+ */
  37
+window.console||(window.console=window.console||{});
  38
+console.log||(console.log=((window.opera||{}).postError||function(){}));
  39
+
  40
+/**
  41
+ * UTIL LOCALS
  42
+ */
  43
+var NOW    = 1
  44
+,   MAGIC  = /\$?{([\w\-]+)}/g
  45
+,   ASYNC  = 'async'
  46
+,   URLBIT = '/'
  47
+,   XHRTME = 140000
  48
+,   XORIGN = 1;
  49
+
  50
+/**
  51
+ * UNIQUE
  52
+ * ======
  53
+ * var timestamp = unique();
  54
+ */
  55
+function unique() { return'x'+ ++NOW+''+(+new Date) }
  56
+
  57
+/**
  58
+ * $
  59
+ * =
  60
+ * var div = $('divid');
  61
+ */
  62
+function $(id) { return document.getElementById(id) }
  63
+
  64
+/**
  65
+ * LOG
  66
+ * ===
  67
+ * log('message');
  68
+ */
  69
+function log(message) { console['log'](message) }
  70
+
  71
+/**
  72
+ * SEARCH
  73
+ * ======
  74
+ * var elements = search('a div span');
  75
+ */
  76
+function search(elements) {
  77
+    var list = [];
  78
+    each( elements.split(/\s+/), function(el) {
  79
+        each( document.getElementsByTagName(el), function(node) {
  80
+            list.push(node);
  81
+        } );
  82
+    } );
  83
+    return list;
  84
+}
  85
+
  86
+/**
  87
+ * EACH
  88
+ * ====
  89
+ * each( [1,2,3], function(item) { console.log(item) } )
  90
+ */
  91
+function each( o, f ) {
  92
+    if ( !o || !f ) return;
  93
+
  94
+    if ( typeof o[0] != 'undefined' ) for ( var i = 0, l = o.length; i < l; )
  95
+        f.call( o[i], o[i], i++ );
  96
+    else for ( var i in o )
  97
+        o.hasOwnProperty    &&
  98
+        o.hasOwnProperty(i) &&
  99
+        f.call( o[i], i, o[i] );
  100
+}
  101
+
  102
+/**
  103
+ * MAP
  104
+ * ===
  105
+ * var list = map( [1,2,3], function(item) { return item + 1 } )
  106
+ */
  107
+function map( list, fun ) {
  108
+    var fin = [];
  109
+    each( list || [], function( k, v ) { fin.push(fun( k, v )) } );
  110
+    return fin;
  111
+}
  112
+
  113
+/**
  114
+ * GREP
  115
+ * ====
  116
+ * var list = grep( [1,2,3], function(item) { return item % 2 } )
  117
+ */
  118
+function grep( list, fun ) {
  119
+    var fin = [];
  120
+    each( list || [], function(l) { fun(l) && fin.push(l) } );
  121
+    return fin
  122
+}
  123
+
  124
+/**
  125
+ * SUPPLANT
  126
+ * ========
  127
+ * var text = supplant( 'Hello {name}!', { name : 'John' } )
  128
+ */
  129
+function supplant( str, values ) {
  130
+    return str.replace( MAGIC, function( _, match ) {
  131
+        return ''+values[match] || ''
  132
+    } );
  133
+}
  134
+
  135
+/**
  136
+ * BIND
  137
+ * ====
  138
+ * bind( 'keydown', search('a')[0], function(element) {
  139
+ *     console.log( element, '1st anchor' )
  140
+ * } );
  141
+ */
  142
+function bind( type, el, fun ) {
  143
+    each( type.split(','), function(etype) {
  144
+        var rapfun = function(e) {
  145
+            if (!e) var e = window.event;
  146
+            if (!fun(e)) {
  147
+                e.cancelBubble = true;
  148
+                e.returnValue  = false;
  149
+                e.preventDefault && e.preventDefault();
  150
+                e.stopPropagation && e.stopPropagation();
  151
+            }
  152
+        };
  153
+
  154
+        if ( el.addEventListener ) el.addEventListener( etype, rapfun, false );
  155
+        else if ( el.attachEvent ) el.attachEvent( 'on' + etype, rapfun );
  156
+        else  el[ 'on' + etype ] = rapfun;
  157
+    } );
  158
+}
  159
+
  160
+/**
  161
+ * UNBIND
  162
+ * ======
  163
+ * unbind( 'keydown', search('a')[0] );
  164
+ */
  165
+function unbind( type, el, fun ) {
  166
+    if ( el.removeEventListener ) el.removeEventListener( type, false );
  167
+    else if ( el.detachEvent ) el.detachEvent( 'on' + type, false );
  168
+    else  el[ 'on' + type ] = null;
  169
+}
  170
+
  171
+/**
  172
+ * HEAD
  173
+ * ====
  174
+ * head().appendChild(elm);
  175
+ */
  176
+function head() { return search('head')[0] }
  177
+
  178
+/**
  179
+ * ATTR
  180
+ * ====
  181
+ * var attribute = attr( node, 'attribute' );
  182
+ */
  183
+function attr( node, attribute, value ) {
  184
+    if (value) node.setAttribute( attribute, value );
  185
+    else return node && node.getAttribute && node.getAttribute(attribute);
  186
+}
  187
+
  188
+/**
  189
+ * CSS
  190
+ * ===
  191
+ * var obj = create('div');
  192
+ */
  193
+function css( element, styles ) {
  194
+    for (var style in styles) if (styles.hasOwnProperty(style))
  195
+        try {element.style[style] = styles[style] + (
  196
+            '|width|height|top|left|'.indexOf(style) > 0 &&
  197
+            typeof styles[style] == 'number'
  198
+            ? 'px' : ''
  199
+        )}catch(e){}
  200
+}
  201
+
  202
+/**
  203
+ * CREATE
  204
+ * ======
  205
+ * var obj = create('div');
  206
+ */
  207
+function create(element) { return document.createElement(element) }
  208
+
  209
+/**
  210
+ * timeout
  211
+ * =======
  212
+ * timeout( function(){}, 100 );
  213
+ */
  214
+function timeout( fun, wait ) { return setTimeout( fun, wait ) }
  215
+
  216
+/**
  217
+ * jsonp_cb
  218
+ * ========
  219
+ * var callback = jsonp_cb();
  220
+ */
  221
+function jsonp_cb() { return XORIGN ? 0 : unique() }
  222
+
  223
+/**
  224
+ * ENCODE
  225
+ * ======
  226
+ * var encoded_path = encode('path');
  227
+ */
  228
+function encode(path) {
  229
+    return map( (''+path).split(''), function(chr) {
  230
+        return " ~`!@#$%^&*()+=[]\\{}|;':\",./<>?".indexOf(chr) > -1 ?
  231
+               "%"+chr.charCodeAt(0).toString(16).toUpperCase()      : chr
  232
+    } ).join('');
  233
+}
  234
+
  235
+/**
  236
+ * Titanium XHR Request
  237
+ * ====================
  238
+ *  xdr({
  239
+ *     url     : ['http://www.blah.com/url'],
  240
+ *     success : function(response) {},
  241
+ *     fail    : function() {}
  242
+ *  });
  243
+ */
  244
+function xdr( setup ) {
  245
+    var xhr
  246
+    ,   finished = function() {
  247
+            if (loaded) return;
  248
+                loaded = 1;
  249
+
  250
+            clearTimeout(timer);
  251
+
  252
+            try       { response = JSON['parse'](xhr.responseText); }
  253
+            catch (r) { return done(1); }
  254
+
  255
+            success(response);
  256
+        }
  257
+    ,   complete = 0
  258
+    ,   loaded   = 0
  259
+    ,   timer    = timeout( function(){done(1)}, XHRTME )
  260
+    ,   fail     = setup.fail    || function(){}
  261
+    ,   success  = setup.success || function(){}
  262
+    ,   done     = function(failed) {
  263
+            if (complete) return;
  264
+                complete = 1;
  265
+
  266
+            clearTimeout(timer);
  267
+
  268
+            if (xhr) {
  269
+                xhr.onerror = xhr.onload = null;
  270
+                xhr.abort && xhr.abort();
  271
+                xhr = null;
  272
+            }
  273
+
  274
+            failed && fail();
  275
+        };
  276
+
  277
+    // Send
  278
+    try {
  279
+        xhr         = Titanium.Network.createHTTPClient();
  280
+        xhr.onerror = function(){ done(1) };
  281
+        xhr.onload  = finished;
  282
+        xhr.timeout = XHRTME;
  283
+
  284
+        xhr.open( 'GET', setup.url.join(URLBIT), true );
  285
+        xhr.send();
  286
+    }
  287
+    catch(eee) {
  288
+        done(0);
  289
+        return xdr(setup);
  290
+    }
  291
+
  292
+    // Return 'done'
  293
+    return done;
  294
+}
  295
+
  296
+
  297
+/* =-=====================================================================-= */
  298
+/* =-=====================================================================-= */
  299
+/* =-=========================     PUBNUB     ============================-= */
  300
+/* =-=====================================================================-= */
  301
+/* =-=====================================================================-= */
  302
+
  303
+var PN            = $('pubnub')
  304
+,   DEMO          = 'demo'
  305
+,   PUBLISH_KEY   = attr( PN, 'pub-key' ) || DEMO
  306
+,   SUBSCRIBE_KEY = attr( PN, 'sub-key' ) || DEMO
  307
+,   SSL           = attr( PN, 'ssl' ) == 'on' ? 's' : ''
  308
+,   ORIGIN        = 'http'+SSL+'://'+(attr(PN,'origin')||'pubsub.pubnub.com')
  309
+,   LIMIT         = 1800
  310
+,   READY_BUFFER  = []
  311
+,   CHANNELS      = {}
  312
+,   PUBNUB        = {
  313
+    /*
  314
+        PUBNUB.history({
  315
+            channel  : 'my_chat_channel',
  316
+            limit    : 100,
  317
+            callback : function(messages) { console.log(messages) }
  318
+        });
  319
+    */
  320
+    'history' : function( args, callback ) {
  321
+        var callback = args['callback'] || callback 
  322
+        ,   limit    = args['limit'] || 100
  323
+        ,   channel  = args['channel']
  324
+        ,   jsonp    = jsonp_cb();
  325
+
  326
+        // Make sure we have a Channel
  327
+        if (!channel)  return log('Missing Channel');
  328
+        if (!callback) return log('Missing Callback');
  329
+
  330
+        // Send Message
  331
+        xdr({
  332
+            callback : jsonp,
  333
+            url      : [
  334
+                ORIGIN, 'history',
  335
+                SUBSCRIBE_KEY, encode(channel),
  336
+                jsonp, limit
  337
+            ],
  338
+            success  : function(response) { callback(response) },
  339
+            fail     : function(response) { log(response) }
  340
+        });
  341
+    },
  342
+
  343
+    /*
  344
+        PUBNUB.time(function(time){ console.log(time) });
  345
+    */
  346
+    'time' : function(callback) {
  347
+        var jsonp = jsonp_cb();
  348
+        xdr({
  349
+            callback : jsonp,
  350
+            url      : [ORIGIN, 'time', jsonp],
  351
+            success  : function(response) { callback(response[0]) },
  352
+            fail     : function() { callback(0) }
  353
+        });
  354
+    },
  355
+
  356
+    /*
  357
+        PUBNUB.uuid(function(uuid) { console.log(uuid) });
  358
+    */
  359
+    'uuid' : function(callback) {
  360
+        var jsonp = jsonp_cb();
  361
+        xdr({
  362
+            callback : jsonp,
  363
+            url      : [
  364
+                'http' + SSL +
  365
+                '://pubnub-prod.appspot.com/uuid?callback=' + jsonp
  366
+            ],
  367
+            success  : function(response) { callback(response[0]) },
  368
+            fail     : function() { callback(0) }
  369
+        });
  370
+    },
  371
+
  372
+    /*
  373
+        PUBNUB.publish({
  374
+            channel : 'my_chat_channel',
  375
+            message : 'hello!'
  376
+        });
  377
+    */
  378
+    'publish' : function( args, callback ) {
  379
+        var callback = callback || args['callback'] || function(){}
  380
+        ,   message  = args['message']
  381
+        ,   channel  = args['channel']
  382
+        ,   jsonp    = jsonp_cb();
  383
+
  384
+        if (!message)     return log('Missing Message');
  385
+        if (!channel)     return log('Missing Channel');
  386
+        if (!PUBLISH_KEY) return log('Missing Publish Key');
  387
+
  388
+        // If trying to send Object
  389
+        message = JSON['stringify'](message);
  390
+
  391
+        // Make sure message is small enough.
  392
+        if (message.length > LIMIT) return log('Message Too Big');
  393
+
  394
+        // Send Message
  395
+        xdr({
  396
+            callback : jsonp,
  397
+            success  : function(response) { callback(response) },
  398
+            fail     : function() { callback([ 0, 'Disconnected' ]) },
  399
+            url      : [
  400
+                ORIGIN, 'publish',
  401
+                PUBLISH_KEY, SUBSCRIBE_KEY,
  402
+                0, encode(channel),
  403
+                jsonp, encode(message)
  404
+            ]
  405
+        });
  406
+    },
  407
+
  408
+    /*
  409
+        PUBNUB.unsubscribe({ channel : 'my_chat' });
  410
+    */
  411
+    'unsubscribe' : function(args) {
  412
+        var channel = args['channel'];
  413
+
  414
+        // Leave if there never was a channel.
  415
+        if (!(channel in CHANNELS)) return;
  416
+
  417
+        // Disable Channel
  418
+        CHANNELS[channel].connected = 0;
  419
+
  420
+        // Abort and Remove Script
  421
+        CHANNELS[channel].done && 
  422
+        CHANNELS[channel].done(0);
  423
+    },
  424
+
  425
+    /*
  426
+        PUBNUB.subscribe({
  427
+            channel  : 'my_chat'
  428
+            callback : function(message) { console.log(message) }
  429
+        });
  430
+    */
  431
+    'subscribe' : function( args, callback ) {
  432
+        var channel   = args['channel']
  433
+        ,   callback  = callback || args['callback']
  434
+        ,   timetoken = 0
  435
+        ,   error     = args['error'] || function(){};
  436
+
  437
+        // Make sure we have a Channel
  438
+        if (!channel)       return log('Missing Channel');
  439
+        if (!callback)      return log('Missing Callback');
  440
+        if (!SUBSCRIBE_KEY) return log('Missing Subscribe Key');
  441
+
  442
+        if (!(channel in CHANNELS)) CHANNELS[channel] = {};
  443
+
  444
+        // Make sure we have a Channel
  445
+        if (CHANNELS[channel].connected) return log('Already Connected');
  446
+            CHANNELS[channel].connected = 1;
  447
+
  448
+        // Recurse Subscribe
  449
+        function pubnub() {
  450
+            var jsonp = jsonp_cb();
  451
+
  452
+            // Stop Connection
  453
+            if (!CHANNELS[channel].connected) return;
  454
+
  455
+            // Connect to PubNub Subscribe Servers
  456
+            CHANNELS[channel].done = xdr({
  457
+                callback : jsonp,
  458
+                url      : [
  459
+                    ORIGIN, 'subscribe',
  460
+                    SUBSCRIBE_KEY, encode(channel),
  461
+                    jsonp, timetoken
  462
+                ],
  463
+                fail     : function() { timeout( pubnub, 1000 ); error()  },
  464
+                success  : function(message) {
  465
+                    if (!CHANNELS[channel].connected) return;
  466
+                    timetoken = message[1];
  467
+                    timeout( pubnub, 10 );
  468
+                    each( message[0], function(msg) { callback(msg) } );
  469
+                }
  470
+            });
  471
+        }
  472
+
  473
+        // Begin Recursive Subscribe
  474
+        pubnub();
  475
+    },
  476
+
  477
+    // Expose PUBNUB Functions
  478
+    'xdr'      : xdr,
  479
+    'each'     : each,
  480
+    'map'      : map,
  481
+    'css'      : css,
  482
+    '$'        : $,
  483
+    'create'   : create,
  484
+    'bind'     : bind,
  485
+    'supplant' : supplant,
  486
+    'head'     : head,
  487
+    'search'   : search,
  488
+    'attr'     : attr,
  489
+    'now'      : unique
  490
+};
  491
+
  492
+// Provide Global Interfaces
  493
+window['jQuery'] && (window['jQuery']['PUBNUB'] = PUBNUB);
  494
+window['PUBNUB'] = PUBNUB;
  495
+
  496
+})();
119  titanium/3.3/mobile/README
... ...
@@ -0,0 +1,119 @@
  1
+## ------------------------------------------------------
  2
+##
  3
+## (FREE VERSION) USE "demo" KEYS As Shown Below
  4
+##
  5
+## (PAID VERSION) GET YOUR OWN API KEYS:
  6
+## http://www.pubnub.com/account
  7
+##
  8
+## ------------------------------------------------------
  9
+
  10
+## ------------------------------------------------------
  11
+## ALERT!!! ANDROID FIX!!!
  12
+## ------------------------------------------------------
  13
+## 
  14
+## You must update the tiapp.xml and add the following:
  15
+## 
  16
+## <property name="ti.android.threadstacksize" type="int">327680</property>
  17
+## 
  18
+## ------------------------------------------------------
  19
+
  20
+## ----------------------------------------------------------------
  21
+## PubNub 3.1 Real-time Cloud Push API - JAVASCRIPT TITANIUM MOBILE
  22
+## ----------------------------------------------------------------
  23
+##
  24
+## www.pubnub.com - PubNub Real-time Push Service in the Cloud. 
  25
+## http://www.pubnub.com/tutorial/javascript-push-api
  26
+##
  27
+## PubNub is a Massively Scalable Real-time Service for Web and Mobile Games.
  28
+## This is a cloud-based service for broadcasting Real-time messages
  29
+## to millions of web and mobile clients simultaneously.
  30
+
  31
+
  32
+/* ====================================================== */
  33
+/* SIMPLE EXAMPLE USE PUBNUB API (ADVANCED EXAMPLE BELOW) */
  34
+/* ====================================================== */
  35
+
  36
+Ti.include('pubnub.js');
  37
+
  38
+// ----------------------------------
  39
+// INIT PUBNUB
  40
+// ----------------------------------
  41
+var pubnub = PUBNUB.init({
  42
+    publish_key   : 'demo',
  43
+    subscribe_key : 'demo',
  44
+    ssl           : false,
  45
+    origin        : 'pubsub.pubnub.com'
  46
+});
  47
+
  48
+
  49
+// -------------------
  50
+// LISTEN FOR MESSAGES
  51
+// -------------------
  52
+pubnub.subscribe({
  53
+    channel  : "hello_world",
  54
+    callback : function(message) { Ti.API.log(message) }
  55
+})
  56
+
  57
+// ------------
  58
+// SEND MESSAGE
  59
+// ------------
  60
+pubnub.publish({
  61
+    channel : "hello_world",
  62
+    message : "Hi."
  63
+})
  64
+
  65
+/* =============================== */
  66
+/* ADVANCED EXAMPLE USE PUBNUB API */
  67
+/* =============================== */
  68
+
  69
+Ti.include('pubnub.js');
  70
+
  71
+(function(){
  72
+
  73
+    // ----------------------------------
  74
+    // INIT PUBNUB
  75
+    // ----------------------------------
  76
+    var pubnub = PUBNUB.init({
  77
+        publish_key   : 'demo',
  78
+        subscribe_key : 'demo',
  79
+        ssl           : false,
  80
+        origin        : 'pubsub.pubnub.com'
  81
+    });
  82
+
  83
+    // ----------------------------------
  84
+    // LISTEN FOR MESSAGES
  85
+    // ----------------------------------
  86
+    pubnub.subscribe({
  87
+        channel  : 'test',
  88
+        connect  : function() {
  89
+            // You can Receive Messages!
  90
+            send_a_message("Hello World! #1");
  91
+            send_a_message("Hello World! #2");
  92
+            send_a_message("Hello World! #3");
  93
+        },
  94
+        callback : function(message) {
  95
+            // Message RECEIVED!
  96
+            Ti.API.log(JSON.stringify(message));
  97
+        },
  98
+        error : function() {
  99
+            // The internet is gone.
  100
+            Ti.API.log("Connection Lost");
  101
+        }
  102
+    });
  103
+
  104
+    // ----------------------------------
  105
+    // SEND MESSAGE
  106
+    // ----------------------------------
  107
+    function send_a_message(message) {
  108
+        pubnub.publish({
  109
+            channel  : 'test',
  110
+            message  : { example : message },
  111
+            callback : function(info) {
  112
+                if (info[0])  Ti.API.log("Successfully Sent Message!");
  113
+                if (!info[0]) Ti.API.log("Failed Because: " + info[1]);
  114
+            }
  115
+        });
  116
+    }
  117
+
  118
+})();
  119
+
48  titanium/3.3/mobile/app.js
... ...
@@ -0,0 +1,48 @@
  1
+(function(){
  2
+
  3
+    // -------------------------------------
  4
+    // INIT PUBNUB
  5
+    // -------------------------------------
  6
+    var pubnub = require('pubnub').init({
  7
+        publish_key   : 'demo',
  8
+        subscribe_key : 'demo',
  9
+        ssl           : false,
  10
+        origin        : 'pubsub.pubnub.com'
  11
+    });
  12
+
  13
+    // -------------------------------------
  14
+    // LISTEN FOR MESSAGES
  15
+    // -------------------------------------
  16
+    pubnub.subscribe({
  17
+        channel  : 'test',
  18
+        connect  : function() {
  19
+            // You can Receive Messages!
  20
+            send_a_message("Hello World! #1");
  21
+            send_a_message("Hello World! #2");
  22
+            send_a_message("Hello World! #3");
  23
+        },
  24
+        callback : function(message) {
  25
+            // Message RECEIVED!
  26
+            Ti.API.log(JSON.stringify(message));
  27
+        },
  28
+        error : function() {
  29
+            // The internet is gone.
  30
+            Ti.API.log("Connection Lost");
  31
+        }
  32
+    });
  33
+
  34
+    // ----------------------------------
  35
+    // SEND MESSAGE
  36
+    // ----------------------------------
  37
+    function send_a_message(message) {
  38
+        pubnub.publish({
  39
+            channel  : 'test',
  40
+            message  : { example : message },
  41
+            callback : function(info) {
  42
+                if (info[0])  Ti.API.log("Successfully Sent Message!");
  43
+                if (!info[0]) Ti.API.log("Failed Because: " + info[1]);
  44
+            }
  45
+        });
  46
+    }
  47
+
  48
+})();
23  titanium/3.3/mobile/chat-example-app/.project
... ...
@@ -0,0 +1,23 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<projectDescription>
  3
+	<name>chat-example-app</name>
  4
+	<comment></comment>
  5
+	<projects>
  6
+	</projects>
  7
+	<buildSpec>
  8
+		<buildCommand>
  9
+			<name>com.appcelerator.titanium.core.builder</name>
  10
+			<arguments>
  11
+			</arguments>
  12
+		</buildCommand>
  13
+		<buildCommand>
  14
+			<name>com.aptana.ide.core.unifiedBuilder</name>
  15
+			<arguments>
  16
+			</arguments>
  17
+		</buildCommand>
  18
+	</buildSpec>
  19
+	<natures>
  20
+		<nature>com.appcelerator.titanium.mobile.nature</nature>
  21
+		<nature>com.aptana.projects.webnature</nature>
  22
+	</natures>
  23
+</projectDescription>
1  titanium/3.3/mobile/chat-example-app/CHANGELOG.txt
... ...
@@ -0,0 +1 @@
  1
+Place your change log text here.  This file will be incorporated with your app at package time.
219  titanium/3.3/mobile/chat-example-app/LICENSE
... ...
@@ -0,0 +1,219 @@
  1
+Copyright 2009 Appcelerator, Inc.
  2
+
  3
+   Licensed under the Apache License, Version 2.0 (the "License");
  4
+   you may not use this file except in compliance with the License.
  5
+   You may obtain a copy of the License at
  6
+
  7
+       http://www.apache.org/licenses/LICENSE-2.0
  8
+
  9
+   (or the full text of the license is below)
  10
+
  11
+   Unless required by applicable law or agreed to in writing, software
  12
+   distributed under the License is distributed on an "AS IS" BASIS,
  13
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14
+   See the License for the specific language governing permissions and
  15
+   limitations under the License.
  16
+
  17
+
  18
+
  19
+                              Apache License
  20
+                        Version 2.0, January 2004
  21
+                     http://www.apache.org/licenses/
  22
+
  23
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  24
+
  25
+1. Definitions.
  26
+
  27
+   "License" shall mean the terms and conditions for use, reproduction,
  28
+   and distribution as defined by Sections 1 through 9 of this document.
  29
+
  30
+   "Licensor" shall mean the copyright owner or entity authorized by
  31
+   the copyright owner that is granting the License.
  32
+
  33
+   "Legal Entity" shall mean the union of the acting entity and all
  34
+   other entities that control, are controlled by, or are under common
  35
+   control with that entity. For the purposes of this definition,
  36
+   "control" means (i) the power, direct or indirect, to cause the
  37
+   direction or management of such entity, whether by contract or
  38
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
  39
+   outstanding shares, or (iii) beneficial ownership of such entity.
  40
+
  41
+   "You" (or "Your") shall mean an individual or Legal Entity
  42
+   exercising permissions granted by this License.
  43
+
  44
+   "Source" form shall mean the preferred form for making modifications,
  45
+   including but not limited to software source code, documentation
  46
+   source, and configuration files.
  47
+
  48
+   "Object" form shall mean any form resulting from mechanical
  49
+   transformation or translation of a Source form, including but
  50
+   not limited to compiled object code, generated documentation,
  51
+   and conversions to other media types.
  52
+
  53
+   "Work" shall mean the work of authorship, whether in Source or
  54
+   Object form, made available under the License, as indicated by a
  55
+   copyright notice that is included in or attached to the work
  56
+   (an example is provided in the Appendix below).
  57
+
  58
+   "Derivative Works" shall mean any work, whether in Source or Object
  59
+   form, that is based on (or derived from) the Work and for which the
  60
+   editorial revisions, annotations, elaborations, or other modifications
  61
+   represent, as a whole, an original work of authorship. For the purposes
  62
+   of this License, Derivative Works shall not include works that remain
  63
+   separable from, or merely link (or bind by name) to the interfaces of,
  64
+   the Work and Derivative Works thereof.
  65
+
  66
+   "Contribution" shall mean any work of authorship, including
  67
+   the original version of the Work and any modifications or additions
  68
+   to that Work or Derivative Works thereof, that is intentionally
  69
+   submitted to Licensor for inclusion in the Work by the copyright owner
  70
+   or by an individual or Legal Entity authorized to submit on behalf of
  71
+   the copyright owner. For the purposes of this definition, "submitted"
  72
+   means any form of electronic, verbal, or written communication sent
  73
+   to the Licensor or its representatives, including but not limited to
  74
+   communication on electronic mailing lists, source code control systems,
  75
+   and issue tracking systems that are managed by, or on behalf of, the
  76
+   Licensor for the purpose of discussing and improving the Work, but
  77
+   excluding communication that is conspicuously marked or otherwise
  78
+   designated in writing by the copyright owner as "Not a Contribution."
  79
+
  80
+   "Contributor" shall mean Licensor and any individual or Legal Entity
  81
+   on behalf of whom a Contribution has been received by Licensor and
  82
+   subsequently incorporated within the Work.
  83
+
  84
+2. Grant of Copyright License. Subject to the terms and conditions of
  85
+   this License, each Contributor hereby grants to You a perpetual,
  86
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  87
+   copyright license to reproduce, prepare Derivative Works of,
  88
+   publicly display, publicly perform, sublicense, and distribute the
  89
+   Work and such Derivative Works in Source or Object form.
  90
+
  91
+3. Grant of Patent License. Subject to the terms and conditions of
  92
+   this License, each Contributor hereby grants to You a perpetual,
  93
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  94
+   (except as stated in this section) patent license to make, have made,
  95
+   use, offer to sell, sell, import, and otherwise transfer the Work,
  96
+   where such license applies only to those patent claims licensable
  97
+   by such Contributor that are necessarily infringed by their
  98
+   Contribution(s) alone or by combination of their Contribution(s)
  99
+   with the Work to which such Contribution(s) was submitted. If You
  100
+   institute patent litigation against any entity (including a
  101
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
  102
+   or a Contribution incorporated within the Work constitutes direct
  103
+   or contributory patent infringement, then any patent licenses
  104
+   granted to You under this License for that Work shall terminate
  105
+   as of the date such litigation is filed.
  106
+
  107
+4. Redistribution. You may reproduce and distribute copies of the
  108
+   Work or Derivative Works thereof in any medium, with or without
  109
+   modifications, and in Source or Object form, provided that You
  110
+   meet the following conditions:
  111
+
  112
+   (a) You must give any other recipients of the Work or
  113
+       Derivative Works a copy of this License; and
  114
+
  115
+   (b) You must cause any modified files to carry prominent notices
  116
+       stating that You changed the files; and
  117
+
  118
+   (c) You must retain, in the Source form of any Derivative Works
  119
+       that You distribute, all copyright, patent, trademark, and
  120
+       attribution notices from the Source form of the Work,
  121
+       excluding those notices that do not pertain to any part of
  122
+       the Derivative Works; and
  123
+
  124
+   (d) If the Work includes a "NOTICE" text file as part of its
  125
+       distribution, then any Derivative Works that You distribute must
  126
+       include a readable copy of the attribution notices contained
  127
+       within such NOTICE file, excluding those notices that do not
  128
+       pertain to any part of the Derivative Works, in at least one
  129
+       of the following places: within a NOTICE text file distributed
  130
+       as part of the Derivative Works; within the Source form or
  131
+       documentation, if provided along with the Derivative Works; or,
  132
+       within a display generated by the Derivative Works, if and
  133
+       wherever such third-party notices normally appear. The contents
  134
+       of the NOTICE file are for informational purposes only and
  135
+       do not modify the License. You may add Your own attribution
  136
+       notices within Derivative Works that You distribute, alongside
  137
+       or as an addendum to the NOTICE text from the Work, provided
  138
+       that such additional attribution notices cannot be construed
  139
+       as modifying the License.
  140
+
  141
+   You may add Your own copyright statement to Your modifications and
  142
+   may provide additional or different license terms and conditions
  143
+   for use, reproduction, or distribution of Your modifications, or
  144
+   for any such Derivative Works as a whole, provided Your use,
  145
+   reproduction, and distribution of the Work otherwise complies with
  146
+   the conditions stated in this License.
  147
+
  148
+5. Submission of Contributions. Unless You explicitly state otherwise,
  149
+   any Contribution intentionally submitted for inclusion in the Work
  150
+   by You to the Licensor shall be under the terms and conditions of
  151
+   this License, without any additional terms or conditions.
  152
+   Notwithstanding the above, nothing herein shall supersede or modify
  153
+   the terms of any separate license agreement you may have executed
  154
+   with Licensor regarding such Contributions.
  155
+
  156
+6. Trademarks. This License does not grant permission to use the trade
  157
+   names, trademarks, service marks, or product names of the Licensor,
  158
+   except as required for reasonable and customary use in describing the
  159
+   origin of the Work and reproducing the content of the NOTICE file.
  160
+
  161
+7. Disclaimer of Warranty. Unless required by applicable law or
  162
+   agreed to in writing, Licensor provides the Work (and each
  163
+   Contributor provides its Contributions) on an "AS IS" BASIS,
  164
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  165
+   implied, including, without limitation, any warranties or conditions
  166
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  167
+   PARTICULAR PURPOSE. You are solely responsible for determining the
  168
+   appropriateness of using or redistributing the Work and assume any
  169
+   risks associated with Your exercise of permissions under this License.
  170
+
  171
+8. Limitation of Liability. In no event and under no legal theory,
  172
+   whether in tort (including negligence), contract, or otherwise,
  173
+   unless required by applicable law (such as deliberate and grossly
  174
+   negligent acts) or agreed to in writing, shall any Contributor be
  175
+   liable to You for damages, including any direct, indirect, special,
  176
+   incidental, or consequential damages of any character arising as a
  177
+   result of this License or out of the use or inability to use the
  178
+   Work (including but not limited to damages for loss of goodwill,
  179
+   work stoppage, computer failure or malfunction, or any and all
  180
+   other commercial damages or losses), even if such Contributor
  181
+   has been advised of the possibility of such damages.
  182
+
  183
+9. Accepting Warranty or Additional Liability. While redistributing
  184
+   the