Skip to content
Browse files

Initial commit.

  • Loading branch information...
1 parent 83399fd commit 51b8139a54be67ffcf9957b0935db0e15a04176b Erik Oros committed
Showing with 48,444 additions and 0 deletions.
  1. BIN bbm/JAM41.pdf
  2. +307 −0 bbm/LICENSE
  3. BIN bbm/complete/appicon.png
  4. +80 −0 bbm/complete/bbm.html
  5. +58 −0 bbm/complete/config.xml
  6. +5,239 −0 bbm/complete/css/bbui-0.9.4.css
  7. BIN bbm/complete/img/cog.png
  8. +50 −0 bbm/complete/index.html
  9. +172 −0 bbm/complete/js/bbm.js
  10. +8,003 −0 bbm/complete/js/bbui-0.9.4.js
  11. +1,258 −0 bbm/complete/js/webworks-1.0.2.9.js
  12. BIN bbm/incomplete/appicon.png
  13. +80 −0 bbm/incomplete/bbm.html
  14. +58 −0 bbm/incomplete/config.xml
  15. +5,239 −0 bbm/incomplete/css/bbui-0.9.4.css
  16. BIN bbm/incomplete/img/cog.png
  17. +50 −0 bbm/incomplete/index.html
  18. +142 −0 bbm/incomplete/js/bbm.js
  19. +8,003 −0 bbm/incomplete/js/bbui-0.9.4.js
  20. +1,258 −0 bbm/incomplete/js/webworks-1.0.2.9.js
  21. BIN contextmenu/JAM41.pdf
  22. +307 −0 contextmenu/LICENSE
  23. BIN contextmenu/complete/appicon.png
  24. +44 −0 contextmenu/complete/config.xml
  25. BIN contextmenu/complete/img/cog.png
  26. BIN contextmenu/complete/img/hippoSquare.png
  27. +91 −0 contextmenu/complete/index.html
  28. +91 −0 contextmenu/complete/js/context.js
  29. +1,258 −0 contextmenu/complete/js/webworks-1.0.2.9.js
  30. BIN contextmenu/incomplete/appicon.png
  31. +44 −0 contextmenu/incomplete/config.xml
  32. BIN contextmenu/incomplete/img/cog.png
  33. BIN contextmenu/incomplete/img/hippoSquare.png
  34. +91 −0 contextmenu/incomplete/index.html
  35. +40 −0 contextmenu/incomplete/js/context.js
  36. +1,258 −0 contextmenu/incomplete/js/webworks-1.0.2.9.js
  37. BIN mediacards/JAM41.pdf
  38. +307 −0 mediacards/LICENSE
  39. BIN mediacards/complete/appicon.png
  40. +58 −0 mediacards/complete/config.xml
  41. +5,239 −0 mediacards/complete/css/bbui-0.9.4.css
  42. BIN mediacards/complete/img/cog.png
  43. +62 −0 mediacards/complete/index.html
  44. +72 −0 mediacards/complete/invoke.html
  45. +8,003 −0 mediacards/complete/js/bbui-0.9.4.js
  46. +166 −0 mediacards/complete/js/invoke.js
  47. +1,258 −0 mediacards/complete/js/webworks-1.0.2.9.js
  48. BIN mediacards/incomplete/appicon.png
  49. +58 −0 mediacards/incomplete/config.xml
Sorry, we could not display the entire diff because it was too big.
View
BIN bbm/JAM41.pdf
Binary file not shown.
View
307 bbm/LICENSE
@@ -0,0 +1,307 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
+ ==========================================================
+ IScroll.js
+ ==========================================================
+
+ Copyright (c) 2009-2010 Matteo Spinelli, http://cubiq.org/
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ ==========================================================
+ Plastique Icons
+ ==========================================================
+
+ Plastique Icon Set by Iconify.it, LLC is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
+
+ By downloading and using these files, you are agreeing to be bound by the
+ terms of the license corresponding to each package. If you do not agree to the terms of any of the enclosed licenses you must delete all copies of these files from your computer or computers.
+
+ Additionally, please provide a credit line and link back to my site at:
+
+ http://iconify.it
+
+ I hope you find the files useful. If you would like to help support my work, you
+ can make a donation to my PayPal account - scott.catalyst@gmail.com
+
+ Thank You,
+ Scott Lewis
+ Iconify.it, LLC
+
+
+ Creative Commons Attribution 3.0 Unported
+ http://creativecommons.org/licenses/by/3.0/legalcode
+
+ THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
+
+ BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
+
+ 1. Definitions
+
+ "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
+ "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
+ "Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
+ "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
+ "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
+ "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
+ "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
+ "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
+ "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
+ 2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
+
+ 3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
+
+ to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
+ to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
+ to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
+ to Distribute and Publicly Perform Adaptations.
+ For the avoidance of doubt:
+
+ Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
+ Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
+ Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
+ The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
+
+ 4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
+
+ You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(b), as requested.
+ If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
+ Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
+ 5. Representations, Warranties and Disclaimer
+
+ UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
+
+ 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ 7. Termination
+
+ This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
+ Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
+ 8. Miscellaneous
+
+ Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
+ Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
+ If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+ No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
+ This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
+ The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
+
View
BIN bbm/complete/appicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
80 bbm/complete/bbm.html
@@ -0,0 +1,80 @@
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<div data-bb-type="screen" data-bb-effect="fade">
+ <script type="text/javascript" src="./js/bbm.js"></script>
+
+ <!-- Title. -->
+ <div id="title" data-bb-type="title" data-bb-caption="BBM Sample" data-bb-action-caption="Register" onactionclick="_bbm.register();"></div>
+
+ <!-- A profile panel that houses our connected information. -->
+ <div id="profile" style="display: none;">
+ <div data-bb-type="round-panel">
+ <!-- Display Name -->
+ <div id="displayName" data-bb-type="panel-header">Display Name</div>
+
+ <!-- Dropdown to view various BBM fields. -->
+ <select id="field" data-bb-label="BBM Field" onchange="_bbm.fieldChanged(this);">
+ <option value="status">Status</option>
+ <option value="personalMessage">Personal Message</option>
+ <option value="ppid">PPID</option>
+ <option value="handle">Handle</option>
+ <option value="appVersion">App Version</option>
+ <option value="bbmsdkVersion">BBM SDK Version</option>
+ </select>
+
+ <!-- Status and Status Message. -->
+ <div id="_status">
+ Available: <div id="status" data-bb-type="toggle" data-bb-checked="true" data-bb-on="Yes" data-bb-off="No"></div>
+ <input id="statusMessage" type="text" placeholder="Status Message" value="" />
+ <div data-bb-type="button" onclick="_bbm.setField('status');">Set Status</div>
+ </div>
+
+ <!-- Personal Message. -->
+ <div id="_personalMessage" style="display: none;">
+ <input id="personalMessage" type="text" value="" />
+ <div data-bb-type="button" onclick="_bbm.setField('personalMessage');">Set Personal Message</div>
+ </div>
+
+ <!-- PPID. -->
+ <div id="_ppid" type="text" style="display: none;">
+ <div id="ppid" type="text" value=""></div>
+ </div>
+
+ <!-- Handle. -->
+ <div id="_handle" style="display: none;">
+ <div id="handle" type="text" value=""></div>
+ </div>
+
+ <!-- App Version. -->
+ <div id="_appVersion" style="display: none;">
+ <div id="appVersion" type="text" value=""></div>
+ </div>
+
+ <!-- BBM SDK Version. -->
+ <div id="_bbmsdkVersion" style="display: none;">
+ <div id="bbmsdkVersion" type="text" value=""></div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Action bar; only visible once registered. -->
+ <div data-bb-type="action-bar">
+ <div data-bb-type="action" data-bb-style="button" data-bb-img="./img/cog.png" onclick="_bbm.populate();">Refresh</div>
+ <div data-bb-type="action" data-bb-style="button" data-bb-img="./img/cog.png" onclick="_bbm.invite();">Invite</div>
+ </div>
+</div>
View
58 bbm/complete/config.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<widget xmlns="http://www.w3.org/ns/widgets"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ version="1.0.0.0"
+ id="bbmsample"
+ xml:lang="en">
+
+ <!-- Application details. -->
+ <name>BBM Sample</name>
+ <author>Research In Motion</author>
+
+ <!-- Application startup page. -->
+ <content src="index.html"/>
+
+ <!-- Application icon. -->
+ <icon src="appicon.png" />
+
+ <!-- Allow access to external URLs. -->
+ <access uri="*" subdomains="true" />
+
+ <!-- Do not cache content. -->
+ <rim:cache disableAllCache="true" />
+
+ <!-- Focus-based navigation for BBUI.js. -->
+ <rim:navigation mode="focus" />
+
+ <!-- Required permissions. -->
+ <rim:permissions>
+ <rim:permit>bbm_connect</rim:permit>
+ </rim:permissions>
+
+ <!-- Required features for BBUI.js. -->
+ <feature id="blackberry.app" />
+ <feature id="blackberry.app.event"/>
+ <feature id="blackberry.system.event" />
+ <feature id="blackberry.ui.dialog" />
+
+ <!-- Additional features. -->
+ <feature id="blackberry.bbm.platform" />
+</widget>
View
5,239 bbm/complete/css/bbui-0.9.4.css
5,239 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN bbm/complete/img/cog.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
50 bbm/complete/index.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <title>BBM Sample</title>
+
+ <link type="text/css" rel="stylesheet" href="./css/bbui-0.9.4.css" />
+ </head>
+ <body>
+ <script type="text/javascript" src="./js/webworks-1.0.2.9.js"></script>
+ <script type="text/javascript" src="./js/bbui-0.9.4.js"></script>
+ <script type="text/javascript">
+ /*global window, document, console, alert, blackberry, bb, _invoke */
+
+ 'use strict';
+
+ function onwebworksready() {
+ document.removeEventListener('webworksready', onwebworksready, false);
+
+ bb.init();
+ bb.pushScreen('bbm.html', 'bbm');
+ }
+
+ function onload() {
+ window.removeEventListener('load', onload, false);
+ document.addEventListener('webworksready', onwebworksready, false);
+ }
+ window.addEventListener('load', onload, false);
+ </script>
+ </body>
+</html>
View
172 bbm/complete/js/bbm.js
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+ */
+
+/*global window, document, console, alert, blackberry */
+
+/* This file holds the majority of the functionality for integration with
+ * BlackBerry Messenger.
+ */
+
+var _bbm = {
+ registered: false,
+
+ /* This will be called when the user clicks the 'set' button for
+ * status or personal message.
+ */
+ setField: function (field) {
+ 'use strict';
+ var status, message, onComplete;
+
+ if (field === 'status') {
+ /* Assign the status for this update. */
+ if (document.querySelector('#status').getChecked() === true) {
+ status = 'available';
+ } else {
+ status = 'busy';
+ }
+
+ /* Assign the status message for this update. */
+ message = document.querySelector('#statusMessage').value;
+
+ /* Assign the onComplete function for this update. */
+ onComplete = function (accepted) {
+ if (accepted === true) {
+ alert('Status update was accepted.');
+ } else {
+ alert('Status update was not accepted.');
+ }
+ };
+
+ /* Call setStatus with our defined arguments. */
+ blackberry.bbm.platform.self.setStatus(status, message, onComplete);
+ } else if (field === 'personalMessage') {
+ /* Assign the personal message for this update. */
+ message = document.querySelector('#personalMessage').value;
+
+ /* Assign the onComplete function for this update. */
+ onComplete = function (accepted) {
+ if (accepted === true) {
+ alert('Status update was accepted.');
+ } else {
+ alert('Status update was not accepted.');
+ }
+ };
+
+ /* Call setPersonalMessage with our defined arguments. */
+ blackberry.bbm.platform.self.setPersonalMessage(message, onComplete);
+ }
+ },
+
+ fieldChanged: function (element) {
+ 'use strict';
+
+ /* Reset all of our fields to invisible. */
+ document.querySelector('#_status').style.display = 'none';
+ document.querySelector('#_personalMessage').style.display = 'none';
+ document.querySelector('#_ppid').style.display = 'none';
+ document.querySelector('#_handle').style.display = 'none';
+ document.querySelector('#_appVersion').style.display = 'none';
+ document.querySelector('#_bbmsdkVersion').style.display = 'none';
+
+ /* Show the chosen field. */
+ document.querySelector("#_" + element.value).style.display = 'inline';
+ },
+
+ populate: function () {
+ 'use strict';
+
+ /* Only allow functionality if we've registered with BBM. */
+ if (_bbm.registered === true) {
+ /* Set the Display Name from the BBM profile. */
+ document.querySelector('#displayName').innerHTML = blackberry.bbm.platform.self.displayName;
+
+ /* Set the Status from the BBM profile. */
+ if (blackberry.bbm.platform.self.status === 'available') {
+ document.querySelector('#status').setChecked(true);
+ } else {
+ document.querySelector('#status').setChecked(false);
+ }
+
+ /* The remaining fields are direct assignments. */
+ document.querySelector('#statusMessage').value = blackberry.bbm.platform.self.statusMessage;
+ document.querySelector('#personalMessage').value = blackberry.bbm.platform.self.personalMessage;
+ document.querySelector('#ppid').innerHTML = blackberry.bbm.platform.self.ppid;
+ document.querySelector('#handle').innerHTML = blackberry.bbm.platform.self.handle;
+ document.querySelector('#appVersion').innerHTML = blackberry.bbm.platform.self.appVersion;
+ document.querySelector('#bbmsdkVersion').innerHTML = blackberry.bbm.platform.self.bbmsdkVersion;
+ } else {
+ alert('You must register with BBM first.');
+ }
+ },
+
+ /* Will be called when the user clicks the Register button. */
+ register: function () {
+ 'use strict';
+ var options;
+
+ /* Only invoke this functionality if we have not yet registered. */
+ if (_bbm.registered === false) {
+ blackberry.event.addEventListener("onaccesschanged", function (accessible, status) {
+ if (status === 'allowed') {
+ /* Access allowed. */
+ _bbm.registered = true;
+
+ /* Show our BBM Fields panel. */
+ document.querySelector('#profile').style.display = 'inline';
+ } else if (status === 'user') {
+ /* Access blocked by user. */
+ alert('Access is blocked by the user.');
+ } else if (status === 'rim') {
+ /* Access blocked by RIM. */
+ alert('Access is blocked by RIM.');
+ } else {
+ /* Remaining error codes have been implemented. */
+ if (status === 'itpolicy') {
+ alert('Access is blocked by IT Policy.');
+ } else if (status === 'resetrequired') {
+ alert('Access is blocked because a device reset is required to use the BBM Social Platform.');
+ } else if (status === 'nodata') {
+ alert('Access is blocked because the device is out of data coverage. A data connection is required to register the application.');
+ } else if (status === 'temperror') {
+ alert('Access is blocked because of a temporary error. The application should try to call blackberry.bbm.platform.register in 30 minutes, or the next time the application starts.');
+ } else if (status === 'nonuiapp') {
+ alert('Access is blocked because blackberry.bbm.platform.register was called from a non-UI application.');
+ }
+ }
+ });
+
+ /* A valid, unique, 36-character UUID is being used. */
+ options = {
+ uuid: "33490f91-ad95-4ba9-82c4-33f6ad69fbbc"
+ };
+
+ /* Call the register function with our UUID. */
+ blackberry.bbm.platform.register(options);
+ }
+ },
+
+ invite: function () {
+ 'use strict';
+
+ /* Only allow functionality if we've registered with BBM. */
+ if (_bbm.registered === true) {
+ blackberry.bbm.platform.users.inviteToDownload();
+ } else {
+ alert('You must register with BBM first.');
+ }
+ }
+};
View
8,003 bbm/complete/js/bbui-0.9.4.js
8,003 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1,258 bbm/complete/js/webworks-1.0.2.9.js
@@ -0,0 +1,1258 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+ */
+
+(function () {
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * Licensed 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 define,
+ require;
+
+(function () {
+ var unpreparedModules = {},
+ readyModules = {},
+ ACCEPTABLE_EXTENSIONS = [".js", ".json"],
+ DEFAULT_EXTENSION = ".js";
+
+ function hasValidExtension(moduleName) {
+ return ACCEPTABLE_EXTENSIONS.some(function (element, index, array) {
+ return moduleName.match("\\" + element + "$");
+ });
+ }
+
+
+ function normalizeName(originalName, baseName) {
+ var nameParts,
+ name = originalName.slice(0);
+ //remove ^local:// (if it exists) and .js$
+ //This will not work for local:// without a trailing js
+ name = name.replace(/(?:^local:\/\/)/, "");
+ if (name.charAt(0) === '.' && baseName) {
+ //Split the baseName and remove the final part (the module name)
+ nameParts = baseName.split('/');
+ nameParts.pop();
+ nameParts = nameParts.concat(name.split('/'));
+
+ name = nameParts.reduce(function (previous, current, index, array) {
+ var returnValue,
+ slashIndex;
+
+ //If previous is a dot, ignore it
+ //If previous is ever just .. we're screwed anyway
+ if (previous !== '.') {
+ returnValue = previous;
+ }
+
+ //If we have a .. then remove a chunk of previous
+ if (current === "..") {
+ slashIndex = previous.lastIndexOf('/');
+ //If there's no slash we're either screwed or we remove the final token
+ if (slashIndex !== -1) {
+ returnValue = previous.slice(0, previous.lastIndexOf('/'));
+ } else {
+ returnValue = "";
+ }
+ } else if (current !== '.') {
+ //Otherwise simply append anything not a .
+ //Only append a slash if we're not empty
+ if (returnValue.length) {
+ returnValue += "/";
+ }
+ returnValue += current;
+ }
+
+ return returnValue;
+ });
+
+ }
+
+ //If there is no acceptable extension tack on a .js
+ if (!hasValidExtension(name)) {
+ name = name + DEFAULT_EXTENSION;
+ }
+
+ return name;
+ }
+
+ function buildModule(name, dependencies, factory) {
+ var module = {exports: {}},
+ localRequire = function (moduleName) {
+ return require(moduleName, name);
+ },
+ args = [];
+ localRequire.toUrl = function (moduleName, baseName) {
+ return require.toUrl(moduleName, baseName || name);
+ };
+ dependencies.forEach(function (dependency) {
+ if (dependency === 'require') {
+ args.push(localRequire);
+ } else if (dependency === 'exports') {
+ args.push(module.exports);
+ } else if (dependency === 'module') {
+ args.push(module);
+ } else {
+ //This is because jshint cannot handle out of order functions
+ /*global loadModule:false */
+ args.push(loadModule(dependency));
+ /*global loadModule:true */
+ }
+ });
+
+ //No need to process dependencies, webworks only has require, exports, module
+ factory.apply(this, args);
+
+ //For full AMD we would need logic to also check the return value
+ return module.exports;
+
+ }
+
+ function getDefineString(moduleName, body) {
+ var evalString = 'define("' + moduleName + '", function (require, exports, module) {',
+ isJson = /\.json$/.test(moduleName);
+
+ evalString += isJson ? ' module.exports = ' : '';
+ evalString += body.replace(/^\s+|\s+$/g, '');
+ evalString += isJson ? ' ;' : '';
+ evalString += '});';
+
+ return evalString;
+ }
+
+ function loadModule(name, baseName) {
+ var normalizedName = normalizeName(name, baseName),
+ url,
+ xhr,
+ loadResult;
+ //Always check undefined first, this allows the user to redefine modules
+ //(Not used in WebWorks, although it is used in our unit tests)
+ if (unpreparedModules[normalizedName]) {
+ readyModules[normalizedName] = buildModule(normalizedName, unpreparedModules[normalizedName].dependencies, unpreparedModules[normalizedName].factory);
+ delete unpreparedModules[normalizedName];
+ }
+
+ //If the module does not exist, load the module from external source
+ //Webworks currently only loads APIs from across bridge
+ if (!readyModules[normalizedName]) {
+ //If the module to be loaded ends in .js then we will define it
+ //Also if baseName exists than we have a local require situation
+ if (hasValidExtension(name) || baseName) {
+ xhr = new XMLHttpRequest();
+ url = name;
+ //If the module to be loaded starts with local:// go over the bridge
+ //Else If the module to be loaded is a relative load it may not have .js extension which is needed
+ if (/^local:\/\//.test(name)) {
+ url = "http://localhost:8472/extensions/load/" + normalizedName.replace(/(?:^ext\/)(.+)(?:\/client.js$)/, "$1");
+
+ xhr.open("GET", url, false);
+ xhr.send(null);
+ try {
+ loadResult = JSON.parse(xhr.responseText);
+
+ loadResult.dependencies.forEach(function (dep) {
+ /*jshint evil:true */
+ eval(getDefineString(dep.moduleName, dep.body));
+ /*jshint evil:false */
+ });
+
+ //Trimming responseText to remove EOF chars
+ /*jshint evil:true */
+ eval(getDefineString(normalizedName, loadResult.client));
+ /*jshint evil:false */
+ } catch (err1) {
+ err1.message += ' in ' + url;
+ throw err1;
+ }
+ } else {
+ if (baseName) {
+ url = normalizedName;
+ }
+
+ xhr.open("GET", url, false);
+ xhr.send(null);
+ try {
+ //Trimming responseText to remove EOF chars
+ /*jshint evil:true */
+ eval(getDefineString(normalizedName, xhr.responseText));
+ /*jshint evil:false */
+ } catch (err) {
+ err.message += ' in ' + url;
+ throw err;
+ }
+ }
+
+ if (unpreparedModules[normalizedName]) {
+ readyModules[normalizedName] = buildModule(normalizedName, unpreparedModules[normalizedName].dependencies, unpreparedModules[normalizedName].factory);
+ delete unpreparedModules[normalizedName];
+ }
+ } else {
+ throw "module " + name + " cannot be found";
+ }
+
+ }
+
+ return readyModules[normalizedName];
+
+ }
+
+ //Use the AMD signature incase we ever want to change.
+ //For now we will only be using (name, baseName)
+ require = function (dependencies, callback) {
+ if (typeof dependencies === "string") {
+ //dependencies is the module name and callback is the relName
+ //relName is not part of the AMDJS spec, but we use it from localRequire
+ return loadModule(dependencies, callback);
+ } else if (Array.isArray(dependencies) && typeof callback === 'function') {
+ //Call it Asynchronously
+ setTimeout(function () {
+ buildModule(undefined, dependencies, callback);
+ }, 0);
+ }
+ };
+
+ require.toUrl = function (originalName, baseName) {
+ return normalizeName(originalName, baseName);
+ };
+
+ //Use the AMD signature incase we ever want to change.
+ //For now webworks will only be using (name, factory) signature.
+ define = function (name, dependencies, factory) {
+ if (typeof name === "string" && typeof dependencies === 'function') {
+ factory = dependencies;
+ dependencies = ['require', 'exports', 'module'];
+ }
+
+ //According to the AMDJS spec we should parse out the require statments
+ //from factory.toString and add those to the list of dependencies
+
+ //Normalize the name. Remove local:// and .js
+ name = normalizeName(name);
+ unpreparedModules[name] = {
+ dependencies: dependencies,
+ factory: factory
+ };
+ };
+}());
+
+//Export for use in node for unit tests
+if (typeof module === "object" && typeof require === "function") {
+ module.exports = {
+ require: require,
+ define: define
+ };
+}
+
+define('builder', function (require, exports, module) {
+/*
+ * Copyright 2010-2011 Research In Motion Limited.
+ *
+ * Licensed 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 utils = require(!!require.resolve ? "../utils" : "lib/utils");
+
+function buildNamespace(currentNamespace, namespaceParts, featureProperties) {
+ var featureId,
+ nextPart;
+
+ if (namespaceParts.length === 1) {
+ //base case, feature properties go here
+ featureId = namespaceParts[0];
+ if (currentNamespace[featureId] === undefined) {
+ currentNamespace[featureId] = {};
+ }
+
+ currentNamespace = utils.mixin(featureProperties, currentNamespace[featureId]);
+ return currentNamespace;
+ }
+ else {
+ nextPart = namespaceParts.shift();
+ if (currentNamespace[nextPart] === undefined) {
+ currentNamespace[nextPart] = {};
+ }
+
+ return buildNamespace(currentNamespace[nextPart], namespaceParts, featureProperties);
+ }
+}
+
+function include(parent, featureIdList) {
+ var featureId,
+ featureProperties,
+ localUrl,
+ i;
+
+ for (i = 0; i < featureIdList.length; i++) {
+ featureId = featureIdList[i];
+
+ localUrl = "local://ext/" + featureId + "/client.js";
+ featureProperties = utils.loadModule(localUrl);
+
+ buildNamespace(parent, featureId.split("."), featureProperties);
+ }
+}
+
+var _self = {
+ build: function (featureIdList) {
+ return {
+ into: function (target) {
+ include(target, featureIdList);
+ }
+ };
+ }
+};
+
+module.exports = _self;
+
+});
+
+define('window', function (require, exports, module) {
+/*
+ * Copyright 2010-2011 Research In Motion Limited.
+ *
+ * Licensed 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.
+ */
+
+// HACK have to live with differentiating node from browser for now
+module.exports = {
+ "window": function () {
+ return !!require.resolve ? null : window;
+ }
+};
+});
+
+define('event', function (require, exports, module) {
+/*
+* Copyright 2010-2011 Research In Motion Limited.
+*
+* Licensed 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 _handlers = {};
+
+function _add(featureId, name, cb, success, fail, once) {
+ var handler;
+ if (featureId && name && typeof cb === "function") {
+ handler = {
+ func: cb,
+ once: !!once
+ };
+ //If this is the first time we are adding a cb
+ if (!_handlers.hasOwnProperty(name)) {
+ _handlers[name] = [handler];
+ //Do not call exec for once because its not necessary
+ if (!once) {
+ window.webworks.exec(success, fail, featureId, "add", {"eventName": name});
+ }
+ } else if (!_handlers[name].some(function (element, index, array) {
+ return element.func === cb;
+ })) {
+ //Only add unique callbacks
+ _handlers[name].push(handler);
+ }
+ }
+}
+
+module.exports = {
+ add: function (featureId, name, cb, success, fail) {
+ _add(featureId, name, cb, success, fail, false);
+ },
+
+ once: function (featureId, name, cb, success, fail) {
+ _add(featureId, name, cb, success, fail, true);
+ },
+
+ isOn: function (name) {
+ return !!_handlers[name];
+ },
+
+ remove: function (featureId, name, cb, success, fail) {
+ if (featureId && name && typeof cb === "function") {
+ if (_handlers.hasOwnProperty(name)) {
+ _handlers[name] = _handlers[name].filter(function (element, index, array) {
+ return element.func !== cb || element.once;
+ });
+
+ if (_handlers[name].length === 0) {
+ delete _handlers[name];
+ window.webworks.exec(success, fail, featureId, "remove", {"eventName": name});
+ }
+ }
+ }
+ },
+
+ trigger: function (name, args) {
+ var parsedArgs;
+ if (_handlers.hasOwnProperty(name)) {
+ if (args && args !== "undefined") {
+ parsedArgs = JSON.parse(decodeURIComponent(args));
+ }
+ //Call the handlers
+ _handlers[name].forEach(function (handler) {
+ if (handler) {
+ //args should be an array of arguments
+ handler.func.apply(undefined, parsedArgs);
+ }
+ });
+ //Remove the once listeners
+ _handlers[name] = _handlers[name].filter(function (handler) {
+ return !handler.once;
+ });
+ //Clean up the array if it is empty
+ if (_handlers[name].length === 0) {
+ delete _handlers[name];
+ //No need to call remove since this would only be for callbacks
+ }
+ }
+ }
+};
+
+});
+
+define('lib/utils', function (require, exports, module) {
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * Licensed 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 self,
+ exception = require('./exception');
+
+function S4() {
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
+}
+
+self = module.exports = {
+ validateNumberOfArguments: function (lowerBound, upperBound, numberOfArguments, customExceptionType, customExceptionMessage, customExceptionObject) {
+
+ customExceptionMessage = customExceptionMessage || "";
+
+ if (arguments.length < 3 || arguments.length > 6) {
+ exception.raise(exception.types.Argument, "Wrong number of arguments when calling: validateNumberOfArguments()");
+ }
+
+ if (isNaN(lowerBound) && isNaN(upperBound) && isNaN(numberOfArguments)) {
+ exception.raise(exception.types.ArgumentType, "(validateNumberOfArguments) Arguments are not numbers");
+ }
+
+ lowerBound = parseInt(lowerBound, 10);
+ upperBound = parseInt(upperBound, 10);
+ numberOfArguments = parseInt(numberOfArguments, 10);
+
+ if (numberOfArguments < lowerBound || numberOfArguments > upperBound) {
+ exception.raise((customExceptionType || exception.types.ArgumentLength), (customExceptionMessage + "\n\nWrong number of arguments"), customExceptionObject);
+ }
+
+ },
+
+ validateArgumentType: function (arg, argType, customExceptionType, customExceptionMessage, customExceptionObject) {
+ var invalidArg = false,
+ msg;
+
+ switch (argType) {
+ case "array":
+ if (!arg instanceof Array) {
+ invalidArg = true;
+ }
+ break;
+ case "date":
+ if (!arg instanceof Date) {
+ invalidArg = true;
+ }
+ break;
+ case "integer":
+ if (typeof arg === "number") {
+ if (arg !== Math.floor(arg)) {
+ invalidArg = true;
+ }
+ }
+ else {
+ invalidArg = true;
+ }
+ break;
+ default:
+ if (typeof arg !== argType) {
+ invalidArg = true;
+ }
+ break;
+ }
+
+ if (invalidArg) {
+ msg = customExceptionMessage + ("\n\nInvalid Argument type. argument: " + arg + " ==> was expected to be of type: " + argType);
+ exception.raise((customExceptionType || exception.types.ArgumentType), msg, customExceptionObject);
+ }
+ },
+
+ validateMultipleArgumentTypes: function (argArray, argTypeArray, customExceptionType, customExceptionMessage, customExceptionObject) {
+ for (var i = 0; i < argArray.length; i++) {
+ this.validateArgumentType(argArray[i], argTypeArray[i], customExceptionType, customExceptionMessage, customExceptionObject);
+ }
+ },
+
+ arrayContains: function (array, obj) {
+ var i = array.length;
+ while (i--) {
+ if (array[i] === obj) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ some: function (obj, predicate, scope) {
+ if (obj instanceof Array) {
+ return obj.some(predicate, scope);
+ }
+ else {
+ var values = self.map(obj, predicate, scope);
+
+ return self.reduce(values, function (some, value) {
+ return value ? value : some;
+ }, false);
+ }
+ },
+
+ count: function (obj) {
+ return self.sum(obj, function (total) {
+ return 1;
+ });
+ },
+
+ sum: function (obj, selector, scope) {
+ var values = self.map(obj, selector, scope);
+ return self.reduce(values, function (total, value) {
+ return total + value;
+ });
+ },
+
+ max: function (obj, selector, scope) {
+ var values = self.map(obj, selector, scope);
+ return self.reduce(values, function (max, value) {
+ return max < value ? value : max;
+ }, Number.MIN_VALUE);
+ },
+
+ min: function (obj, selector, scope) {
+ var values = self.map(obj, selector, scope);
+ return self.reduce(values, function (min, value) {
+ return min > value ? value : min;
+ }, Number.MAX_VALUE);
+ },
+
+ forEach: function (obj, action, scope) {
+ if (obj instanceof Array) {
+ return obj.forEach(action, scope);
+ }
+ else {
+ self.map(obj, action, scope);
+ }
+ },
+
+ filter: function (obj, predicate, scope) {
+ if (obj instanceof Array) {
+ return obj.filter(predicate, scope);
+ }
+ else {
+ var result = [];
+ self.forEach(obj, function (value, index) {
+ if (predicate.apply(scope, [value, index])) {
+ result.push(value);
+ }
+
+ }, scope);
+
+ return result;
+ }
+ },
+
+ reduce: function (obj, func, init, scope) {
+ var i,
+ initial = init === undefined ? 0 : init,
+ result = initial;
+
+
+ if (obj instanceof Array) {
+ return obj.reduce(func, initial);
+ }
+ else if (obj instanceof NamedNodeMap) {
+ for (i = 0; i < obj.length; i++) {
+ result = func.apply(scope, [result, obj[i], i]);
+ }
+ }
+ else {
+ for (i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ result = func.apply(scope, [result, obj[i], i]);
+ }
+ }
+ }
+
+ return result;
+
+ },
+
+ map: function (obj, func, scope) {
+ var i,
+ returnVal = null,
+ result = [];
+
+ if (obj instanceof Array) {
+ return obj.map(func, scope);
+ }
+ else if (obj instanceof NamedNodeMap) {
+ for (i = 0; i < obj.length; i++) {
+ returnVal = func.apply(scope, [obj[i], i]);
+ result.push(returnVal);
+ }
+ }
+ else {
+ for (i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ returnVal = func.apply(scope, [obj[i], i]);
+ result.push(returnVal);
+ }
+ }
+ }
+
+ return result;
+ },
+
+ series: function (tasks, callback) {
+
+ var execute = function () {
+ var args = [],
+ task;
+
+ if (tasks.length) {
+ task = tasks.shift();
+ args = args.concat(task.args).concat(execute);
+ task.func.apply(this, args);
+ }
+ else {
+ callback.func.apply(this, callback.args);
+ }
+ };
+
+ execute();
+ },
+
+ regexSanitize: function (regexString) {
+ return regexString.replace("^", "\\^")
+ .replace("$", "\\$")
+ .replace("(", "\\(")
+ .replace(")", "\\)")
+ .replace("<", "\\<")
+ .replace("[", "\\[")
+ .replace("{", "\\{")
+ .replace(/\\/, "\\\\")
+ .replace("|", "\\|")
+ .replace(">", "\\>")
+ .replace(".", "\\.")
+ .replace("*", "\\*")
+ .replace("+", "\\+")
+ .replace("?", "\\?");
+ },
+
+ find: function (comparison, collection, startInx, endInx, callback) {
+ var results = [],
+ compare = function (s, pattern) {
+
+ if (typeof(s) !== "string" || pattern === null) {
+ return s === pattern;
+ }
+
+ var regex = pattern.replace(/\./g, "\\.")
+ .replace(/\^/g, "\\^")
+ .replace(/\*/g, ".*")
+ .replace(/\\\.\*/g, "\\*");
+
+ regex = "^".concat(regex, "$");
+
+ return !!s.match(new RegExp(regex, "i"));
+ };
+
+ self.forEach(collection, function (c) {
+ var match,
+ fail = false;
+
+ self.forEach(comparison, function (value, key) {
+ if (!fail && value !== undefined) {
+
+ if (compare(c[key], value)) {
+ match = c;
+ }
+ else {
+ fail = true;
+ match = null;
+ }
+ }
+ });
+
+ if (match) {
+ results.push(match);
+ }
+ });
+
+ if (callback) {
+ if (startInx === undefined) {
+ startInx = 0;
+ }
+ if (endInx === undefined) {
+ endInx = results.length;
+ }
+ if (startInx === endInx) {
+ endInx = startInx + 1;
+ }
+
+ callback.apply(null, [results.slice(startInx, endInx)]);
+ }
+ },
+
+ mixin: function (mixin, to) {
+ Object.getOwnPropertyNames(mixin).forEach(function (prop) {
+ if (Object.hasOwnProperty.call(mixin, prop)) {
+ Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(mixin, prop));
+ }
+ });
+ return to;
+ },
+
+ copy: function (obj) {
+ var i,
+ newObj = (obj === null ? false : global.toString.call(obj) === "[object Array]") ? [] : {};
+
+ if (typeof obj === 'number' ||
+ typeof obj === 'string' ||
+ typeof obj === 'boolean' ||
+ obj === null ||
+ obj === undefined) {
+ return obj;
+ }
+
+ if (obj instanceof Date) {
+ return new Date(obj);
+ }
+
+ if (obj instanceof RegExp) {
+ return new RegExp(obj);
+ }
+
+ for (i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ if (obj[i] && typeof obj[i] === "object") {
+ if (obj[i] instanceof Date) {
+ newObj[i] = obj[i];
+ }
+ else {
+ newObj[i] = self.copy(obj[i]);
+ }
+ }
+ else {
+ newObj[i] = obj[i];
+ }
+ }
+ }
+
+ return newObj;
+ },
+
+ startsWith : function (str, substr) {
+ return str.indexOf(substr) === 0;
+ },
+
+ endsWith : function (str, substr) {
+ return str.indexOf(substr, str.length - substr.length) !== -1;
+ },
+
+ parseUri : function (str) {
+ var i, uri = {},
+ key = [ "source", "scheme", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor" ],
+ matcher = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(str);
+
+ for (i = key.length - 1; i >= 0; i--) {
+ uri[key[i]] = matcher[i] || "";
+ }
+
+ return uri;
+ },
+
+ // uri - output from parseUri
+ isAbsoluteURI : function (uri) {
+ if (uri && uri.source) {
+ return uri.relative !== uri.source;
+ }
+
+ return false;
+ },
+
+ fileNameToImageMIME : function (fileName) {
+
+ var extensionsToMIME = {},
+ ext;
+
+ extensionsToMIME.png = 'image/png';
+ extensionsToMIME.jpg = 'image/jpeg';
+ extensionsToMIME.jpe = 'image/jpeg';
+ extensionsToMIME.jpeg = 'image/jpeg';
+ extensionsToMIME.gif = 'image/gif';
+ extensionsToMIME.bmp = 'image/bmp';
+ extensionsToMIME.bm = 'image/bmp';
+ extensionsToMIME.svg = 'image/svg+xml';
+ extensionsToMIME.tif = 'image/tiff';
+ extensionsToMIME.tiff = 'image/tiff';
+
+ ext = fileName.split('.').pop();
+ return extensionsToMIME[ext];
+ },
+
+ isLocalURI : function (uri) {
+ return uri && uri.scheme && "local:///".indexOf(uri.scheme.toLowerCase()) !== -1;
+ },
+
+ isFileURI : function (uri) {
+ return uri && uri.scheme && "file://".indexOf(uri.scheme.toLowerCase()) !== -1;
+ },
+
+ isHttpURI : function (uri) {
+ return uri && uri.scheme && "http://".indexOf(uri.scheme.toLowerCase()) !== -1;
+ },
+
+ isHttpsURI : function (uri) {
+ return uri && uri.scheme && "https://".indexOf(uri.scheme.toLowerCase()) !== -1;
+ },
+
+ // Checks if the specified uri starts with 'data:'
+ isDataURI : function (uri) {
+ return uri && uri.scheme && "data:".indexOf(uri.scheme.toLowerCase()) !== -1;
+ },
+
+ performExec : function (featureId, property, args) {
+ var result;
+
+ window.webworks.exec(function (data, response) {
+ result = data;
+ }, function (data, response) {
+ throw data;
+ }, featureId, property, args, true);
+
+ return result;
+ },
+
+ inNode : function () {
+ return !!require.resolve;
+ },
+
+ requireWebview : function () {
+ return require("./webview");
+ },
+ convertDataToBinary : function (data, dataEncoding) {
+ var rawData,
+ uint8Array,
+ i;
+
+ if (data) {
+ if (dataEncoding.toLowerCase() === "base64") {
+ rawData = window.atob(data);
+ }
+ else {
+ rawData = data;
+ }
+
+ uint8Array = new Uint8Array(new ArrayBuffer(rawData.length));
+
+ for (i = 0; i < uint8Array.length; i++) {
+ uint8Array[i] = rawData.charCodeAt(i);
+ }
+
+ return uint8Array.buffer;
+ }
+ },
+ getBlobWithArrayBufferAsData : function (data, dataEncoding) {
+ var rawData,
+ blobBuilderObj = new window.WebKitBlobBuilder();
+ rawData = this.convertDataToBinary(data, dataEncoding);
+ blobBuilderObj.append(rawData);
+
+ return blobBuilderObj.getBlob("arraybuffer");
+ },
+ loadModule: function (module) {
+ return require(module);
+ },
+ loadExtensionModule: function (extBasename, path) {
+ var ext = require("./manifest")[extBasename];
+
+ if (ext) {
+ return require("../ext/" + ext.namespace + "/" + path);
+ } else {
+ return null;
+ }
+ },
+ hasPermission: function (config, permission) {
+ if (config && config.permissions && config.permissions.length) {
+ return config.permissions.indexOf(permission) >= 0;
+ }
+
+ return false;
+ },
+ guid: function () {
+ return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
+ },
+ getURIPrefix: function () {
+ return "http://localhost:8472/";
+ }
+};
+
+});
+
+define('lib/exception', function (require, exports, module) {
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * Licensed 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 = {
+
+ types: {
+ Application: "Application",
+ ArgumentLength: "ArgumentLength",
+ ArgumentType: "ArgumentType",
+ Argument: "Argument",
+ NotificationType: "NotificationType",
+ NotificationStateType: "NotificationStateType",
+ DomObjectNotFound: "DomObjectNotFound",
+ MethodNotImplemented: "MethodNotImplemented",
+ InvalidState: "InvalidState",
+ ApplicationState: "ApplicationState"
+ },
+
+ handle: function handle(exception, reThrow) {
+ reThrow = reThrow || false;
+
+ var eMsg = exception.message || "exception caught!",
+ msg = eMsg + "\n\n" + (exception.stack || "*no stack provided*") + "\n\n";
+
+ console.error(msg);
+
+ if (reThrow) {
+ throw exception;
+ }
+ },
+
+ raise: function raise(exceptionType, message, customExceptionObject) {
+ var obj = customExceptionObject || {
+ type: "",
+ message: "",
+
+ toString: function () {
+ var result = this.name + ': "' + this.message + '"';
+
+ if (this.stack) {
+ result += "\n" + this.stack;
+ }
+ return result;
+ }
+ };
+
+ message = message || "";
+
+ obj.name = exceptionType;
+ obj.type = exceptionType;
+ // TODO: include the exception objects original message if exists
+ obj.message = message;
+
+ throw obj;
+ }
+};
+
+});
+define('lib/webworks-info', function (require, exports, module) {
+module.exports = {
+ hash: "0ce47be0f0e032b04d4c4ba14e243218",
+ version: "1.0.2.9"
+};
+});
+/*
+* Copyright 2010-2012 Research In Motion Limited.
+*
+* Licensed 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.
+*/
+(function () {
+ var _d = document.addEventListener,
+ _webworksReady = false,
+ _alreadyFired = false,
+ _listenerRegistered = false;
+
+ //Only fire the webworks event when both webworks is ready and a listener is registered
+ function fireWebworksReadyEvent() {
+ if (_listenerRegistered && _webworksReady && !_alreadyFired) {
+ _alreadyFired = true;
+ var evt = document.createEvent("Events");
+ evt.initEvent("webworksready", true, true);
+ document.dispatchEvent(evt);
+ }
+ }
+
+ //Trapping when users add listeners to the webworks ready event
+ //This way we can make sure not to fire the event before there is a listener
+ document.addEventListener = function (event, callback, capture) {
+ _d.call(document, event, callback, capture);
+ if (event.toLowerCase() === "webworksready") {
+ _listenerRegistered = true;
+ fireWebworksReadyEvent();
+ }
+ };
+
+
+ function createWebworksReady() {
+ function RemoteFunctionCall(functionUri) {
+ var params = {};
+
+ function composeUri() {
+ return require("lib/utils").getURIPrefix() + functionUri;
+ }
+
+ function createXhrRequest(uri, isAsync) {
+ var request = new XMLHttpRequest();
+
+ request.open("POST", uri, isAsync);
+ request.setRequestHeader("Content-Type", "application/json");
+
+ return request;
+ }
+
+ this.addParam = function (name, value) {
+ params[name] = encodeURIComponent(JSON.stringify(value));
+ };
+
+ this.makeSyncCall = function (success, error) {
+ var requestUri = composeUri(),
+ request = createXhrRequest(requestUri, false),
+ response,
+ errored,
+ cb,
+ data;
+
+ request.send(JSON.stringify(params));
+
+ response = JSON.parse(decodeURIComponent(request.responseText) || "null");
+ errored = response.code < 0;
+ cb = errored ? error : success;
+ data = errored ? response.msg : response.data;
+
+ if (cb) {
+ cb(data, response);
+ }
+ else if (errored) {
+ throw data;
+ }
+
+ return data;
+ };
+
+ this.makeAsyncCall = function (success, error) {
+ var requestUri = composeUri(),
+ request = createXhrRequest(requestUri, true);
+
+ request.onreadystatechange = function () {
+ if (request.readyState === 4 && request.status === 200) {
+ var response = JSON.parse(decodeURIComponent(request.responseText) || "null"),
+ cb = response.code < 0 ? error : success,
+ data = response.code < 0 ? response.msg : response.data;
+
+ return cb && cb(data, response);
+ }
+ };
+
+ request.send(JSON.stringify(params));
+ };
+ }
+
+ var builder,
+ request,
+ resp,
+ execFunc,
+ wwInfo = require('lib/webworks-info');
+
+ //For users who wish to have a single source project across BB7 -> PB -> BB10 they will need to use webworks.js
+ //To aid in this, we will fire the webworksready event on these platforms as well
+ //If blackberry object already exists then we are in an older version of webworks
+ if (window.blackberry) {
+ _webworksReady = true;
+ fireWebworksReadyEvent();
+ return;
+ }
+
+ // Build out the blackberry namespace based on the APIs desired in the config.xml
+ builder = require('builder');
+
+ request = new XMLHttpRequest();
+ request.open("GET", "http://localhost:8472/extensions/get/?hash=" + wwInfo.hash + "&version=" + wwInfo.version, true);
+
+ request.onreadystatechange = function () {
+ if (request.readyState === 4) {
+ resp = JSON.parse(decodeURIComponent(request.responseText));
+
+ if (request.status === 412) {
+ //Application Webworks.js does not match framework, display error to user.
+ alert(resp.msg);
+ } else if (request.status === 200) {
+ builder.build(resp.data).into(window);
+ //At this point all of the APIs should be built into the window object
+ //Fire the webworks ready event
+ _webworksReady = true;
+ fireWebworksReadyEvent();
+ }
+ }
+ };
+ request.send(null);
+
+ execFunc = function (success, fail, service, action, args, sync) {
+ var uri = service + "/" + action,
+ request = new RemoteFunctionCall(uri),
+ name;
+
+ for (name in args) {
+ if (Object.hasOwnProperty.call(args, name)) {
+ request.addParam(name, args[name]);
+ }
+ }
+
+ request[sync ? "makeSyncCall" : "makeAsyncCall"](success, fail);
+ };
+
+ window.webworks = {
+ exec: execFunc,
+ execSync: function (service, action, args) {
+ var result;
+
+ execFunc(function (data, response) {
+ result = data;
+ }, function (data, response) {
+ throw data;
+ }, service, action, args, true);
+
+ return result;
+ },
+ execAsync: function (service, action, args) {
+ var result;
+
+ execFunc(function (data, response) {
+ result = data;
+ }, function (data, response) {
+ throw data;
+ }, service, action, args, false);
+
+ return result;
+ },
+ successCallback: function (id, args) {
+ //HACK: this will live later
+ throw "not implemented";
+ },
+ errorCallback: function (id, args) {
+ //HACK: this will live later
+ throw "not implemented";
+ },
+ defineReadOnlyField: function (obj, field, value) {
+ Object.defineProperty(obj, field, {
+ "value": value,
+ "writable": false
+ });
+ },
+ event: require("event")
+ };
+ }
+ //Only start building window.webworks once the DOMContent is loaded
+ document.addEventListener('DOMContentLoaded', createWebworksReady, false);
+ //If the DOM Content has already been loaded then create window.webworks immediately
+ if (document.readyState === 'complete') {
+ createWebworksReady();
+ }
+}());
+
+
+}());
View
BIN bbm/incomplete/appicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
80 bbm/incomplete/bbm.html
@@ -0,0 +1,80 @@
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<div data-bb-type="screen" data-bb-effect="fade">
+ <script type="text/javascript" src="./js/bbm.js"></script>
+
+ <!-- Title. -->
+ <div id="title" data-bb-type="title" data-bb-caption="BBM Sample" data-bb-action-caption="Register" onactionclick="_bbm.register();"></div>
+
+ <!-- A profile panel that houses our connected information. -->
+ <div id="profile" style="display: none;">
+ <div data-bb-type="round-panel">
+ <!-- Display Name -->
+ <div id="displayName" data-bb-type="panel-header">Display Name</div>
+
+ <!-- Dropdown to view various BBM fields. -->
+ <select id="field" data-bb-label="BBM Field" onchange="_bbm.fieldChanged(this);">
+ <option value="status">Status</option>
+ <option value="personalMessage">Personal Message</option>
+ <option value="ppid">PPID</option>
+ <option value="handle">Handle</option>
+ <option value="appVersion">App Version</option>
+ <option value="bbmsdkVersion">BBM SDK Version</option>
+ </select>
+
+ <!-- Status and Status Message. -->
+ <div id="_status">
+ Available: <div id="status" data-bb-type="toggle" data-bb-checked="true" data-bb-on="Yes" data-bb-off="No"></div>
+ <input id="statusMessage" type="text" placeholder="Status Message" value="" />
+ <div data-bb-type="button" onclick="_bbm.setField('status');">Set Status</div>
+ </div>
+
+ <!-- Personal Message. -->
+ <div id="_personalMessage" style="display: none;">
+ <input id="personalMessage" type="text" value="" />
+ <div data-bb-type="button" onclick="_bbm.setField('personalMessage');">Set Personal Message</div>
+ </div>
+
+ <!-- PPID. -->
+ <div id="_ppid" type="text" style="display: none;">
+ <div id="ppid" type="text" value=""></div>
+ </div>
+
+ <!-- Handle. -->
+ <div id="_handle" style="display: none;">
+ <div id="handle" type="text" value=""></div>
+ </div>
+
+ <!-- App Version. -->
+ <div id="_appVersion" style="display: none;">
+ <div id="appVersion" type="text" value=""></div>
+ </div>
+
+ <!-- BBM SDK Version. -->
+ <div id="_bbmsdkVersion" style="display: none;">
+ <div id="bbmsdkVersion" type="text" value=""></div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Action bar; only visible once registered. -->
+ <div data-bb-type="action-bar">
+ <div data-bb-type="action" data-bb-style="button" data-bb-img="./img/cog.png" onclick="_bbm.populate();">Refresh</div>
+ <div data-bb-type="action" data-bb-style="button" data-bb-img="./img/cog.png" onclick="_bbm.invite();">Invite</div>
+ </div>
+</div>
View
58 bbm/incomplete/config.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<widget xmlns="http://www.w3.org/ns/widgets"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ version="1.0.0.0"
+ id="bbmsample"
+ xml:lang="en">
+
+ <!-- Application details. -->
+ <name>BBM Sample</name>
+ <author>Research In Motion</author>
+
+ <!-- Application startup page. -->
+ <content src="index.html"/>
+
+ <!-- Application icon. -->
+ <icon src="appicon.png" />
+
+ <!-- Allow access to external URLs. -->
+ <access uri="*" subdomains="true" />
+
+ <!-- Do not cache content. -->
+ <rim:cache disableAllCache="true" />
+
+ <!-- Focus-based navigation for BBUI.js. -->
+ <rim:navigation mode="focus" />
+
+ <!-- Required permissions. -->
+ <rim:permissions>
+ <rim:permit>bbm_connect</rim:permit>
+ </rim:permissions>
+
+ <!-- Required features for BBUI.js. -->
+ <feature id="blackberry.app" />
+ <feature id="blackberry.app.event"/>
+ <feature id="blackberry.system.event" />
+ <feature id="blackberry.ui.dialog" />
+
+ <!-- Additional features. -->
+ <feature id="blackberry.bbm.platform" />
+</widget>
View
5,239 bbm/incomplete/css/bbui-0.9.4.css
5,239 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN bbm/incomplete/img/cog.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
50 bbm/incomplete/index.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+
+<!--
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+-->
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <title>BBM Sample</title>
+
+ <link type="text/css" rel="stylesheet" href="./css/bbui-0.9.4.css" />
+ </head>
+ <body>
+ <script type="text/javascript" src="./js/webworks-1.0.2.9.js"></script>
+ <script type="text/javascript" src="./js/bbui-0.9.4.js"></script>
+ <script type="text/javascript">
+ /*global window, document, console, alert, blackberry, bb, _invoke */
+
+ 'use strict';
+
+ function onwebworksready() {
+ document.removeEventListener('webworksready', onwebworksready, false);
+
+ bb.init();
+ bb.pushScreen('bbm.html', 'bbm');
+ }
+
+ function onload() {
+ window.removeEventListener('load', onload, false);
+ document.addEventListener('webworksready', onwebworksready, false);
+ }
+ window.addEventListener('load', onload, false);
+ </script>
+ </body>
+</html>
View
142 bbm/incomplete/js/bbm.js
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed 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.
+ */
+
+/*global window, document, console, alert, blackberry */
+
+/* This file holds the majority of the functionality for integration with
+ * BlackBerry Messenger.
+ */
+
+var _bbm = {
+ registered: false,
+
+ /* This will be called when the user clicks the 'set' button for
+ * status or personal message.
+ */
+ setField: function (field) {
+ 'use strict';
+ var status, message, onComplete;
+
+ if (field === 'status') {
+ /****************************************/
+ /*********** TASK 5 GOES HERE ***********/
+ /****************************************/
+ } else if (field === 'personalMessage') {
+ /****************************************/
+ /*********** TASK 6 GOES HERE ***********/
+ /****************************************/
+ }
+ },
+
+ fieldChanged: function (element) {
+ 'use strict';
+
+ /* Reset all of our fields to invisible. */
+ document.querySelector('#_status').style.display = 'none';
+ document.querySelector('#_personalMessage').style.display = 'none';
+ document.querySelector('#_ppid').style.display = 'none';
+ document.querySelector('#_handle').style.display = 'none';
+ document.querySelector('#_appVersion').style.display = 'none';
+ document.querySelector('#_bbmsdkVersion').style.display = 'none';
+