BluePay_Echeck - Version 1.5.0.6

Version Notes

Fixed JS errors on checkout

Download this release

Release Info

Developer Justin Slingerland
Extension BluePay_Echeck
Version 1.5.0.6
Comparing to
See all releases


Code changes from version 1.5.0.5 to 1.5.0.6

Files changed (80) hide show
  1. app/design/frontend/base/default/layout/bluepay_echeck.xml +1 -3
  2. app/design/frontend/base/default/template/bluepay/buttonach.phtml +0 -30
  3. app/design/frontend/base/default/template/bluepay/echeck.phtml +0 -47
  4. app/design/frontend/base/default/template/bluepay/echeck_form.phtml +0 -45
  5. app/design/frontend/base/default/template/bluepay/echeckiframe.phtml +0 -3
  6. js/bluepay_echeck/bluepay.js +0 -3
  7. js/bluepay_echeck/easyXDM/{src/widgets/Widgets.js → easyXDM.Widgets.debug.js} +0 -0
  8. js/bluepay_echeck/easyXDM/easyXDM.Widgets.js +310 -0
  9. js/bluepay_echeck/easyXDM/easyXDM.Widgets.min.js +1 -0
  10. js/bluepay_echeck/easyXDM/easyXDM.debug.js +2848 -0
  11. js/bluepay_echeck/easyXDM/easyXDM.js +2553 -0
  12. js/bluepay_echeck/easyXDM/easyXDM.min.js +1 -0
  13. js/bluepay_echeck/easyXDM/{src/name.html → name.html} +0 -0
  14. js/bluepay_echeck/easyXDM/src/Core.js +0 -911
  15. js/bluepay_echeck/easyXDM/src/Debug.js +0 -174
  16. js/bluepay_echeck/easyXDM/src/DomHelper.js +0 -69
  17. js/bluepay_echeck/easyXDM/src/Fn.js +0 -78
  18. js/bluepay_echeck/easyXDM/src/Rpc.js +0 -171
  19. js/bluepay_echeck/easyXDM/src/Socket.js +0 -117
  20. js/bluepay_echeck/easyXDM/src/begin_scope.txt +0 -1
  21. js/bluepay_echeck/easyXDM/src/changes.html +0 -413
  22. js/bluepay_echeck/easyXDM/src/cors/index.html +0 -214
  23. js/bluepay_echeck/easyXDM/src/easyXDM.debug.js +0 -47
  24. js/bluepay_echeck/easyXDM/src/easyxdm.swf +0 -0
  25. js/bluepay_echeck/easyXDM/src/end_scope.txt +0 -2
  26. js/bluepay_echeck/easyXDM/src/example/blank.html +0 -10
  27. js/bluepay_echeck/easyXDM/src/example/bookmark.html +0 -50
  28. js/bluepay_echeck/easyXDM/src/example/bookmark.js +0 -74
  29. js/bluepay_echeck/easyXDM/src/example/bridge.html +0 -135
  30. js/bluepay_echeck/easyXDM/src/example/data.html +0 -133
  31. js/bluepay_echeck/easyXDM/src/example/glossary.aspx +0 -29
  32. js/bluepay_echeck/easyXDM/src/example/index.html +0 -75
  33. js/bluepay_echeck/easyXDM/src/example/methods.html +0 -148
  34. js/bluepay_echeck/easyXDM/src/example/remote.html +0 -83
  35. js/bluepay_echeck/easyXDM/src/example/remoteapp.html +0 -37
  36. js/bluepay_echeck/easyXDM/src/example/remotedata.html +0 -64
  37. js/bluepay_echeck/easyXDM/src/example/remotemethods.html +0 -46
  38. js/bluepay_echeck/easyXDM/src/example/remoterpcbackend.html +0 -36
  39. js/bluepay_echeck/easyXDM/src/example/remotetransport.html +0 -24
  40. js/bluepay_echeck/easyXDM/src/example/resize_iframe.html +0 -70
  41. js/bluepay_echeck/easyXDM/src/example/resize_intermediate.html +0 -67
  42. js/bluepay_echeck/easyXDM/src/example/resized_iframe_1.html +0 -21
  43. js/bluepay_echeck/easyXDM/src/example/resized_iframe_2.html +0 -33
  44. js/bluepay_echeck/easyXDM/src/example/transport.html +0 -82
  45. js/bluepay_echeck/easyXDM/src/example/upload.html +0 -100
  46. js/bluepay_echeck/easyXDM/src/example/upload_handler.aspx +0 -15
  47. js/bluepay_echeck/easyXDM/src/example/upload_rpc.html +0 -25
  48. js/bluepay_echeck/easyXDM/src/example/widget.html +0 -49
  49. js/bluepay_echeck/easyXDM/src/example/widgets.html +0 -75
  50. js/bluepay_echeck/easyXDM/src/example/xhr.html +0 -112
  51. js/bluepay_echeck/easyXDM/src/flash/net.easyxdm.flash/Main.as +0 -196
  52. js/bluepay_echeck/easyXDM/src/flash/net.easyxdm.flash/net.easyxdm.flash.as2proj +0 -55
  53. js/bluepay_echeck/easyXDM/src/flash/test/doma.html +0 -70
  54. js/bluepay_echeck/easyXDM/src/flash/test/domb.html +0 -67
  55. js/bluepay_echeck/easyXDM/src/header.html +0 -7
  56. js/bluepay_echeck/easyXDM/src/header.js +0 -23
  57. js/bluepay_echeck/easyXDM/src/resources.txt +0 -3
  58. js/bluepay_echeck/easyXDM/src/stack/FlashTransport.js +0 -227
  59. js/bluepay_echeck/easyXDM/src/stack/FrameElementTransport.js +0 -103
  60. js/bluepay_echeck/easyXDM/src/stack/HashTransport.js +0 -179
  61. js/bluepay_echeck/easyXDM/src/stack/NameTransport.js +0 -171
  62. js/bluepay_echeck/easyXDM/src/stack/PostMessageTransport.js +0 -152
  63. js/bluepay_echeck/easyXDM/src/stack/QueueBehavior.js +0 -164
  64. js/bluepay_echeck/easyXDM/src/stack/ReliableBehavior.js +0 -79
  65. js/bluepay_echeck/easyXDM/src/stack/RpcBehavior.js +0 -245
  66. js/bluepay_echeck/easyXDM/src/stack/SameOriginTransport.js +0 -99
  67. js/bluepay_echeck/easyXDM/src/stack/VerifyBehavior.js +0 -90
  68. js/bluepay_echeck/easyXDM/src/tests/.consumer.html.swp +0 -0
  69. js/bluepay_echeck/easyXDM/src/tests/consumer.html +0 -21
  70. js/bluepay_echeck/easyXDM/src/tests/easyTest.css +0 -14
  71. js/bluepay_echeck/easyXDM/src/tests/easyTest.js +0 -262
  72. js/bluepay_echeck/easyXDM/src/tests/index.html +0 -91
  73. js/bluepay_echeck/easyXDM/src/tests/provider.html +0 -17
  74. js/bluepay_echeck/easyXDM/src/tests/s.gif +0 -0
  75. js/bluepay_echeck/easyXDM/src/tests/test.html +0 -17
  76. js/bluepay_echeck/easyXDM/src/tests/test_namespace.html +0 -32
  77. js/bluepay_echeck/easyXDM/src/tests/test_rpc.html +0 -65
  78. js/bluepay_echeck/easyXDM/src/tests/test_transport.html +0 -28
  79. js/bluepay_echeck/easyXDM/src/tests/tests.js +0 -855
  80. package.xml +7 -7
app/design/frontend/base/default/layout/bluepay_echeck.xml CHANGED
@@ -30,9 +30,7 @@
30
  <checkout_onepage_index>
31
  <reference name="head">
32
  <action method="addJs"><file>bluepay_echeck/bluepay.js</file></action>
33
- <action method="addJs"><file>bluepay_echeck/easyXDM/src/easyXDM.debug.js</file></action>
34
- <!--<action method="addJs"><file>bluepay/easyXDM/src/Socket.js</file></action>
35
- <action method="addJs"><file>bluepay/easyXDM/src/Core.js</file></action>-->
36
  </reference>
37
  </checkout_onepage_index>
38
  <checkout_onepage_review translate="label">
30
  <checkout_onepage_index>
31
  <reference name="head">
32
  <action method="addJs"><file>bluepay_echeck/bluepay.js</file></action>
33
+ <action method="addJs"><file>bluepay_echeck/easyXDM/easyXDM.min.js</file></action>
 
 
34
  </reference>
35
  </checkout_onepage_index>
36
  <checkout_onepage_review translate="label">
app/design/frontend/base/default/template/bluepay/buttonach.phtml DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- $save = (Mage::getStoreConfig('payment/echeckpayment/use_iframe') == '1') ? 'process()' :'checkReview();bluepay.save()';
27
- ?>
28
- <script>
29
- </script>
30
- <button id="submitBtn" type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="<?php echo $save?>"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/bluepay/echeck.phtml DELETED
@@ -1,47 +0,0 @@
1
- <fieldset class="form-list">
2
- <?php $_code=$this->getMethodCode() ?>
3
- <ul id="payment_form_<?php echo $_code ?>" style="display:none">
4
- <li>
5
- <div class="input-box">
6
- <label for="<?php echo $_code ?>_echeck_routing_number"><?php echo $this->__('Bank routing number') ?> <span class="required">*</span></label><br />
7
- <input id="<?php echo $_code ?>_echeck_routing_number" name="payment[echeck_routing_number]" class="required-entry">
8
- </div>
9
- </li>
10
- <!-- <li>
11
- <div class="input-box">
12
- <label for="<?php echo $_code ?>_echeck_bank_name"><?php echo $this->__('Bank name') ?> <span class="required">*</span></label><br />
13
- <input id="<?php echo $_code ?>_echeck_bank_name" name="payment[echeck_bank_name]" class="required-entry">
14
- </div>
15
- </li> -->
16
- <li>
17
- <div class="input-box">
18
- <label for="<?php echo $_code ?>_echeck_bank_acct_num"><?php echo $this->__('Bank account number') ?> <span class="required">*</span></label><br />
19
- <input id="<?php echo $_code ?>_echeck_bank_acct_num" name="payment[echeck_bank_acct_num]" class="required-entry">
20
- </div>
21
- </li>
22
- <li>
23
- <div class="input-box">
24
- <label for="<?php echo $_code ?>_echeck_account_type"><?php echo $this->__('Account type') ?> <span class="required">*</span></label><br />
25
- <select id="<?php echo $_code ?>_echeck_account_type" name="payment[echeck_account_type]" class="required-entry">
26
- <option value=""><?php echo $this->__('--Please Select--')?></option>
27
- <?php $_accountType = $this->getInfoData('account_type') ?>
28
- <?php foreach ($this->getAccountAvailableTypes() as $_typeCode => $_typeName): ?>
29
- <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_accountType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
30
- <?php endforeach ?>
31
- </select>
32
- </div>
33
- </li>
34
- <!-- <li>
35
- <div class="input-box">
36
- <label for="<?php echo $_code ?>_echeck_account_name"><?php echo $this->__('Name On Account') ?> <span class="required">*</span></label><br />
37
- <input id="<?php echo $_code ?>_echeck_account_name" name="payment[echeck_account_name]" class="required-entry">
38
- </div>
39
- </li> -->
40
- <!-- li>
41
- <div class="input-box">
42
- <label for="<?php echo $_code ?>_echeck_type"><?php echo $this->__('Echeck type') ?> <span class="required">*</span></label><br />
43
- <input id="<?php echo $_code ?>_echeck_type" name="payment[echeck_type]" class="required-entry">
44
- </div>
45
- </li-->
46
- </ul>
47
- </fieldset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/bluepay/echeck_form.phtml DELETED
@@ -1,45 +0,0 @@
1
- <?PHP
2
- if (Mage::getStoreConfig('payment/echeckpayment/use_iframe') == '0') {
3
- return false;
4
- }
5
- $_initial = true;
6
- $_form = $this;
7
- $_code = $_form->getMethodCode();
8
- $_method = $_form->getMethod();
9
- $_accID = Mage::getStoreConfig('payment/echeckpayment/login');
10
- $_secKey = Mage::getStoreConfig('payment/echeckpayment/trans_key');
11
- $_transType = Mage::getStoreConfig('payment/echeckpayment/payment_action');
12
- $_transMode = Mage::getStoreConfig('payment/echeckpayment/test_mode');
13
- $_storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
14
- $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
15
- $_amount = $totals["grand_total"]->getValue();
16
- $customerName = Mage::helper('customer')->getCustomerName();
17
- $address = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
18
- $billingAddress = $address->getStreetFull();
19
- $country = $address->getCountryId();
20
- $city = $address->getCity();
21
- $state = $address->getRegion();
22
- $zip = $address->getPostcode();
23
- $phone = $address->getTelephone();
24
- $email = $address->getEmail();
25
- $session = Mage::getSingleton('checkout/session');
26
- $comment = "";
27
- foreach ($session->getQuote()->getAllItems() as $item) {
28
- $comment .= $item->getQty() . ' ';
29
- $comment .= '[' . $item->getSku() . ']' . ' ';
30
- $comment .= $item->getName() . ' ';
31
- $comment .= $item->getDescription() . ' ';
32
- $comment .= $item->getBaseCalculationPrice . ' ';
33
- }
34
- $shpfTPS = md5($_secKey . $_amount . $customerName . $city . $state . $zip . $phone . $email);
35
- $_url = 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=magentoach&SHPF_ACCOUNT_ID=' . $_accID . '&SHPF_TPS_DEF=AMOUNT NAME CITY STATE ZIPCODE PHONE EMAIL' . '&SHPF_TPS=' . $shpfTPS . '&TRANS_TYPE=' . $_transType . '&KEY=' . $_secKey . '&MODE=' . $_transMode . '&NAME=' . $customerName . '&STORE_URL=' . $_storeUrl . '&AMOUNT=' . $_amount . '&ADDR1=' . $billingAddress . '&CITY=' . $city . '&STATE=' . $state . '&ZIPCODE=' . $zip . '&COUNTRY=' . $country . '&PHONE=' . $phone . '&EMAIL=' . $email . '&COMMENT=' . $comment;
36
-
37
- ?>
38
- <html>
39
- <body>
40
- <br /><!-- use css to style this and its contained iframe --><br /><div id="container"></div>
41
- <script>
42
- iframeSocket("<?php echo $_url;?>");
43
- </script>
44
- </body>
45
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/bluepay/echeckiframe.phtml DELETED
@@ -1,3 +0,0 @@
1
- <?php $_code=$this->getMethodCode() ?>
2
- <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
- <p>Enter your e-check details on the Order Review page.</p>
 
 
 
js/bluepay_echeck/bluepay.js CHANGED
@@ -1,6 +1,3 @@
1
- <script type="text/javascript">
2
- $.noConflict();
3
- </script>
4
  var socket = '';
5
 
6
  function iframeSocket(url) {
 
 
 
1
  var socket = '';
2
 
3
  function iframeSocket(url) {
js/bluepay_echeck/easyXDM/{src/widgets/Widgets.js → easyXDM.Widgets.debug.js} RENAMED
File without changes
js/bluepay_echeck/easyXDM/easyXDM.Widgets.js ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
+ /*global easyXDM, window */
3
+ /**
4
+ * easyXDM
5
+ * http://easyxdm.net/
6
+ * Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+ /**
27
+ * @class easyXDM.WidgetManager
28
+ * A class for managing widgets.<br/>
29
+ * Handles initializing widgets, and does all of the message distribution.
30
+ <pre><code>
31
+ _widgetManager = new easyXDM.WidgetManager({
32
+ local: "../hash.html",
33
+ container: document.getElementById("defaultcontainer")
34
+ },function(){
35
+ _widgetManager.addWidget("http://provider.easyxdm.net/example/widget.html",{});
36
+ });
37
+ </code></pre>
38
+ * Widgets can by dynamically added using the addWidget method
39
+ <pre><code>
40
+ _widgetManager.addWidget("http://provider.easyxdm.net/example/widget.html",{
41
+ container document.getElementById("widgetcontainer")
42
+ });
43
+ </code></pre>
44
+ * @constructor
45
+ * @param {Object} config The WidgetManagers configuration
46
+ * @namespace easyXDM
47
+ */
48
+ easyXDM.WidgetManager = function(config){
49
+ var WidgetManager = this, _hashUrl = config.local, _channelNr = 0;
50
+ var Events = {
51
+ WidgetInitialized: "widgetinitialized",
52
+ WidgetFailed: "widgetfailed"
53
+ };
54
+ var _widgets = {}, _subscribers = {};
55
+ var _widgetSettings = {
56
+ hosturl: location.href
57
+ };
58
+ easyXDM.apply(_widgetSettings, config.widgetSettings);
59
+ var _container = config.container || document.body;
60
+
61
+ /**
62
+ * @private
63
+ * Raises the specified event
64
+ * @param {String} event The raised event
65
+ * @param {Object} arg
66
+ */
67
+ function _raiseEvent(event, arg){
68
+ if (config.listeners && config.listeners[event]) {
69
+ config.listeners[event](WidgetManager, arg);
70
+ }
71
+ }
72
+
73
+ /**
74
+ * @private
75
+ * Adds the widghet to the list of subscribers for the given topic
76
+ * @param {String} url The widgets url
77
+ * @param {String} topic The topic to subscribe to
78
+ */
79
+ function _subscribe(url, topic){
80
+ if (!(topic in _subscribers)) {
81
+ _subscribers[topic] = [];
82
+ }
83
+ _subscribers[topic].push(url);
84
+ }
85
+
86
+ /**
87
+ * @private
88
+ * Initialized the widget.<br/>
89
+ * This is called after the widget has notified that it is ready.
90
+ * @param {Object} widget The widget
91
+ * @param {String} url The widgets url
92
+ * @param {Object} widgetConfig The widgets configuration
93
+ */
94
+ function _initializeWidget(widget, url, widgetConfig){
95
+ widget.initialize(_widgetSettings, function(response){
96
+ if (response.isInitialized) {
97
+ _widgets[url] = widget;
98
+ var i = response.subscriptions.length;
99
+ while (i--) {
100
+ _subscribe(url, response.subscriptions[i]);
101
+ }
102
+ _raiseEvent(Events.WidgetInitialized, {
103
+ url: url
104
+ });
105
+ }
106
+ else {
107
+ widget.destroy();
108
+ _raiseEvent(Events.WidgetFailed, {
109
+ url: url
110
+ });
111
+ }
112
+ });
113
+ }
114
+
115
+ /**
116
+ * @private
117
+ * Publishes the data to the topics subscribers
118
+ * @param {String} url The senders url
119
+ * @param {String} topic The datas topic
120
+ * @param {Object} data The data to publish
121
+ */
122
+ function _publish(url, topic, data){
123
+ var subscribers = _subscribers[topic];
124
+ if (subscribers) {
125
+ var i = subscribers.length, widgetUrl;
126
+ while (i--) {
127
+ widgetUrl = subscribers[i];
128
+ if (widgetUrl !== url) {
129
+ _widgets[widgetUrl].send(url, topic, data);
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * @private
137
+ * Sets up a new widget
138
+ * @param {String} url The widgets url
139
+ * @param {Object} widgetConfig The widgets configuration
140
+ */
141
+ function _setUpWidget(url, widgetConfig){
142
+ var widget = new easyXDM.Rpc({
143
+ channel: "widget" + _channelNr++,
144
+ local: _hashUrl,
145
+ remote: url,
146
+ container: widgetConfig.container || _container,
147
+ swf: config.swf,
148
+ onReady: function(){
149
+ _initializeWidget(widget, url, widgetConfig);
150
+ }
151
+ }, {
152
+ local: {
153
+ subscribe: {
154
+ isVoid: true,
155
+ method: function(topic){
156
+ _subscribe(url, topic);
157
+ }
158
+ },
159
+ publish: {
160
+ isVoid: true,
161
+ method: function(topic, data){
162
+ _publish(url, topic, data);
163
+ }
164
+ }
165
+ },
166
+ remote: {
167
+ initialize: {},
168
+ send: {
169
+ isVoid: true
170
+ }
171
+ }
172
+ });
173
+ }
174
+
175
+ /**
176
+ * Adds a widget to the collection
177
+ * @param {String} url The url to load the widget from
178
+ * @param {Object} widgetConfig The widgets url
179
+ */
180
+ this.addWidget = function(url, widgetConfig){
181
+ if (url in _widgets) {
182
+ throw new Error("A widget with this url has already been initialized");
183
+ }
184
+ _setUpWidget(url, widgetConfig);
185
+ };
186
+
187
+ /**
188
+ * Removes the widget
189
+ * @param {Object} url
190
+ */
191
+ this.removeWidget = function(url){
192
+ if (url in _widgets) {
193
+ for (var topic in _subscribers) {
194
+ if (_subscribers.hasOwnProperty(topic)) {
195
+ var subscribers = _subscribers[topic], i = subscribers.length;
196
+ while (i--) {
197
+ if (subscribers[i] === url) {
198
+ subscribers.splice(i, 1);
199
+ break;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ _widgets[url].destroy();
205
+ delete _widgets[url];
206
+ }
207
+ };
208
+
209
+ /**
210
+ * Publish data to a topics subscribers
211
+ * @param {String} topic The topic to publish to
212
+ * @param {Object} data The data to publish
213
+ */
214
+ this.publish = function(topic, data){
215
+ _publish("", topic, data);
216
+ };
217
+
218
+ /**
219
+ * Broadcasts data to all the widgets
220
+ * @param {Object} data The data to broadcast
221
+ */
222
+ this.broadcast = function(data){
223
+ for (var url in _widgets) {
224
+ if (_widgets.hasOwnPropert(url)) {
225
+ _widgets[url].send({
226
+ url: "",
227
+ topic: "broadcast",
228
+ data: data
229
+ });
230
+ }
231
+ }
232
+ };
233
+ };
234
+
235
+ /**
236
+ * @class easyXDM.Widget
237
+ * The base framework for creating widgets
238
+ * @constructor
239
+ * @param {Object} config The widgets configuration
240
+ * @param {Function} onReady A method to run after the widget has been initialized.
241
+ * @namespace easyXDM
242
+ */
243
+ easyXDM.Widget = function(config){
244
+ var _widget = this;
245
+ var _incomingMessageHandler;
246
+ var _widgetHost = new easyXDM.Rpc({
247
+ swf: config.swf
248
+ }, {
249
+ remote: {
250
+ subscribe: {
251
+ isVoid: true
252
+ },
253
+ publish: {
254
+ isVoid: true
255
+ }
256
+ },
257
+ local: {
258
+ initialize: {
259
+ method: function(settings){
260
+ config.initialized(_widget, _widgetHost);
261
+ return {
262
+ isInitialized: true,
263
+ subscriptions: config.subscriptions
264
+ };
265
+ }
266
+ },
267
+ send: {
268
+ isVoid: true,
269
+ method: function(url, topic, data){
270
+ _incomingMessageHandler(url, topic, data);
271
+ }
272
+ }
273
+ }
274
+ });
275
+
276
+ /**
277
+ * @private
278
+ * Destroy the interface on unload
279
+ */
280
+ window.onunload = function(){
281
+ _widgetHost.destroy();
282
+ };
283
+
284
+ /**
285
+ * Publish data to subscribers to a topic
286
+ * @param {String} topic The topic to publish to
287
+ * @param {Object} data The data to publish
288
+ */
289
+ this.publish = function(topic, data){
290
+ _widgetHost.publish(topic, data);
291
+ };
292
+
293
+ /**
294
+ * Subscribe to a topic
295
+ * @param {String} topic The topic to subscribe to
296
+ */
297
+ this.subscribe = function(topic){
298
+ _widgetHost.subscribe(topic);
299
+ };
300
+
301
+ /**
302
+ * Register the method that will handle incoming messages
303
+ * @param {Function} fn The handler
304
+ */
305
+ this.registerMessageHandler = function(fn){
306
+ _incomingMessageHandler = fn;
307
+ };
308
+
309
+ config.initialize(this, _widgetHost);
310
+ };
js/bluepay_echeck/easyXDM/easyXDM.Widgets.min.js ADDED
@@ -0,0 +1 @@
 
1
+ easyXDM.WidgetManager=function(e){var h=this,b=e.local,k=0;var n={WidgetInitialized:"widgetinitialized",WidgetFailed:"widgetfailed"};var j={},d={};var i={hosturl:location.href};easyXDM.apply(i,e.widgetSettings);var g=e.container||document.body;function f(p,o){if(e.listeners&&e.listeners[p]){e.listeners[p](h,o)}}function c(p,o){if(!(o in d)){d[o]=[]}d[o].push(p)}function m(p,o,q){p.initialize(i,function(r){if(r.isInitialized){j[o]=p;var s=r.subscriptions.length;while(s--){c(o,r.subscriptions[s])}f(n.WidgetInitialized,{url:o})}else{p.destroy();f(n.WidgetFailed,{url:o})}})}function a(p,o,r){var s=d[o];if(s){var q=s.length,t;while(q--){t=s[q];if(t!==p){j[t].send(p,o,r)}}}}function l(o,q){var p=new easyXDM.Rpc({channel:"widget"+k++,local:b,remote:o,container:q.container||g,swf:e.swf,onReady:function(){m(p,o,q)}},{local:{subscribe:{isVoid:true,method:function(r){c(o,r)}},publish:{isVoid:true,method:function(r,s){a(o,r,s)}}},remote:{initialize:{},send:{isVoid:true}}})}this.addWidget=function(o,p){if(o in j){throw new Error("A widget with this url has already been initialized")}l(o,p)};this.removeWidget=function(p){if(p in j){for(var o in d){if(d.hasOwnProperty(o)){var r=d[o],q=r.length;while(q--){if(r[q]===p){r.splice(q,1);break}}}}j[p].destroy();delete j[p]}};this.publish=function(o,p){a("",o,p)};this.broadcast=function(p){for(var o in j){if(j.hasOwnPropert(o)){j[o].send({url:"",topic:"broadcast",data:p})}}}};easyXDM.Widget=function(c){var a=this;var b;var d=new easyXDM.Rpc({swf:c.swf},{remote:{subscribe:{isVoid:true},publish:{isVoid:true}},local:{initialize:{method:function(e){c.initialized(a,d);return{isInitialized:true,subscriptions:c.subscriptions}}},send:{isVoid:true,method:function(f,e,g){b(f,e,g)}}}});window.onunload=function(){d.destroy()};this.publish=function(e,f){d.publish(e,f)};this.subscribe=function(e){d.subscribe(e)};this.registerMessageHandler=function(e){b=e};c.initialize(this,d)};
js/bluepay_echeck/easyXDM/easyXDM.debug.js ADDED
@@ -0,0 +1,2848 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) {
2
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
3
+ /*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */
4
+ //
5
+ // easyXDM
6
+ // http://easyxdm.net/
7
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
8
+ //
9
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ // of this software and associated documentation files (the "Software"), to deal
11
+ // in the Software without restriction, including without limitation the rights
12
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ // copies of the Software, and to permit persons to whom the Software is
14
+ // furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ // THE SOFTWARE.
26
+ //
27
+
28
+ var global = this;
29
+ var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded
30
+ var emptyFn = Function.prototype;
31
+ var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4)
32
+ var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression
33
+ var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol
34
+ var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global)
35
+ var easyXDM = {};
36
+ var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite
37
+ var IFRAME_PREFIX = "easyXDM_";
38
+ var HAS_NAME_PROPERTY_BUG;
39
+ var useHash = false; // whether to use the hash over the query
40
+ var flashVersion; // will be set if using flash
41
+ var HAS_FLASH_THROTTLED_BUG;
42
+ var _trace = emptyFn;
43
+
44
+
45
+ // http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
46
+ function isHostMethod(object, property){
47
+ var t = typeof object[property];
48
+ return t == 'function' ||
49
+ (!!(t == 'object' && object[property])) ||
50
+ t == 'unknown';
51
+ }
52
+
53
+ function isHostObject(object, property){
54
+ return !!(typeof(object[property]) == 'object' && object[property]);
55
+ }
56
+
57
+ // end
58
+
59
+ // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
60
+ function isArray(o){
61
+ return Object.prototype.toString.call(o) === '[object Array]';
62
+ }
63
+
64
+ // end
65
+ function hasFlash(){
66
+ var name = "Shockwave Flash", mimeType = "application/x-shockwave-flash";
67
+
68
+ if (!undef(navigator.plugins) && typeof navigator.plugins[name] == "object") {
69
+ // adapted from the swfobject code
70
+ var description = navigator.plugins[name].description;
71
+ if (description && !undef(navigator.mimeTypes) && navigator.mimeTypes[mimeType] && navigator.mimeTypes[mimeType].enabledPlugin) {
72
+ flashVersion = description.match(/\d+/g);
73
+ }
74
+ }
75
+ if (!flashVersion) {
76
+ var flash;
77
+ try {
78
+ flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
79
+ flashVersion = Array.prototype.slice.call(flash.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1);
80
+ flash = null;
81
+ }
82
+ catch (notSupportedException) {
83
+ }
84
+ }
85
+ if (!flashVersion) {
86
+ return false;
87
+ }
88
+ var major = parseInt(flashVersion[0], 10), minor = parseInt(flashVersion[1], 10);
89
+ HAS_FLASH_THROTTLED_BUG = major > 9 && minor > 0;
90
+ return true;
91
+ }
92
+
93
+ /*
94
+ * Cross Browser implementation for adding and removing event listeners.
95
+ */
96
+ var on, un;
97
+ if (isHostMethod(window, "addEventListener")) {
98
+ on = function(target, type, listener){
99
+ _trace("adding listener " + type);
100
+ target.addEventListener(type, listener, false);
101
+ };
102
+ un = function(target, type, listener){
103
+ _trace("removing listener " + type);
104
+ target.removeEventListener(type, listener, false);
105
+ };
106
+ }
107
+ else if (isHostMethod(window, "attachEvent")) {
108
+ on = function(object, sEvent, fpNotify){
109
+ _trace("adding listener " + sEvent);
110
+ object.attachEvent("on" + sEvent, fpNotify);
111
+ };
112
+ un = function(object, sEvent, fpNotify){
113
+ _trace("removing listener " + sEvent);
114
+ object.detachEvent("on" + sEvent, fpNotify);
115
+ };
116
+ }
117
+ else {
118
+ throw new Error("Browser not supported");
119
+ }
120
+
121
+ /*
122
+ * Cross Browser implementation of DOMContentLoaded.
123
+ */
124
+ var domIsReady = false, domReadyQueue = [], readyState;
125
+ if ("readyState" in document) {
126
+ // If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and
127
+ // 'interactive' (HTML5 specs, recent WebKit builds) states.
128
+ // https://bugs.webkit.org/show_bug.cgi?id=45119
129
+ readyState = document.readyState;
130
+ domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive"));
131
+ }
132
+ else {
133
+ // If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately
134
+ // when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not.
135
+ // We only need a body to add elements to, so the existence of document.body is enough for us.
136
+ domIsReady = !!document.body;
137
+ }
138
+
139
+ function dom_onReady(){
140
+ if (domIsReady) {
141
+ return;
142
+ }
143
+ domIsReady = true;
144
+ _trace("firing dom_onReady");
145
+ for (var i = 0; i < domReadyQueue.length; i++) {
146
+ domReadyQueue[i]();
147
+ }
148
+ domReadyQueue.length = 0;
149
+ }
150
+
151
+
152
+ if (!domIsReady) {
153
+ if (isHostMethod(window, "addEventListener")) {
154
+ on(document, "DOMContentLoaded", dom_onReady);
155
+ }
156
+ else {
157
+ on(document, "readystatechange", function(){
158
+ if (document.readyState == "complete") {
159
+ dom_onReady();
160
+ }
161
+ });
162
+ if (document.documentElement.doScroll && window === top) {
163
+ var doScrollCheck = function(){
164
+ if (domIsReady) {
165
+ return;
166
+ }
167
+ // http://javascript.nwbox.com/IEContentLoaded/
168
+ try {
169
+ document.documentElement.doScroll("left");
170
+ }
171
+ catch (e) {
172
+ setTimeout(doScrollCheck, 1);
173
+ return;
174
+ }
175
+ dom_onReady();
176
+ };
177
+ doScrollCheck();
178
+ }
179
+ }
180
+
181
+ // A fallback to window.onload, that will always work
182
+ on(window, "load", dom_onReady);
183
+ }
184
+ /**
185
+ * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
186
+ * If functions are added after this event then they will be executed immediately.
187
+ * @param {function} fn The function to add
188
+ * @param {Object} scope An optional scope for the function to be called with.
189
+ */
190
+ function whenReady(fn, scope){
191
+ if (domIsReady) {
192
+ fn.call(scope);
193
+ return;
194
+ }
195
+ domReadyQueue.push(function(){
196
+ fn.call(scope);
197
+ });
198
+ }
199
+
200
+ /**
201
+ * Returns an instance of easyXDM from the parent window with
202
+ * respect to the namespace.
203
+ *
204
+ * @return An instance of easyXDM (in the parent window)
205
+ */
206
+ function getParentObject(){
207
+ var obj = parent;
208
+ if (namespace !== "") {
209
+ for (var i = 0, ii = namespace.split("."); i < ii.length; i++) {
210
+ if (!obj) {
211
+ throw new Error(ii.slice(0, i + 1).join('.') + ' is not an object');
212
+ }
213
+ obj = obj[ii[i]];
214
+ }
215
+ }
216
+ if (!obj || !obj.easyXDM) {
217
+ throw new Error('Could not find easyXDM in parent.' + namespace);
218
+ }
219
+ return obj.easyXDM;
220
+ }
221
+
222
+ /**
223
+ * Removes easyXDM variable from the global scope. It also returns control
224
+ * of the easyXDM variable to whatever code used it before.
225
+ *
226
+ * @param {String} ns A string representation of an object that will hold
227
+ * an instance of easyXDM.
228
+ * @return An instance of easyXDM
229
+ */
230
+ function noConflict(ns){
231
+ if (typeof ns != "string" || !ns) {
232
+ throw new Error('namespace must be a non-empty string');
233
+ }
234
+ _trace("Settings namespace to '" + ns + "'");
235
+
236
+ window.easyXDM = _easyXDM;
237
+ namespace = ns;
238
+ if (namespace) {
239
+ IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_";
240
+ }
241
+ return easyXDM;
242
+ }
243
+
244
+ /*
245
+ * Methods for working with URLs
246
+ */
247
+ /**
248
+ * Get the domain name from a url.
249
+ * @param {String} url The url to extract the domain from.
250
+ * @return The domain part of the url.
251
+ * @type {String}
252
+ */
253
+ function getDomainName(url){
254
+ if (!url) {
255
+ throw new Error("url is undefined or empty");
256
+ }
257
+ return url.match(reURI)[3];
258
+ }
259
+
260
+ /**
261
+ * Get the port for a given URL, or "" if none
262
+ * @param {String} url The url to extract the port from.
263
+ * @return The port part of the url.
264
+ * @type {String}
265
+ */
266
+ function getPort(url){
267
+ if (!url) {
268
+ throw new Error("url is undefined or empty");
269
+ }
270
+ return url.match(reURI)[4] || "";
271
+ }
272
+
273
+ /**
274
+ * Returns a string containing the schema, domain and if present the port
275
+ * @param {String} url The url to extract the location from
276
+ * @return {String} The location part of the url
277
+ */
278
+ function getLocation(url){
279
+ if (!url) {
280
+ throw new Error("url is undefined or empty");
281
+ }
282
+ if (/^file/.test(url)) {
283
+ throw new Error("The file:// protocol is not supported");
284
+ }
285
+ var m = url.toLowerCase().match(reURI);
286
+ var proto = m[2], domain = m[3], port = m[4] || "";
287
+ if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) {
288
+ port = "";
289
+ }
290
+ return proto + "//" + domain + port;
291
+ }
292
+
293
+ /**
294
+ * Resolves a relative url into an absolute one.
295
+ * @param {String} url The path to resolve.
296
+ * @return {String} The resolved url.
297
+ */
298
+ function resolveUrl(url){
299
+ if (!url) {
300
+ throw new Error("url is undefined or empty");
301
+ }
302
+
303
+ // replace all // except the one in proto with /
304
+ url = url.replace(reDoubleSlash, "$1/");
305
+
306
+ // If the url is a valid url we do nothing
307
+ if (!url.match(/^(http||https):\/\//)) {
308
+ // If this is a relative path
309
+ var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
310
+ if (path.substring(path.length - 1) !== "/") {
311
+ path = path.substring(0, path.lastIndexOf("/") + 1);
312
+ }
313
+
314
+ url = location.protocol + "//" + location.host + path + url;
315
+ }
316
+
317
+ // reduce all 'xyz/../' to just ''
318
+ while (reParent.test(url)) {
319
+ url = url.replace(reParent, "");
320
+ }
321
+
322
+ _trace("resolved url '" + url + "'");
323
+ return url;
324
+ }
325
+
326
+ /**
327
+ * Appends the parameters to the given url.<br/>
328
+ * The base url can contain existing query parameters.
329
+ * @param {String} url The base url.
330
+ * @param {Object} parameters The parameters to add.
331
+ * @return {String} A new valid url with the parameters appended.
332
+ */
333
+ function appendQueryParameters(url, parameters){
334
+ if (!parameters) {
335
+ throw new Error("parameters is undefined or null");
336
+ }
337
+
338
+ var hash = "", indexOf = url.indexOf("#");
339
+ if (indexOf !== -1) {
340
+ hash = url.substring(indexOf);
341
+ url = url.substring(0, indexOf);
342
+ }
343
+ var q = [];
344
+ for (var key in parameters) {
345
+ if (parameters.hasOwnProperty(key)) {
346
+ q.push(key + "=" + encodeURIComponent(parameters[key]));
347
+ }
348
+ }
349
+ return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash;
350
+ }
351
+
352
+
353
+ // build the query object either from location.query, if it contains the xdm_e argument, or from location.hash
354
+ var query = (function(input){
355
+ input = input.substring(1).split("&");
356
+ var data = {}, pair, i = input.length;
357
+ while (i--) {
358
+ pair = input[i].split("=");
359
+ data[pair[0]] = decodeURIComponent(pair[1]);
360
+ }
361
+ return data;
362
+ }(/xdm_e=/.test(location.search) ? location.search : location.hash));
363
+
364
+ /*
365
+ * Helper methods
366
+ */
367
+ /**
368
+ * Helper for checking if a variable/property is undefined
369
+ * @param {Object} v The variable to test
370
+ * @return {Boolean} True if the passed variable is undefined
371
+ */
372
+ function undef(v){
373
+ return typeof v === "undefined";
374
+ }
375
+
376
+ /**
377
+ * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
378
+ * @return {JSON} A valid JSON conforming object, or null if not found.
379
+ */
380
+ var getJSON = function(){
381
+ var cached = {};
382
+ var obj = {
383
+ a: [1, 2, 3]
384
+ }, json = "{\"a\":[1,2,3]}";
385
+
386
+ if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
387
+ // this is a working JSON instance
388
+ return JSON;
389
+ }
390
+ if (Object.toJSON) {
391
+ if (Object.toJSON(obj).replace((/\s/g), "") === json) {
392
+ // this is a working stringify method
393
+ cached.stringify = Object.toJSON;
394
+ }
395
+ }
396
+
397
+ if (typeof String.prototype.evalJSON === "function") {
398
+ obj = json.evalJSON();
399
+ if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
400
+ // this is a working parse method
401
+ cached.parse = function(str){
402
+ return str.evalJSON();
403
+ };
404
+ }
405
+ }
406
+
407
+ if (cached.stringify && cached.parse) {
408
+ // Only memoize the result if we have valid instance
409
+ getJSON = function(){
410
+ return cached;
411
+ };
412
+ return cached;
413
+ }
414
+ return null;
415
+ };
416
+
417
+ /**
418
+ * Applies properties from the source object to the target object.<br/>
419
+ * @param {Object} target The target of the properties.
420
+ * @param {Object} source The source of the properties.
421
+ * @param {Boolean} noOverwrite Set to True to only set non-existing properties.
422
+ */
423
+ function apply(destination, source, noOverwrite){
424
+ var member;
425
+ for (var prop in source) {
426
+ if (source.hasOwnProperty(prop)) {
427
+ if (prop in destination) {
428
+ member = source[prop];
429
+ if (typeof member === "object") {
430
+ apply(destination[prop], member, noOverwrite);
431
+ }
432
+ else if (!noOverwrite) {
433
+ destination[prop] = source[prop];
434
+ }
435
+ }
436
+ else {
437
+ destination[prop] = source[prop];
438
+ }
439
+ }
440
+ }
441
+ return destination;
442
+ }
443
+
444
+ // This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName].
445
+ function testForNamePropertyBug(){
446
+ var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
447
+ input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
448
+ HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
449
+ document.body.removeChild(form);
450
+ _trace("HAS_NAME_PROPERTY_BUG: " + HAS_NAME_PROPERTY_BUG);
451
+ }
452
+
453
+ /**
454
+ * Creates a frame and appends it to the DOM.
455
+ * @param config {object} This object can have the following properties
456
+ * <ul>
457
+ * <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
458
+ * <li> {object} attr The attributes that should be set on the frame.</li>
459
+ * <li> {DOMElement} container Its parent element (Optional).</li>
460
+ * <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
461
+ * </ul>
462
+ * @return The frames DOMElement
463
+ * @type DOMElement
464
+ */
465
+ function createFrame(config){
466
+ _trace("creating frame: " + config.props.src);
467
+ if (undef(HAS_NAME_PROPERTY_BUG)) {
468
+ testForNamePropertyBug();
469
+ }
470
+ var frame;
471
+ // This is to work around the problems in IE6/7 with setting the name property.
472
+ // Internally this is set as 'submitName' instead when using 'iframe.name = ...'
473
+ // This is not required by easyXDM itself, but is to facilitate other use cases
474
+ if (HAS_NAME_PROPERTY_BUG) {
475
+ frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
476
+ }
477
+ else {
478
+ frame = document.createElement("IFRAME");
479
+ frame.name = config.props.name;
480
+ }
481
+
482
+ frame.id = frame.name = config.props.name;
483
+ delete config.props.name;
484
+
485
+ if (typeof config.container == "string") {
486
+ config.container = document.getElementById(config.container);
487
+ }
488
+
489
+ if (!config.container) {
490
+ // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
491
+ apply(frame.style, {
492
+ position: "absolute",
493
+ top: "-2000px",
494
+ // Avoid potential horizontal scrollbar
495
+ left: "0px"
496
+ });
497
+ config.container = document.body;
498
+ }
499
+
500
+ // HACK: IE cannot have the src attribute set when the frame is appended
501
+ // into the container, so we set it to "javascript:false" as a
502
+ // placeholder for now. If we left the src undefined, it would
503
+ // instead default to "about:blank", which causes SSL mixed-content
504
+ // warnings in IE6 when on an SSL parent page.
505
+ var src = config.props.src;
506
+ config.props.src = "javascript:false";
507
+
508
+ // transfer properties to the frame
509
+ apply(frame, config.props);
510
+
511
+ frame.border = frame.frameBorder = 0;
512
+ frame.allowTransparency = true;
513
+ config.container.appendChild(frame);
514
+
515
+ if (config.onLoad) {
516
+ on(frame, "load", config.onLoad);
517
+ }
518
+
519
+ // set the frame URL to the proper value (we previously set it to
520
+ // "javascript:false" to work around the IE issue mentioned above)
521
+ if(config.usePost) {
522
+ var form = config.container.appendChild(document.createElement('form')), input;
523
+ form.target = frame.name;
524
+ form.action = src;
525
+ form.method = 'POST';
526
+ if (typeof(config.usePost) === 'object') {
527
+ for (var i in config.usePost) {
528
+ if (config.usePost.hasOwnProperty(i)) {
529
+ if (HAS_NAME_PROPERTY_BUG) {
530
+ input = document.createElement('<input name="' + i + '"/>');
531
+ } else {
532
+ input = document.createElement("INPUT");
533
+ input.name = i;
534
+ }
535
+ input.value = config.usePost[i];
536
+ form.appendChild(input);
537
+ }
538
+ }
539
+ }
540
+ form.submit();
541
+ form.parentNode.removeChild(form);
542
+ } else {
543
+ frame.src = src;
544
+ }
545
+ config.props.src = src;
546
+
547
+ return frame;
548
+ }
549
+
550
+ /**
551
+ * Check whether a domain is allowed using an Access Control List.
552
+ * The ACL can contain * and ? as wildcards, or can be regular expressions.
553
+ * If regular expressions they need to begin with ^ and end with $.
554
+ * @param {Array/String} acl The list of allowed domains
555
+ * @param {String} domain The domain to test.
556
+ * @return {Boolean} True if the domain is allowed, false if not.
557
+ */
558
+ function checkAcl(acl, domain){
559
+ // normalize into an array
560
+ if (typeof acl == "string") {
561
+ acl = [acl];
562
+ }
563
+ var re, i = acl.length;
564
+ while (i--) {
565
+ re = acl[i];
566
+ re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
567
+ if (re.test(domain)) {
568
+ return true;
569
+ }
570
+ }
571
+ return false;
572
+ }
573
+
574
+ /*
575
+ * Functions related to stacks
576
+ */
577
+ /**
578
+ * Prepares an array of stack-elements suitable for the current configuration
579
+ * @param {Object} config The Transports configuration. See easyXDM.Socket for more.
580
+ * @return {Array} An array of stack-elements with the TransportElement at index 0.
581
+ */
582
+ function prepareTransportStack(config){
583
+ var protocol = config.protocol, stackEls;
584
+ config.isHost = config.isHost || undef(query.xdm_p);
585
+ useHash = config.hash || false;
586
+ _trace("preparing transport stack");
587
+
588
+ if (!config.props) {
589
+ config.props = {};
590
+ }
591
+ if (!config.isHost) {
592
+ _trace("using parameters from query");
593
+ config.channel = query.xdm_c.replace(/["'<>\\]/g, "");
594
+ config.secret = query.xdm_s;
595
+ config.remote = query.xdm_e.replace(/["'<>\\]/g, "");
596
+ ;
597
+ protocol = query.xdm_p;
598
+ if (config.acl && !checkAcl(config.acl, config.remote)) {
599
+ throw new Error("Access denied for " + config.remote);
600
+ }
601
+ }
602
+ else {
603
+ config.remote = resolveUrl(config.remote);
604
+ config.channel = config.channel || "default" + channelId++;
605
+ config.secret = Math.random().toString(16).substring(2);
606
+ if (undef(protocol)) {
607
+ if (getLocation(location.href) == getLocation(config.remote)) {
608
+ /*
609
+ * Both documents has the same origin, lets use direct access.
610
+ */
611
+ protocol = "4";
612
+ }
613
+ else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) {
614
+ /*
615
+ * This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+
616
+ */
617
+ protocol = "1";
618
+ }
619
+ else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) {
620
+ /*
621
+ * The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS
622
+ */
623
+ protocol = "6";
624
+ }
625
+ else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) {
626
+ /*
627
+ * This is supported in Gecko (Firefox 1+)
628
+ */
629
+ protocol = "5";
630
+ }
631
+ else if (config.remoteHelper) {
632
+ /*
633
+ * This is supported in all browsers that retains the value of window.name when
634
+ * navigating from one domain to another, and where parent.frames[foo] can be used
635
+ * to get access to a frame from the same domain
636
+ */
637
+ protocol = "2";
638
+ }
639
+ else {
640
+ /*
641
+ * This is supported in all browsers where [window].location is writable for all
642
+ * The resize event will be used if resize is supported and the iframe is not put
643
+ * into a container, else polling will be used.
644
+ */
645
+ protocol = "0";
646
+ }
647
+ _trace("selecting protocol: " + protocol);
648
+ }
649
+ else {
650
+ _trace("using protocol: " + protocol);
651
+ }
652
+ }
653
+ config.protocol = protocol; // for conditional branching
654
+ switch (protocol) {
655
+ case "0":// 0 = HashTransport
656
+ apply(config, {
657
+ interval: 100,
658
+ delay: 2000,
659
+ useResize: true,
660
+ useParent: false,
661
+ usePolling: false
662
+ }, true);
663
+ if (config.isHost) {
664
+ if (!config.local) {
665
+ _trace("looking for image to use as local");
666
+ // If no local is set then we need to find an image hosted on the current domain
667
+ var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image;
668
+ var i = images.length;
669
+ while (i--) {
670
+ image = images[i];
671
+ if (image.src.substring(0, domain.length) === domain) {
672
+ config.local = image.src;
673
+ break;
674
+ }
675
+ }
676
+ if (!config.local) {
677
+ _trace("no image found, defaulting to using the window");
678
+ // If no local was set, and we are unable to find a suitable file, then we resort to using the current window
679
+ config.local = window;
680
+ }
681
+ }
682
+
683
+ var parameters = {
684
+ xdm_c: config.channel,
685
+ xdm_p: 0
686
+ };
687
+
688
+ if (config.local === window) {
689
+ // We are using the current window to listen to
690
+ config.usePolling = true;
691
+ config.useParent = true;
692
+ config.local = location.protocol + "//" + location.host + location.pathname + location.search;
693
+ parameters.xdm_e = config.local;
694
+ parameters.xdm_pa = 1; // use parent
695
+ }
696
+ else {
697
+ parameters.xdm_e = resolveUrl(config.local);
698
+ }
699
+
700
+ if (config.container) {
701
+ config.useResize = false;
702
+ parameters.xdm_po = 1; // use polling
703
+ }
704
+ config.remote = appendQueryParameters(config.remote, parameters);
705
+ }
706
+ else {
707
+ apply(config, {
708
+ channel: query.xdm_c,
709
+ remote: query.xdm_e,
710
+ useParent: !undef(query.xdm_pa),
711
+ usePolling: !undef(query.xdm_po),
712
+ useResize: config.useParent ? false : config.useResize
713
+ });
714
+ }
715
+ stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({
716
+ encode: true,
717
+ maxLength: 4000 - config.remote.length
718
+ }), new easyXDM.stack.VerifyBehavior({
719
+ initiate: config.isHost
720
+ })];
721
+ break;
722
+ case "1":
723
+ stackEls = [new easyXDM.stack.PostMessageTransport(config)];
724
+ break;
725
+ case "2":
726
+ config.remoteHelper = resolveUrl(config.remoteHelper);
727
+ stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({
728
+ initiate: config.isHost
729
+ })];
730
+ break;
731
+ case "3":
732
+ stackEls = [new easyXDM.stack.NixTransport(config)];
733
+ break;
734
+ case "4":
735
+ stackEls = [new easyXDM.stack.SameOriginTransport(config)];
736
+ break;
737
+ case "5":
738
+ stackEls = [new easyXDM.stack.FrameElementTransport(config)];
739
+ break;
740
+ case "6":
741
+ if (!flashVersion) {
742
+ hasFlash();
743
+ }
744
+ stackEls = [new easyXDM.stack.FlashTransport(config)];
745
+ break;
746
+ }
747
+ // this behavior is responsible for buffering outgoing messages, and for performing lazy initialization
748
+ stackEls.push(new easyXDM.stack.QueueBehavior({
749
+ lazy: config.lazy,
750
+ remove: true
751
+ }));
752
+ return stackEls;
753
+ }
754
+
755
+ /**
756
+ * Chains all the separate stack elements into a single usable stack.<br/>
757
+ * If an element is missing a necessary method then it will have a pass-through method applied.
758
+ * @param {Array} stackElements An array of stack elements to be linked.
759
+ * @return {easyXDM.stack.StackElement} The last element in the chain.
760
+ */
761
+ function chainStack(stackElements){
762
+ var stackEl, defaults = {
763
+ incoming: function(message, origin){
764
+ this.up.incoming(message, origin);
765
+ },
766
+ outgoing: function(message, recipient){
767
+ this.down.outgoing(message, recipient);
768
+ },
769
+ callback: function(success){
770
+ this.up.callback(success);
771
+ },
772
+ init: function(){
773
+ this.down.init();
774
+ },
775
+ destroy: function(){
776
+ this.down.destroy();
777
+ }
778
+ };
779
+ for (var i = 0, len = stackElements.length; i < len; i++) {
780
+ stackEl = stackElements[i];
781
+ apply(stackEl, defaults, true);
782
+ if (i !== 0) {
783
+ stackEl.down = stackElements[i - 1];
784
+ }
785
+ if (i !== len - 1) {
786
+ stackEl.up = stackElements[i + 1];
787
+ }
788
+ }
789
+ return stackEl;
790
+ }
791
+
792
+ /**
793
+ * This will remove a stackelement from its stack while leaving the stack functional.
794
+ * @param {Object} element The elment to remove from the stack.
795
+ */
796
+ function removeFromStack(element){
797
+ element.up.down = element.down;
798
+ element.down.up = element.up;
799
+ element.up = element.down = null;
800
+ }
801
+
802
+ /*
803
+ * Export the main object and any other methods applicable
804
+ */
805
+ /**
806
+ * @class easyXDM
807
+ * A javascript library providing cross-browser, cross-domain messaging/RPC.
808
+ * @version 2.4.17.0
809
+ * @singleton
810
+ */
811
+ apply(easyXDM, {
812
+ /**
813
+ * The version of the library
814
+ * @type {string}
815
+ */
816
+ version: "2.4.17.0",
817
+ /**
818
+ * This is a map containing all the query parameters passed to the document.
819
+ * All the values has been decoded using decodeURIComponent.
820
+ * @type {object}
821
+ */
822
+ query: query,
823
+ /**
824
+ * @private
825
+ */
826
+ stack: {},
827
+ /**
828
+ * Applies properties from the source object to the target object.<br/>
829
+ * @param {object} target The target of the properties.
830
+ * @param {object} source The source of the properties.
831
+ * @param {boolean} noOverwrite Set to True to only set non-existing properties.
832
+ */
833
+ apply: apply,
834
+
835
+ /**
836
+ * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
837
+ * @return {JSON} A valid JSON conforming object, or null if not found.
838
+ */
839
+ getJSONObject: getJSON,
840
+ /**
841
+ * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
842
+ * If functions are added after this event then they will be executed immediately.
843
+ * @param {function} fn The function to add
844
+ * @param {object} scope An optional scope for the function to be called with.
845
+ */
846
+ whenReady: whenReady,
847
+ /**
848
+ * Removes easyXDM variable from the global scope. It also returns control
849
+ * of the easyXDM variable to whatever code used it before.
850
+ *
851
+ * @param {String} ns A string representation of an object that will hold
852
+ * an instance of easyXDM.
853
+ * @return An instance of easyXDM
854
+ */
855
+ noConflict: noConflict
856
+ });
857
+
858
+ // Expose helper functions so we can test them
859
+ apply(easyXDM, {
860
+ checkAcl: checkAcl,
861
+ getDomainName: getDomainName,
862
+ getLocation: getLocation,
863
+ appendQueryParameters: appendQueryParameters
864
+ });
865
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
866
+ /*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */
867
+ //
868
+ // easyXDM
869
+ // http://easyxdm.net/
870
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
871
+ //
872
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
873
+ // of this software and associated documentation files (the "Software"), to deal
874
+ // in the Software without restriction, including without limitation the rights
875
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
876
+ // copies of the Software, and to permit persons to whom the Software is
877
+ // furnished to do so, subject to the following conditions:
878
+ //
879
+ // The above copyright notice and this permission notice shall be included in
880
+ // all copies or substantial portions of the Software.
881
+ //
882
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
883
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
884
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
885
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
886
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
887
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
888
+ // THE SOFTWARE.
889
+ //
890
+
891
+ var debug = {
892
+ _deferred: [],
893
+ flush: function(){
894
+ this.trace("... deferred messages ...");
895
+ for (var i = 0, len = this._deferred.length; i < len; i++) {
896
+ this.trace(this._deferred[i]);
897
+ }
898
+ this._deferred.length = 0;
899
+ this.trace("... end of deferred messages ...");
900
+ },
901
+ getTime: function(){
902
+ var d = new Date(), h = d.getHours() + "", m = d.getMinutes() + "", s = d.getSeconds() + "", ms = d.getMilliseconds() + "", zeros = "000";
903
+ if (h.length == 1) {
904
+ h = "0" + h;
905
+ }
906
+ if (m.length == 1) {
907
+ m = "0" + m;
908
+ }
909
+ if (s.length == 1) {
910
+ s = "0" + s;
911
+ }
912
+ ms = zeros.substring(ms.length) + ms;
913
+ return h + ":" + m + ":" + s + "." + ms;
914
+ },
915
+ /**
916
+ * Logs the message to console.log if available
917
+ * @param {String} msg The message to log
918
+ */
919
+ log: function(msg){
920
+ // Uses memoizing to cache the implementation
921
+ if (!isHostObject(window, "console") || undef(console.log)) {
922
+ /**
923
+ * Sets log to be an empty function since we have no output available
924
+ * @ignore
925
+ */
926
+ this.log = emptyFn;
927
+ }
928
+ else {
929
+ /**
930
+ * Sets log to be a wrapper around console.log
931
+ * @ignore
932
+ * @param {String} msg
933
+ */
934
+ this.log = function(msg){
935
+ console.log(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ": " + msg);
936
+ };
937
+ }
938
+ this.log(msg);
939
+ },
940
+ /**
941
+ * Will try to trace the given message either to a DOMElement with the id "log",
942
+ * or by using console.info.
943
+ * @param {String} msg The message to trace
944
+ */
945
+ trace: function(msg){
946
+ // Uses memoizing to cache the implementation
947
+ if (!domIsReady) {
948
+ if (this._deferred.length === 0) {
949
+ easyXDM.whenReady(debug.flush, debug);
950
+ }
951
+ this._deferred.push(msg);
952
+ this.log(msg);
953
+ }
954
+ else {
955
+ var el = document.getElementById("log");
956
+ // is there a log element present?
957
+ if (el) {
958
+ /**
959
+ * Sets trace to be a function that outputs the messages to the DOMElement with id "log"
960
+ * @ignore
961
+ * @param {String} msg
962
+ */
963
+ this.trace = function(msg){
964
+ try {
965
+ el.appendChild(document.createElement("div")).appendChild(document.createTextNode(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg));
966
+ el.scrollTop = el.scrollHeight;
967
+ }
968
+ catch (e) {
969
+ //In case we are unloading
970
+ }
971
+ };
972
+ }
973
+ else if (isHostObject(window, "console") && !undef(console.info)) {
974
+ /**
975
+ * Sets trace to be a wrapper around console.info
976
+ * @ignore
977
+ * @param {String} msg
978
+ */
979
+ this.trace = function(msg){
980
+ console.info(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg);
981
+ };
982
+ }
983
+ else {
984
+ /**
985
+ * Create log window
986
+ * @ignore
987
+ */
988
+ var domain = location.host, windowname = domain.replace(/[\-.:]/g, "") + "easyxdm_log", logWin;
989
+ try {
990
+ logWin = window.open("", windowname, "width=800,height=200,status=0,navigation=0,scrollbars=1");
991
+ }
992
+ catch (e) {
993
+ }
994
+ if (logWin) {
995
+ var doc = logWin.document;
996
+ el = doc.getElementById("log");
997
+ if (!el) {
998
+ doc.write("<html><head><title>easyXDM log " + domain + "</title></head>");
999
+ doc.write("<body><div id=\"log\"></div></body></html>");
1000
+ doc.close();
1001
+ el = doc.getElementById("log");
1002
+ }
1003
+ this.trace = function(msg){
1004
+ try {
1005
+ el.appendChild(doc.createElement("div")).appendChild(doc.createTextNode(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg));
1006
+ el.scrollTop = el.scrollHeight;
1007
+ }
1008
+ catch (e) {
1009
+ //In case we are unloading
1010
+ }
1011
+ };
1012
+ this.trace("---- new logger at " + location.href);
1013
+ }
1014
+
1015
+ if (!el) {
1016
+ // We are unable to use any logging
1017
+ this.trace = emptyFn;
1018
+ }
1019
+ }
1020
+ this.trace(msg);
1021
+ }
1022
+ },
1023
+ /**
1024
+ * Creates a method usable for tracing.
1025
+ * @param {String} name The name the messages should be marked with
1026
+ * @return {Function} A function that accepts a single string as argument.
1027
+ */
1028
+ getTracer: function(name){
1029
+ return function(msg){
1030
+ debug.trace(name + ": " + msg);
1031
+ };
1032
+ }
1033
+ };
1034
+ debug.log("easyXDM present on '" + location.href);
1035
+ easyXDM.Debug = debug;
1036
+ _trace = debug.getTracer("{Private}");
1037
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1038
+ /*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */
1039
+ //
1040
+ // easyXDM
1041
+ // http://easyxdm.net/
1042
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1043
+ //
1044
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1045
+ // of this software and associated documentation files (the "Software"), to deal
1046
+ // in the Software without restriction, including without limitation the rights
1047
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1048
+ // copies of the Software, and to permit persons to whom the Software is
1049
+ // furnished to do so, subject to the following conditions:
1050
+ //
1051
+ // The above copyright notice and this permission notice shall be included in
1052
+ // all copies or substantial portions of the Software.
1053
+ //
1054
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1055
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1056
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1057
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1058
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1059
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1060
+ // THE SOFTWARE.
1061
+ //
1062
+
1063
+ /**
1064
+ * @class easyXDM.DomHelper
1065
+ * Contains methods for dealing with the DOM
1066
+ * @singleton
1067
+ */
1068
+ easyXDM.DomHelper = {
1069
+ /**
1070
+ * Provides a consistent interface for adding eventhandlers
1071
+ * @param {Object} target The target to add the event to
1072
+ * @param {String} type The name of the event
1073
+ * @param {Function} listener The listener
1074
+ */
1075
+ on: on,
1076
+ /**
1077
+ * Provides a consistent interface for removing eventhandlers
1078
+ * @param {Object} target The target to remove the event from
1079
+ * @param {String} type The name of the event
1080
+ * @param {Function} listener The listener
1081
+ */
1082
+ un: un,
1083
+ /**
1084
+ * Checks for the presence of the JSON object.
1085
+ * If it is not present it will use the supplied path to load the JSON2 library.
1086
+ * This should be called in the documents head right after the easyXDM script tag.
1087
+ * http://json.org/json2.js
1088
+ * @param {String} path A valid path to json2.js
1089
+ */
1090
+ requiresJSON: function(path){
1091
+ if (!isHostObject(window, "JSON")) {
1092
+ debug.log("loading external JSON");
1093
+ // we need to encode the < in order to avoid an illegal token error
1094
+ // when the script is inlined in a document.
1095
+ document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
1096
+ }
1097
+ else {
1098
+ debug.log("native JSON found");
1099
+ }
1100
+ }
1101
+ };
1102
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1103
+ /*global easyXDM, window, escape, unescape, debug */
1104
+ //
1105
+ // easyXDM
1106
+ // http://easyxdm.net/
1107
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1108
+ //
1109
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1110
+ // of this software and associated documentation files (the "Software"), to deal
1111
+ // in the Software without restriction, including without limitation the rights
1112
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1113
+ // copies of the Software, and to permit persons to whom the Software is
1114
+ // furnished to do so, subject to the following conditions:
1115
+ //
1116
+ // The above copyright notice and this permission notice shall be included in
1117
+ // all copies or substantial portions of the Software.
1118
+ //
1119
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1120
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1121
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1122
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1123
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1124
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1125
+ // THE SOFTWARE.
1126
+ //
1127
+
1128
+ (function(){
1129
+ // The map containing the stored functions
1130
+ var _map = {};
1131
+
1132
+ /**
1133
+ * @class easyXDM.Fn
1134
+ * This contains methods related to function handling, such as storing callbacks.
1135
+ * @singleton
1136
+ * @namespace easyXDM
1137
+ */
1138
+ easyXDM.Fn = {
1139
+ /**
1140
+ * Stores a function using the given name for reference
1141
+ * @param {String} name The name that the function should be referred by
1142
+ * @param {Function} fn The function to store
1143
+ * @namespace easyXDM.fn
1144
+ */
1145
+ set: function(name, fn){
1146
+ this._trace("storing function " + name);
1147
+ _map[name] = fn;
1148
+ },
1149
+ /**
1150
+ * Retrieves the function referred to by the given name
1151
+ * @param {String} name The name of the function to retrieve
1152
+ * @param {Boolean} del If the function should be deleted after retrieval
1153
+ * @return {Function} The stored function
1154
+ * @namespace easyXDM.fn
1155
+ */
1156
+ get: function(name, del){
1157
+ this._trace("retrieving function " + name);
1158
+ var fn = _map[name];
1159
+ if (!fn) {
1160
+ this._trace(name + " not found");
1161
+ }
1162
+
1163
+ if (del) {
1164
+ delete _map[name];
1165
+ }
1166
+ return fn;
1167
+ }
1168
+ };
1169
+
1170
+ easyXDM.Fn._trace = debug.getTracer("easyXDM.Fn");
1171
+ }());
1172
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1173
+ /*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */
1174
+ //
1175
+ // easyXDM
1176
+ // http://easyxdm.net/
1177
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1178
+ //
1179
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1180
+ // of this software and associated documentation files (the "Software"), to deal
1181
+ // in the Software without restriction, including without limitation the rights
1182
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1183
+ // copies of the Software, and to permit persons to whom the Software is
1184
+ // furnished to do so, subject to the following conditions:
1185
+ //
1186
+ // The above copyright notice and this permission notice shall be included in
1187
+ // all copies or substantial portions of the Software.
1188
+ //
1189
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1190
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1191
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1192
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1193
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1194
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1195
+ // THE SOFTWARE.
1196
+ //
1197
+
1198
+ /**
1199
+ * @class easyXDM.Socket
1200
+ * This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/>
1201
+ * The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/>
1202
+ * Internally different stacks will be used depending on the browsers features and the available parameters.
1203
+ * <h2>How to set up</h2>
1204
+ * Setting up the provider:
1205
+ * <pre><code>
1206
+ * var socket = new easyXDM.Socket({
1207
+ * &nbsp; local: "name.html",
1208
+ * &nbsp; onReady: function(){
1209
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
1210
+ * &nbsp; &nbsp; socket.postMessage("foo-message");
1211
+ * &nbsp; },
1212
+ * &nbsp; onMessage: function(message, origin) {
1213
+ * &nbsp;&nbsp; alert("received " + message + " from " + origin);
1214
+ * &nbsp; }
1215
+ * });
1216
+ * </code></pre>
1217
+ * Setting up the consumer:
1218
+ * <pre><code>
1219
+ * var socket = new easyXDM.Socket({
1220
+ * &nbsp; remote: "http:&#47;&#47;remotedomain/page.html",
1221
+ * &nbsp; remoteHelper: "http:&#47;&#47;remotedomain/name.html",
1222
+ * &nbsp; onReady: function(){
1223
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
1224
+ * &nbsp; &nbsp; socket.postMessage("foo-message");
1225
+ * &nbsp; },
1226
+ * &nbsp; onMessage: function(message, origin) {
1227
+ * &nbsp;&nbsp; alert("received " + message + " from " + origin);
1228
+ * &nbsp; }
1229
+ * });
1230
+ * </code></pre>
1231
+ * If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property
1232
+ * and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports.
1233
+ * @namespace easyXDM
1234
+ * @constructor
1235
+ * @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window.
1236
+ * @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed.
1237
+ * @cfg {String} remote (Consumer only) The url to the providers document.
1238
+ * @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional.
1239
+ * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000.
1240
+ * @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300.
1241
+ * @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional.
1242
+ * @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional.
1243
+ * @cfg {Function} onReady A method that should be called when the transport is ready. Optional.
1244
+ * @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional.
1245
+ * @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/>
1246
+ * This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $.
1247
+ * If none of the patterns match an Error will be thrown.
1248
+ * @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>.
1249
+ * Properties such as 'name' and 'src' will be overrided. Optional.
1250
+ */
1251
+ easyXDM.Socket = function(config){
1252
+ var trace = debug.getTracer("easyXDM.Socket");
1253
+ trace("constructor");
1254
+
1255
+ // create the stack
1256
+ var stack = chainStack(prepareTransportStack(config).concat([{
1257
+ incoming: function(message, origin){
1258
+ config.onMessage(message, origin);
1259
+ },
1260
+ callback: function(success){
1261
+ if (config.onReady) {
1262
+ config.onReady(success);
1263
+ }
1264
+ }
1265
+ }])), recipient = getLocation(config.remote);
1266
+
1267
+ // set the origin
1268
+ this.origin = getLocation(config.remote);
1269
+
1270
+ /**
1271
+ * Initiates the destruction of the stack.
1272
+ */
1273
+ this.destroy = function(){
1274
+ stack.destroy();
1275
+ };
1276
+
1277
+ /**
1278
+ * Posts a message to the remote end of the channel
1279
+ * @param {String} message The message to send
1280
+ */
1281
+ this.postMessage = function(message){
1282
+ stack.outgoing(message, recipient);
1283
+ };
1284
+
1285
+ stack.init();
1286
+ };
1287
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1288
+ /*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */
1289
+ //
1290
+ // easyXDM
1291
+ // http://easyxdm.net/
1292
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1293
+ //
1294
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1295
+ // of this software and associated documentation files (the "Software"), to deal
1296
+ // in the Software without restriction, including without limitation the rights
1297
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1298
+ // copies of the Software, and to permit persons to whom the Software is
1299
+ // furnished to do so, subject to the following conditions:
1300
+ //
1301
+ // The above copyright notice and this permission notice shall be included in
1302
+ // all copies or substantial portions of the Software.
1303
+ //
1304
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1305
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1306
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1307
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1308
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1309
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1310
+ // THE SOFTWARE.
1311
+ //
1312
+
1313
+ /**
1314
+ * @class easyXDM.Rpc
1315
+ * Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation
1316
+ * of methods to be called from the remote end.<br/>
1317
+ * The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/>
1318
+ * This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods.
1319
+ * <h2>How to set up</h2>
1320
+ * <pre><code>
1321
+ * var rpc = new easyXDM.Rpc({
1322
+ * &nbsp; &#47;&#47; this configuration is equal to that used by the Socket.
1323
+ * &nbsp; remote: "http:&#47;&#47;remotedomain/...",
1324
+ * &nbsp; onReady: function(){
1325
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the proxy
1326
+ * &nbsp; &nbsp; rpc.foo(...
1327
+ * &nbsp; }
1328
+ * },{
1329
+ * &nbsp; local: {..},
1330
+ * &nbsp; remote: {..}
1331
+ * });
1332
+ * </code></pre>
1333
+ *
1334
+ * <h2>Exposing functions (procedures)</h2>
1335
+ * <pre><code>
1336
+ * var rpc = new easyXDM.Rpc({
1337
+ * &nbsp; ...
1338
+ * },{
1339
+ * &nbsp; local: {
1340
+ * &nbsp; &nbsp; nameOfMethod: {
1341
+ * &nbsp; &nbsp; &nbsp; method: function(arg1, arg2, success, error){
1342
+ * &nbsp; &nbsp; &nbsp; &nbsp; ...
1343
+ * &nbsp; &nbsp; &nbsp; }
1344
+ * &nbsp; &nbsp; },
1345
+ * &nbsp; &nbsp; &#47;&#47; with shorthand notation
1346
+ * &nbsp; &nbsp; nameOfAnotherMethod: function(arg1, arg2, success, error){
1347
+ * &nbsp; &nbsp; }
1348
+ * &nbsp; },
1349
+ * &nbsp; remote: {...}
1350
+ * });
1351
+ * </code></pre>
1352
+
1353
+ * The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/>
1354
+ * To send a successfull result back you can use
1355
+ * <pre><code>
1356
+ * return foo;
1357
+ * </pre></code>
1358
+ * or
1359
+ * <pre><code>
1360
+ * success(foo);
1361
+ * </pre></code>
1362
+ * To return an error you can use
1363
+ * <pre><code>
1364
+ * throw new Error("foo error");
1365
+ * </code></pre>
1366
+ * or
1367
+ * <pre><code>
1368
+ * error("foo error");
1369
+ * </code></pre>
1370
+ *
1371
+ * <h2>Defining remotely exposed methods (procedures/notifications)</h2>
1372
+ * The definition of the remote end is quite similar:
1373
+ * <pre><code>
1374
+ * var rpc = new easyXDM.Rpc({
1375
+ * &nbsp; ...
1376
+ * },{
1377
+ * &nbsp; local: {...},
1378
+ * &nbsp; remote: {
1379
+ * &nbsp; &nbsp; nameOfMethod: {}
1380
+ * &nbsp; }
1381
+ * });
1382
+ * </code></pre>
1383
+ * To call a remote method use
1384
+ * <pre><code>
1385
+ * rpc.nameOfMethod("arg1", "arg2", function(value) {
1386
+ * &nbsp; alert("success: " + value);
1387
+ * }, function(message) {
1388
+ * &nbsp; alert("error: " + message + );
1389
+ * });
1390
+ * </code></pre>
1391
+ * Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/>
1392
+ * When called with no callback a JSON-RPC 2.0 notification will be executed.
1393
+ * Be aware that you will not be notified of any errors with this method.
1394
+ * <br/>
1395
+ * <h2>Specifying a custom serializer</h2>
1396
+ * If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library
1397
+ * then you can specify a custom serializer using <code>serializer: foo</code>
1398
+ * <pre><code>
1399
+ * var rpc = new easyXDM.Rpc({
1400
+ * &nbsp; ...
1401
+ * },{
1402
+ * &nbsp; local: {...},
1403
+ * &nbsp; remote: {...},
1404
+ * &nbsp; serializer : {
1405
+ * &nbsp; &nbsp; parse: function(string){ ... },
1406
+ * &nbsp; &nbsp; stringify: function(object) {...}
1407
+ * &nbsp; }
1408
+ * });
1409
+ * </code></pre>
1410
+ * If <code>serializer</code> is set then the class will not attempt to use the native implementation.
1411
+ * @namespace easyXDM
1412
+ * @constructor
1413
+ * @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters.
1414
+ * @param {Object} jsonRpcConfig The description of the interface to implement.
1415
+ */
1416
+ easyXDM.Rpc = function(config, jsonRpcConfig){
1417
+ var trace = debug.getTracer("easyXDM.Rpc");
1418
+ trace("constructor");
1419
+
1420
+ // expand shorthand notation
1421
+ if (jsonRpcConfig.local) {
1422
+ for (var method in jsonRpcConfig.local) {
1423
+ if (jsonRpcConfig.local.hasOwnProperty(method)) {
1424
+ var member = jsonRpcConfig.local[method];
1425
+ if (typeof member === "function") {
1426
+ jsonRpcConfig.local[method] = {
1427
+ method: member
1428
+ };
1429
+ }
1430
+ }
1431
+ }
1432
+ }
1433
+
1434
+ // create the stack
1435
+ var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), {
1436
+ callback: function(success){
1437
+ if (config.onReady) {
1438
+ config.onReady(success);
1439
+ }
1440
+ }
1441
+ }]));
1442
+
1443
+ // set the origin
1444
+ this.origin = getLocation(config.remote);
1445
+
1446
+
1447
+ /**
1448
+ * Initiates the destruction of the stack.
1449
+ */
1450
+ this.destroy = function(){
1451
+ stack.destroy();
1452
+ };
1453
+
1454
+ stack.init();
1455
+ };
1456
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1457
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/
1458
+ //
1459
+ // easyXDM
1460
+ // http://easyxdm.net/
1461
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1462
+ //
1463
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1464
+ // of this software and associated documentation files (the "Software"), to deal
1465
+ // in the Software without restriction, including without limitation the rights
1466
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1467
+ // copies of the Software, and to permit persons to whom the Software is
1468
+ // furnished to do so, subject to the following conditions:
1469
+ //
1470
+ // The above copyright notice and this permission notice shall be included in
1471
+ // all copies or substantial portions of the Software.
1472
+ //
1473
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1474
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1475
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1476
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1477
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1478
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1479
+ // THE SOFTWARE.
1480
+ //
1481
+
1482
+ /**
1483
+ * @class easyXDM.stack.SameOriginTransport
1484
+ * SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/>
1485
+ * This can be useful for testing and for when the main application supports both internal and external sources.
1486
+ * @namespace easyXDM.stack
1487
+ * @constructor
1488
+ * @param {Object} config The transports configuration.
1489
+ * @cfg {String} remote The remote document to communicate with.
1490
+ */
1491
+ easyXDM.stack.SameOriginTransport = function(config){
1492
+ var trace = debug.getTracer("easyXDM.stack.SameOriginTransport");
1493
+ trace("constructor");
1494
+ var pub, frame, send, targetOrigin;
1495
+
1496
+ return (pub = {
1497
+ outgoing: function(message, domain, fn){
1498
+ send(message);
1499
+ if (fn) {
1500
+ fn();
1501
+ }
1502
+ },
1503
+ destroy: function(){
1504
+ trace("destroy");
1505
+ if (frame) {
1506
+ frame.parentNode.removeChild(frame);
1507
+ frame = null;
1508
+ }
1509
+ },
1510
+ onDOMReady: function(){
1511
+ trace("init");
1512
+ targetOrigin = getLocation(config.remote);
1513
+
1514
+ if (config.isHost) {
1515
+ // set up the iframe
1516
+ apply(config.props, {
1517
+ src: appendQueryParameters(config.remote, {
1518
+ xdm_e: location.protocol + "//" + location.host + location.pathname,
1519
+ xdm_c: config.channel,
1520
+ xdm_p: 4 // 4 = SameOriginTransport
1521
+ }),
1522
+ name: IFRAME_PREFIX + config.channel + "_provider"
1523
+ });
1524
+ frame = createFrame(config);
1525
+ easyXDM.Fn.set(config.channel, function(sendFn){
1526
+ send = sendFn;
1527
+ setTimeout(function(){
1528
+ pub.up.callback(true);
1529
+ }, 0);
1530
+ return function(msg){
1531
+ pub.up.incoming(msg, targetOrigin);
1532
+ };
1533
+ });
1534
+ }
1535
+ else {
1536
+ send = getParentObject().Fn.get(config.channel, true)(function(msg){
1537
+ pub.up.incoming(msg, targetOrigin);
1538
+ });
1539
+ setTimeout(function(){
1540
+ pub.up.callback(true);
1541
+ }, 0);
1542
+ }
1543
+ },
1544
+ init: function(){
1545
+ whenReady(pub.onDOMReady, pub);
1546
+ }
1547
+ });
1548
+ };
1549
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1550
+ /*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/
1551
+ //
1552
+ // easyXDM
1553
+ // http://easyxdm.net/
1554
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1555
+ //
1556
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1557
+ // of this software and associated documentation files (the "Software"), to deal
1558
+ // in the Software without restriction, including without limitation the rights
1559
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1560
+ // copies of the Software, and to permit persons to whom the Software is
1561
+ // furnished to do so, subject to the following conditions:
1562
+ //
1563
+ // The above copyright notice and this permission notice shall be included in
1564
+ // all copies or substantial portions of the Software.
1565
+ //
1566
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1567
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1568
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1569
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1570
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1571
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1572
+ // THE SOFTWARE.
1573
+ //
1574
+
1575
+ /**
1576
+ * @class easyXDM.stack.FlashTransport
1577
+ * FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth.
1578
+ * @namespace easyXDM.stack
1579
+ * @constructor
1580
+ * @param {Object} config The transports configuration.
1581
+ * @cfg {String} remote The remote domain to communicate with.
1582
+ * @cfg {String} secret the pre-shared secret used to secure the communication.
1583
+ * @cfg {String} swf The path to the swf file
1584
+ * @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden.
1585
+ * @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed
1586
+ */
1587
+ easyXDM.stack.FlashTransport = function(config){
1588
+ var trace = debug.getTracer("easyXDM.stack.FlashTransport");
1589
+ trace("constructor");
1590
+ if (!config.swf) {
1591
+ throw new Error("Path to easyxdm.swf is missing");
1592
+ }
1593
+ var pub, // the public interface
1594
+ frame, send, targetOrigin, swf, swfContainer;
1595
+
1596
+ function onMessage(message, origin){
1597
+ setTimeout(function(){
1598
+ trace("received message");
1599
+ pub.up.incoming(message, targetOrigin);
1600
+ }, 0);
1601
+ }
1602
+
1603
+ /**
1604
+ * This method adds the SWF to the DOM and prepares the initialization of the channel
1605
+ */
1606
+ function addSwf(domain){
1607
+ trace("creating factory with SWF from " + domain);
1608
+ // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.
1609
+ var url = config.swf + "?host=" + config.isHost;
1610
+ var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000);
1611
+
1612
+ // prepare the init function that will fire once the swf is ready
1613
+ easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){
1614
+ easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild;
1615
+ var queue = easyXDM.stack.FlashTransport[domain].queue;
1616
+ for (var i = 0; i < queue.length; i++) {
1617
+ queue[i]();
1618
+ }
1619
+ queue.length = 0;
1620
+ });
1621
+
1622
+ if (config.swfContainer) {
1623
+ swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer;
1624
+ }
1625
+ else {
1626
+ // create the container that will hold the swf
1627
+ swfContainer = document.createElement('div');
1628
+
1629
+ // http://bugs.adobe.com/jira/browse/FP-4796
1630
+ // http://tech.groups.yahoo.com/group/flexcoders/message/162365
1631
+ // https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc
1632
+ apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? {
1633
+ height: "20px",
1634
+ width: "20px",
1635
+ position: "fixed",
1636
+ right: 0,
1637
+ top: 0
1638
+ } : {
1639
+ height: "1px",
1640
+ width: "1px",
1641
+ position: "absolute",
1642
+ overflow: "hidden",
1643
+ right: 0,
1644
+ top: 0
1645
+ });
1646
+ document.body.appendChild(swfContainer);
1647
+ }
1648
+
1649
+ // create the object/embed
1650
+ var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace;
1651
+ flashVars += "&log=true";
1652
+ swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" +
1653
+ "<param name='allowScriptAccess' value='always'></param>" +
1654
+ "<param name='wmode' value='transparent'>" +
1655
+ "<param name='movie' value='" +
1656
+ url +
1657
+ "'></param>" +
1658
+ "<param name='flashvars' value='" +
1659
+ flashVars +
1660
+ "'></param>" +
1661
+ "<embed type='application/x-shockwave-flash' FlashVars='" +
1662
+ flashVars +
1663
+ "' allowScriptAccess='always' wmode='transparent' src='" +
1664
+ url +
1665
+ "' height='1' width='1'></embed>" +
1666
+ "</object>";
1667
+ }
1668
+
1669
+ return (pub = {
1670
+ outgoing: function(message, domain, fn){
1671
+ swf.postMessage(config.channel, message.toString());
1672
+ if (fn) {
1673
+ fn();
1674
+ }
1675
+ },
1676
+ destroy: function(){
1677
+ trace("destroy");
1678
+ try {
1679
+ swf.destroyChannel(config.channel);
1680
+ }
1681
+ catch (e) {
1682
+ }
1683
+ swf = null;
1684
+ if (frame) {
1685
+ frame.parentNode.removeChild(frame);
1686
+ frame = null;
1687
+ }
1688
+ },
1689
+ onDOMReady: function(){
1690
+ trace("init");
1691
+
1692
+ targetOrigin = config.remote;
1693
+
1694
+ // Prepare the code that will be run after the swf has been intialized
1695
+ easyXDM.Fn.set("flash_" + config.channel + "_init", function(){
1696
+ setTimeout(function(){
1697
+ trace("firing onReady");
1698
+ pub.up.callback(true);
1699
+ });
1700
+ });
1701
+
1702
+ // set up the omMessage handler
1703
+ easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage);
1704
+
1705
+ config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths
1706
+ var swfdomain = getDomainName(config.swf);
1707
+ var fn = function(){
1708
+ // set init to true in case the fn was called was invoked from a separate instance
1709
+ easyXDM.stack.FlashTransport[swfdomain].init = true;
1710
+ swf = easyXDM.stack.FlashTransport[swfdomain].swf;
1711
+ // create the channel
1712
+ swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost);
1713
+
1714
+ if (config.isHost) {
1715
+ // if Flash is going to be throttled and we want to avoid this
1716
+ if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) {
1717
+ apply(config.props, {
1718
+ position: "fixed",
1719
+ right: 0,
1720
+ top: 0,
1721
+ height: "20px",
1722
+ width: "20px"
1723
+ });
1724
+ }
1725
+ // set up the iframe
1726
+ apply(config.props, {
1727
+ src: appendQueryParameters(config.remote, {
1728
+ xdm_e: getLocation(location.href),
1729
+ xdm_c: config.channel,
1730
+ xdm_p: 6, // 6 = FlashTransport
1731
+ xdm_s: config.secret
1732
+ }),
1733
+ name: IFRAME_PREFIX + config.channel + "_provider"
1734
+ });
1735
+ frame = createFrame(config);
1736
+ }
1737
+ };
1738
+
1739
+ if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) {
1740
+ // if the swf is in place and we are the consumer
1741
+ fn();
1742
+ }
1743
+ else {
1744
+ // if the swf does not yet exist
1745
+ if (!easyXDM.stack.FlashTransport[swfdomain]) {
1746
+ // add the queue to hold the init fn's
1747
+ easyXDM.stack.FlashTransport[swfdomain] = {
1748
+ queue: [fn]
1749
+ };
1750
+ addSwf(swfdomain);
1751
+ }
1752
+ else {
1753
+ easyXDM.stack.FlashTransport[swfdomain].queue.push(fn);
1754
+ }
1755
+ }
1756
+ },
1757
+ init: function(){
1758
+ whenReady(pub.onDOMReady, pub);
1759
+ }
1760
+ });
1761
+ };
1762
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1763
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
1764
+ //
1765
+ // easyXDM
1766
+ // http://easyxdm.net/
1767
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1768
+ //
1769
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1770
+ // of this software and associated documentation files (the "Software"), to deal
1771
+ // in the Software without restriction, including without limitation the rights
1772
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1773
+ // copies of the Software, and to permit persons to whom the Software is
1774
+ // furnished to do so, subject to the following conditions:
1775
+ //
1776
+ // The above copyright notice and this permission notice shall be included in
1777
+ // all copies or substantial portions of the Software.
1778
+ //
1779
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1780
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1781
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1782
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1783
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1784
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1785
+ // THE SOFTWARE.
1786
+ //
1787
+
1788
+ /**
1789
+ * @class easyXDM.stack.PostMessageTransport
1790
+ * PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/>
1791
+ * <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/>
1792
+ * <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a>
1793
+ * @namespace easyXDM.stack
1794
+ * @constructor
1795
+ * @param {Object} config The transports configuration.
1796
+ * @cfg {String} remote The remote domain to communicate with.
1797
+ */
1798
+ easyXDM.stack.PostMessageTransport = function(config){
1799
+ var trace = debug.getTracer("easyXDM.stack.PostMessageTransport");
1800
+ trace("constructor");
1801
+ var pub, // the public interface
1802
+ frame, // the remote frame, if any
1803
+ callerWindow, // the window that we will call with
1804
+ targetOrigin; // the domain to communicate with
1805
+ /**
1806
+ * Resolves the origin from the event object
1807
+ * @private
1808
+ * @param {Object} event The messageevent
1809
+ * @return {String} The scheme, host and port of the origin
1810
+ */
1811
+ function _getOrigin(event){
1812
+ if (event.origin) {
1813
+ // This is the HTML5 property
1814
+ return getLocation(event.origin);
1815
+ }
1816
+ if (event.uri) {
1817
+ // From earlier implementations
1818
+ return getLocation(event.uri);
1819
+ }
1820
+ if (event.domain) {
1821
+ // This is the last option and will fail if the
1822
+ // origin is not using the same schema as we are
1823
+ return location.protocol + "//" + event.domain;
1824
+ }
1825
+ throw "Unable to retrieve the origin of the event";
1826
+ }
1827
+
1828
+ /**
1829
+ * This is the main implementation for the onMessage event.<br/>
1830
+ * It checks the validity of the origin and passes the message on if appropriate.
1831
+ * @private
1832
+ * @param {Object} event The messageevent
1833
+ */
1834
+ function _window_onMessage(event){
1835
+ var origin = _getOrigin(event);
1836
+ trace("received message '" + event.data + "' from " + origin);
1837
+ if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
1838
+ pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
1839
+ }
1840
+ }
1841
+
1842
+ return (pub = {
1843
+ outgoing: function(message, domain, fn){
1844
+ callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin);
1845
+ if (fn) {
1846
+ fn();
1847
+ }
1848
+ },
1849
+ destroy: function(){
1850
+ trace("destroy");
1851
+ un(window, "message", _window_onMessage);
1852
+ if (frame) {
1853
+ callerWindow = null;
1854
+ frame.parentNode.removeChild(frame);
1855
+ frame = null;
1856
+ }
1857
+ },
1858
+ onDOMReady: function(){
1859
+ trace("init");
1860
+ targetOrigin = getLocation(config.remote);
1861
+ if (config.isHost) {
1862
+ // add the event handler for listening
1863
+ var waitForReady = function(event){
1864
+ if (event.data == config.channel + "-ready") {
1865
+ trace("firing onReady");
1866
+ // replace the eventlistener
1867
+ callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document;
1868
+ un(window, "message", waitForReady);
1869
+ on(window, "message", _window_onMessage);
1870
+ setTimeout(function(){
1871
+ pub.up.callback(true);
1872
+ }, 0);
1873
+ }
1874
+ };
1875
+ on(window, "message", waitForReady);
1876
+
1877
+ // set up the iframe
1878
+ apply(config.props, {
1879
+ src: appendQueryParameters(config.remote, {
1880
+ xdm_e: getLocation(location.href),
1881
+ xdm_c: config.channel,
1882
+ xdm_p: 1 // 1 = PostMessage
1883
+ }),
1884
+ name: IFRAME_PREFIX + config.channel + "_provider"
1885
+ });
1886
+ frame = createFrame(config);
1887
+ }
1888
+ else {
1889
+ // add the event handler for listening
1890
+ on(window, "message", _window_onMessage);
1891
+ callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document;
1892
+ callerWindow.postMessage(config.channel + "-ready", targetOrigin);
1893
+
1894
+ setTimeout(function(){
1895
+ pub.up.callback(true);
1896
+ }, 0);
1897
+ }
1898
+ },
1899
+ init: function(){
1900
+ whenReady(pub.onDOMReady, pub);
1901
+ }
1902
+ });
1903
+ };
1904
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1905
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/
1906
+ //
1907
+ // easyXDM
1908
+ // http://easyxdm.net/
1909
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1910
+ //
1911
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1912
+ // of this software and associated documentation files (the "Software"), to deal
1913
+ // in the Software without restriction, including without limitation the rights
1914
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1915
+ // copies of the Software, and to permit persons to whom the Software is
1916
+ // furnished to do so, subject to the following conditions:
1917
+ //
1918
+ // The above copyright notice and this permission notice shall be included in
1919
+ // all copies or substantial portions of the Software.
1920
+ //
1921
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1922
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1923
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1924
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1925
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1926
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1927
+ // THE SOFTWARE.
1928
+ //
1929
+
1930
+ /**
1931
+ * @class easyXDM.stack.FrameElementTransport
1932
+ * FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/>
1933
+ * Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running.
1934
+ * @namespace easyXDM.stack
1935
+ * @constructor
1936
+ * @param {Object} config The transports configuration.
1937
+ * @cfg {String} remote The remote document to communicate with.
1938
+ */
1939
+ easyXDM.stack.FrameElementTransport = function(config){
1940
+ var trace = debug.getTracer("easyXDM.stack.FrameElementTransport");
1941
+ trace("constructor");
1942
+ var pub, frame, send, targetOrigin;
1943
+
1944
+ return (pub = {
1945
+ outgoing: function(message, domain, fn){
1946
+ send.call(this, message);
1947
+ if (fn) {
1948
+ fn();
1949
+ }
1950
+ },
1951
+ destroy: function(){
1952
+ trace("destroy");
1953
+ if (frame) {
1954
+ frame.parentNode.removeChild(frame);
1955
+ frame = null;
1956
+ }
1957
+ },
1958
+ onDOMReady: function(){
1959
+ trace("init");
1960
+ targetOrigin = getLocation(config.remote);
1961
+
1962
+ if (config.isHost) {
1963
+ // set up the iframe
1964
+ apply(config.props, {
1965
+ src: appendQueryParameters(config.remote, {
1966
+ xdm_e: getLocation(location.href),
1967
+ xdm_c: config.channel,
1968
+ xdm_p: 5 // 5 = FrameElementTransport
1969
+ }),
1970
+ name: IFRAME_PREFIX + config.channel + "_provider"
1971
+ });
1972
+ frame = createFrame(config);
1973
+ frame.fn = function(sendFn){
1974
+ delete frame.fn;
1975
+ send = sendFn;
1976
+ setTimeout(function(){
1977
+ pub.up.callback(true);
1978
+ }, 0);
1979
+ // remove the function so that it cannot be used to overwrite the send function later on
1980
+ return function(msg){
1981
+ pub.up.incoming(msg, targetOrigin);
1982
+ };
1983
+ };
1984
+ }
1985
+ else {
1986
+ // This is to mitigate origin-spoofing
1987
+ if (document.referrer && getLocation(document.referrer) != query.xdm_e) {
1988
+ window.top.location = query.xdm_e;
1989
+ }
1990
+ send = window.frameElement.fn(function(msg){
1991
+ pub.up.incoming(msg, targetOrigin);
1992
+ });
1993
+ pub.up.callback(true);
1994
+ }
1995
+ },
1996
+ init: function(){
1997
+ whenReady(pub.onDOMReady, pub);
1998
+ }
1999
+ });
2000
+ };
2001
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2002
+ /*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/
2003
+ //
2004
+ // easyXDM
2005
+ // http://easyxdm.net/
2006
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2007
+ //
2008
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2009
+ // of this software and associated documentation files (the "Software"), to deal
2010
+ // in the Software without restriction, including without limitation the rights
2011
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2012
+ // copies of the Software, and to permit persons to whom the Software is
2013
+ // furnished to do so, subject to the following conditions:
2014
+ //
2015
+ // The above copyright notice and this permission notice shall be included in
2016
+ // all copies or substantial portions of the Software.
2017
+ //
2018
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2019
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2020
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2021
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2022
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2023
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2024
+ // THE SOFTWARE.
2025
+ //
2026
+
2027
+ /**
2028
+ * @class easyXDM.stack.NameTransport
2029
+ * NameTransport uses the window.name property to relay data.
2030
+ * The <code>local</code> parameter needs to be set on both the consumer and provider,<br/>
2031
+ * and the <code>remoteHelper</code> parameter needs to be set on the consumer.
2032
+ * @constructor
2033
+ * @param {Object} config The transports configuration.
2034
+ * @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host.
2035
+ * @namespace easyXDM.stack
2036
+ */
2037
+ easyXDM.stack.NameTransport = function(config){
2038
+ var trace = debug.getTracer("easyXDM.stack.NameTransport");
2039
+ trace("constructor");
2040
+ if (config.isHost && undef(config.remoteHelper)) {
2041
+ trace("missing remoteHelper");
2042
+ throw new Error("missing remoteHelper");
2043
+ }
2044
+
2045
+ var pub; // the public interface
2046
+ var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl;
2047
+
2048
+ function _sendMessage(message){
2049
+ var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel;
2050
+ trace("sending message " + message);
2051
+ trace("navigating to '" + url + "'");
2052
+ callerWindow.contentWindow.sendMessage(message, url);
2053
+ }
2054
+
2055
+ function _onReady(){
2056
+ if (isHost) {
2057
+ if (++readyCount === 2 || !isHost) {
2058
+ pub.up.callback(true);
2059
+ }
2060
+ }
2061
+ else {
2062
+ _sendMessage("ready");
2063
+ trace("calling onReady");
2064
+ pub.up.callback(true);
2065
+ }
2066
+ }
2067
+
2068
+ function _onMessage(message){
2069
+ trace("received message " + message);
2070
+ pub.up.incoming(message, remoteOrigin);
2071
+ }
2072
+
2073
+ function _onLoad(){
2074
+ if (callback) {
2075
+ setTimeout(function(){
2076
+ callback(true);
2077
+ }, 0);
2078
+ }
2079
+ }
2080
+
2081
+ return (pub = {
2082
+ outgoing: function(message, domain, fn){
2083
+ callback = fn;
2084
+ _sendMessage(message);
2085
+ },
2086
+ destroy: function(){
2087
+ trace("destroy");
2088
+ callerWindow.parentNode.removeChild(callerWindow);
2089
+ callerWindow = null;
2090
+ if (isHost) {
2091
+ remoteWindow.parentNode.removeChild(remoteWindow);
2092
+ remoteWindow = null;
2093
+ }
2094
+ },
2095
+ onDOMReady: function(){
2096
+ trace("init");
2097
+ isHost = config.isHost;
2098
+ readyCount = 0;
2099
+ remoteOrigin = getLocation(config.remote);
2100
+ config.local = resolveUrl(config.local);
2101
+
2102
+ if (isHost) {
2103
+ // Register the callback
2104
+ easyXDM.Fn.set(config.channel, function(message){
2105
+ trace("received initial message " + message);
2106
+ if (isHost && message === "ready") {
2107
+ // Replace the handler
2108
+ easyXDM.Fn.set(config.channel, _onMessage);
2109
+ _onReady();
2110
+ }
2111
+ });
2112
+
2113
+ // Set up the frame that points to the remote instance
2114
+ remoteUrl = appendQueryParameters(config.remote, {
2115
+ xdm_e: config.local,
2116
+ xdm_c: config.channel,
2117
+ xdm_p: 2
2118
+ });
2119
+ apply(config.props, {
2120
+ src: remoteUrl + '#' + config.channel,
2121
+ name: IFRAME_PREFIX + config.channel + "_provider"
2122
+ });
2123
+ remoteWindow = createFrame(config);
2124
+ }
2125
+ else {
2126
+ config.remoteHelper = config.remote;
2127
+ easyXDM.Fn.set(config.channel, _onMessage);
2128
+ }
2129
+
2130
+ // Set up the iframe that will be used for the transport
2131
+ var onLoad = function(){
2132
+ // Remove the handler
2133
+ var w = callerWindow || this;
2134
+ un(w, "load", onLoad);
2135
+ easyXDM.Fn.set(config.channel + "_load", _onLoad);
2136
+ (function test(){
2137
+ if (typeof w.contentWindow.sendMessage == "function") {
2138
+ _onReady();
2139
+ }
2140
+ else {
2141
+ setTimeout(test, 50);
2142
+ }
2143
+ }());
2144
+ };
2145
+
2146
+ callerWindow = createFrame({
2147
+ props: {
2148
+ src: config.local + "#_4" + config.channel
2149
+ },
2150
+ onLoad: onLoad
2151
+ });
2152
+ },
2153
+ init: function(){
2154
+ whenReady(pub.onDOMReady, pub);
2155
+ }
2156
+ });
2157
+ };
2158
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2159
+ /*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
2160
+ //
2161
+ // easyXDM
2162
+ // http://easyxdm.net/
2163
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2164
+ //
2165
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2166
+ // of this software and associated documentation files (the "Software"), to deal
2167
+ // in the Software without restriction, including without limitation the rights
2168
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2169
+ // copies of the Software, and to permit persons to whom the Software is
2170
+ // furnished to do so, subject to the following conditions:
2171
+ //
2172
+ // The above copyright notice and this permission notice shall be included in
2173
+ // all copies or substantial portions of the Software.
2174
+ //
2175
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2176
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2177
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2178
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2179
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2180
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2181
+ // THE SOFTWARE.
2182
+ //
2183
+
2184
+ /**
2185
+ * @class easyXDM.stack.HashTransport
2186
+ * HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/>
2187
+ * <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/>
2188
+ * @namespace easyXDM.stack
2189
+ * @constructor
2190
+ * @param {Object} config The transports configuration.
2191
+ * @cfg {String/Window} local The url to the local file used for proxying messages, or the local window.
2192
+ * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window.
2193
+ * @cfg {Number} interval The interval used when polling for messages.
2194
+ */
2195
+ easyXDM.stack.HashTransport = function(config){
2196
+ var trace = debug.getTracer("easyXDM.stack.HashTransport");
2197
+ trace("constructor");
2198
+ var pub;
2199
+ var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow;
2200
+ var useParent, _remoteOrigin;
2201
+
2202
+ function _sendMessage(message){
2203
+ trace("sending message '" + (_msgNr + 1) + " " + message + "' to " + _remoteOrigin);
2204
+ if (!_callerWindow) {
2205
+ trace("no caller window");
2206
+ return;
2207
+ }
2208
+ var url = config.remote + "#" + (_msgNr++) + "_" + message;
2209
+ ((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url;
2210
+ }
2211
+
2212
+ function _handleHash(hash){
2213
+ _lastMsg = hash;
2214
+ trace("received message '" + _lastMsg + "' from " + _remoteOrigin);
2215
+ pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin);
2216
+ }
2217
+
2218
+ /**
2219
+ * Checks location.hash for a new message and relays this to the receiver.
2220
+ * @private
2221
+ */
2222
+ function _pollHash(){
2223
+ if (!_listenerWindow) {
2224
+ return;
2225
+ }
2226
+ var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
2227
+ if (indexOf != -1) {
2228
+ hash = href.substring(indexOf);
2229
+ }
2230
+ if (hash && hash != _lastMsg) {
2231
+ trace("poll: new message");
2232
+ _handleHash(hash);
2233
+ }
2234
+ }
2235
+
2236
+ function _attachListeners(){
2237
+ trace("starting polling");
2238
+ _timer = setInterval(_pollHash, pollInterval);
2239
+ }
2240
+
2241
+ return (pub = {
2242
+ outgoing: function(message, domain){
2243
+ _sendMessage(message);
2244
+ },
2245
+ destroy: function(){
2246
+ window.clearInterval(_timer);
2247
+ if (isHost || !useParent) {
2248
+ _callerWindow.parentNode.removeChild(_callerWindow);
2249
+ }
2250
+ _callerWindow = null;
2251
+ },
2252
+ onDOMReady: function(){
2253
+ isHost = config.isHost;
2254
+ pollInterval = config.interval;
2255
+ _lastMsg = "#" + config.channel;
2256
+ _msgNr = 0;
2257
+ useParent = config.useParent;
2258
+ _remoteOrigin = getLocation(config.remote);
2259
+ if (isHost) {
2260
+ apply(config.props, {
2261
+ src: config.remote,
2262
+ name: IFRAME_PREFIX + config.channel + "_provider"
2263
+ });
2264
+ if (useParent) {
2265
+ config.onLoad = function(){
2266
+ _listenerWindow = window;
2267
+ _attachListeners();
2268
+ pub.up.callback(true);
2269
+ };
2270
+ }
2271
+ else {
2272
+ var tries = 0, max = config.delay / 50;
2273
+ (function getRef(){
2274
+ if (++tries > max) {
2275
+ trace("unable to get reference to _listenerWindow, giving up");
2276
+ throw new Error("Unable to reference listenerwindow");
2277
+ }
2278
+ try {
2279
+ _listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"];
2280
+ }
2281
+ catch (ex) {
2282
+ }
2283
+ if (_listenerWindow) {
2284
+ _attachListeners();
2285
+ trace("got a reference to _listenerWindow");
2286
+ pub.up.callback(true);
2287
+ }
2288
+ else {
2289
+ setTimeout(getRef, 50);
2290
+ }
2291
+ }());
2292
+ }
2293
+ _callerWindow = createFrame(config);
2294
+ }
2295
+ else {
2296
+ _listenerWindow = window;
2297
+ _attachListeners();
2298
+ if (useParent) {
2299
+ _callerWindow = parent;
2300
+ pub.up.callback(true);
2301
+ }
2302
+ else {
2303
+ apply(config, {
2304
+ props: {
2305
+ src: config.remote + "#" + config.channel + new Date(),
2306
+ name: IFRAME_PREFIX + config.channel + "_consumer"
2307
+ },
2308
+ onLoad: function(){
2309
+ pub.up.callback(true);
2310
+ }
2311
+ });
2312
+ _callerWindow = createFrame(config);
2313
+ }
2314
+ }
2315
+ },
2316
+ init: function(){
2317
+ whenReady(pub.onDOMReady, pub);
2318
+ }
2319
+ });
2320
+ };
2321
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2322
+ /*global easyXDM, window, escape, unescape, debug */
2323
+ //
2324
+ // easyXDM
2325
+ // http://easyxdm.net/
2326
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2327
+ //
2328
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2329
+ // of this software and associated documentation files (the "Software"), to deal
2330
+ // in the Software without restriction, including without limitation the rights
2331
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2332
+ // copies of the Software, and to permit persons to whom the Software is
2333
+ // furnished to do so, subject to the following conditions:
2334
+ //
2335
+ // The above copyright notice and this permission notice shall be included in
2336
+ // all copies or substantial portions of the Software.
2337
+ //
2338
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2339
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2340
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2341
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2342
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2343
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2344
+ // THE SOFTWARE.
2345
+ //
2346
+
2347
+ /**
2348
+ * @class easyXDM.stack.ReliableBehavior
2349
+ * This is a behavior that tries to make the underlying transport reliable by using acknowledgements.
2350
+ * @namespace easyXDM.stack
2351
+ * @constructor
2352
+ * @param {Object} config The behaviors configuration.
2353
+ */
2354
+ easyXDM.stack.ReliableBehavior = function(config){
2355
+ var trace = debug.getTracer("easyXDM.stack.ReliableBehavior");
2356
+ trace("constructor");
2357
+ var pub, // the public interface
2358
+ callback; // the callback to execute when we have a confirmed success/failure
2359
+ var idOut = 0, idIn = 0, currentMessage = "";
2360
+
2361
+ return (pub = {
2362
+ incoming: function(message, origin){
2363
+ trace("incoming: " + message);
2364
+ var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(",");
2365
+ message = message.substring(indexOf + 1);
2366
+
2367
+ if (ack[0] == idOut) {
2368
+ trace("message delivered");
2369
+ currentMessage = "";
2370
+ if (callback) {
2371
+ callback(true);
2372
+ callback = null;
2373
+ }
2374
+ }
2375
+ if (message.length > 0) {
2376
+ trace("sending ack, and passing on " + message);
2377
+ pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin);
2378
+ if (idIn != ack[1]) {
2379
+ idIn = ack[1];
2380
+ pub.up.incoming(message, origin);
2381
+ }
2382
+ }
2383
+
2384
+ },
2385
+ outgoing: function(message, origin, fn){
2386
+ currentMessage = message;
2387
+ callback = fn;
2388
+ pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin);
2389
+ }
2390
+ });
2391
+ };
2392
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2393
+ /*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/
2394
+ //
2395
+ // easyXDM
2396
+ // http://easyxdm.net/
2397
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2398
+ //
2399
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2400
+ // of this software and associated documentation files (the "Software"), to deal
2401
+ // in the Software without restriction, including without limitation the rights
2402
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2403
+ // copies of the Software, and to permit persons to whom the Software is
2404
+ // furnished to do so, subject to the following conditions:
2405
+ //
2406
+ // The above copyright notice and this permission notice shall be included in
2407
+ // all copies or substantial portions of the Software.
2408
+ //
2409
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2410
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2411
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2412
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2413
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2414
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2415
+ // THE SOFTWARE.
2416
+ //
2417
+
2418
+ /**
2419
+ * @class easyXDM.stack.QueueBehavior
2420
+ * This is a behavior that enables queueing of messages. <br/>
2421
+ * It will buffer incoming messages and dispach these as fast as the underlying transport allows.
2422
+ * This will also fragment/defragment messages so that the outgoing message is never bigger than the
2423
+ * set length.
2424
+ * @namespace easyXDM.stack
2425
+ * @constructor
2426
+ * @param {Object} config The behaviors configuration. Optional.
2427
+ * @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation.
2428
+ */
2429
+ easyXDM.stack.QueueBehavior = function(config){
2430
+ var trace = debug.getTracer("easyXDM.stack.QueueBehavior");
2431
+ trace("constructor");
2432
+ var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false;
2433
+
2434
+ function dispatch(){
2435
+ if (config.remove && queue.length === 0) {
2436
+ trace("removing myself from the stack");
2437
+ removeFromStack(pub);
2438
+ return;
2439
+ }
2440
+ if (waiting || queue.length === 0 || destroying) {
2441
+ return;
2442
+ }
2443
+ trace("dispatching from queue");
2444
+ waiting = true;
2445
+ var message = queue.shift();
2446
+
2447
+ pub.down.outgoing(message.data, message.origin, function(success){
2448
+ waiting = false;
2449
+ if (message.callback) {
2450
+ setTimeout(function(){
2451
+ message.callback(success);
2452
+ }, 0);
2453
+ }
2454
+ dispatch();
2455
+ });
2456
+ }
2457
+ return (pub = {
2458
+ init: function(){
2459
+ if (undef(config)) {
2460
+ config = {};
2461
+ }
2462
+ if (config.maxLength) {
2463
+ maxLength = config.maxLength;
2464
+ doFragment = true;
2465
+ }
2466
+ if (config.lazy) {
2467
+ lazy = true;
2468
+ }
2469
+ else {
2470
+ pub.down.init();
2471
+ }
2472
+ },
2473
+ callback: function(success){
2474
+ waiting = false;
2475
+ var up = pub.up; // in case dispatch calls removeFromStack
2476
+ dispatch();
2477
+ up.callback(success);
2478
+ },
2479
+ incoming: function(message, origin){
2480
+ if (doFragment) {
2481
+ var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10);
2482
+ incoming += message.substring(indexOf + 1);
2483
+ if (seq === 0) {
2484
+ trace("received the last fragment");
2485
+ if (config.encode) {
2486
+ incoming = decodeURIComponent(incoming);
2487
+ }
2488
+ pub.up.incoming(incoming, origin);
2489
+ incoming = "";
2490
+ }
2491
+ else {
2492
+ trace("waiting for more fragments, seq=" + message);
2493
+ }
2494
+ }
2495
+ else {
2496
+ pub.up.incoming(message, origin);
2497
+ }
2498
+ },
2499
+ outgoing: function(message, origin, fn){
2500
+ if (config.encode) {
2501
+ message = encodeURIComponent(message);
2502
+ }
2503
+ var fragments = [], fragment;
2504
+ if (doFragment) {
2505
+ // fragment into chunks
2506
+ while (message.length !== 0) {
2507
+ fragment = message.substring(0, maxLength);
2508
+ message = message.substring(fragment.length);
2509
+ fragments.push(fragment);
2510
+ }
2511
+ // enqueue the chunks
2512
+ while ((fragment = fragments.shift())) {
2513
+ trace("enqueuing");
2514
+ queue.push({
2515
+ data: fragments.length + "_" + fragment,
2516
+ origin: origin,
2517
+ callback: fragments.length === 0 ? fn : null
2518
+ });
2519
+ }
2520
+ }
2521
+ else {
2522
+ queue.push({
2523
+ data: message,
2524
+ origin: origin,
2525
+ callback: fn
2526
+ });
2527
+ }
2528
+ if (lazy) {
2529
+ pub.down.init();
2530
+ }
2531
+ else {
2532
+ dispatch();
2533
+ }
2534
+ },
2535
+ destroy: function(){
2536
+ trace("destroy");
2537
+ destroying = true;
2538
+ pub.down.destroy();
2539
+ }
2540
+ });
2541
+ };
2542
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2543
+ /*global easyXDM, window, escape, unescape, undef, debug */
2544
+ //
2545
+ // easyXDM
2546
+ // http://easyxdm.net/
2547
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2548
+ //
2549
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2550
+ // of this software and associated documentation files (the "Software"), to deal
2551
+ // in the Software without restriction, including without limitation the rights
2552
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2553
+ // copies of the Software, and to permit persons to whom the Software is
2554
+ // furnished to do so, subject to the following conditions:
2555
+ //
2556
+ // The above copyright notice and this permission notice shall be included in
2557
+ // all copies or substantial portions of the Software.
2558
+ //
2559
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2560
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2561
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2562
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2563
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2564
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2565
+ // THE SOFTWARE.
2566
+ //
2567
+
2568
+ /**
2569
+ * @class easyXDM.stack.VerifyBehavior
2570
+ * This behavior will verify that communication with the remote end is possible, and will also sign all outgoing,
2571
+ * and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages.
2572
+ * @namespace easyXDM.stack
2573
+ * @constructor
2574
+ * @param {Object} config The behaviors configuration.
2575
+ * @cfg {Boolean} initiate If the verification should be initiated from this end.
2576
+ */
2577
+ easyXDM.stack.VerifyBehavior = function(config){
2578
+ var trace = debug.getTracer("easyXDM.stack.VerifyBehavior");
2579
+ trace("constructor");
2580
+ if (undef(config.initiate)) {
2581
+ throw new Error("settings.initiate is not set");
2582
+ }
2583
+ var pub, mySecret, theirSecret, verified = false;
2584
+
2585
+ function startVerification(){
2586
+ trace("requesting verification");
2587
+ mySecret = Math.random().toString(16).substring(2);
2588
+ pub.down.outgoing(mySecret);
2589
+ }
2590
+
2591
+ return (pub = {
2592
+ incoming: function(message, origin){
2593
+ var indexOf = message.indexOf("_");
2594
+ if (indexOf === -1) {
2595
+ if (message === mySecret) {
2596
+ trace("verified, calling callback");
2597
+ pub.up.callback(true);
2598
+ }
2599
+ else if (!theirSecret) {
2600
+ trace("returning secret");
2601
+ theirSecret = message;
2602
+ if (!config.initiate) {
2603
+ startVerification();
2604
+ }
2605
+ pub.down.outgoing(message);
2606
+ }
2607
+ }
2608
+ else {
2609
+ if (message.substring(0, indexOf) === theirSecret) {
2610
+ pub.up.incoming(message.substring(indexOf + 1), origin);
2611
+ }
2612
+ }
2613
+ },
2614
+ outgoing: function(message, origin, fn){
2615
+ pub.down.outgoing(mySecret + "_" + message, origin, fn);
2616
+ },
2617
+ callback: function(success){
2618
+ if (config.initiate) {
2619
+ startVerification();
2620
+ }
2621
+ }
2622
+ });
2623
+ };
2624
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2625
+ /*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */
2626
+ //
2627
+ // easyXDM
2628
+ // http://easyxdm.net/
2629
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2630
+ //
2631
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2632
+ // of this software and associated documentation files (the "Software"), to deal
2633
+ // in the Software without restriction, including without limitation the rights
2634
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2635
+ // copies of the Software, and to permit persons to whom the Software is
2636
+ // furnished to do so, subject to the following conditions:
2637
+ //
2638
+ // The above copyright notice and this permission notice shall be included in
2639
+ // all copies or substantial portions of the Software.
2640
+ //
2641
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2642
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2643
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2644
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2645
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2646
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2647
+ // THE SOFTWARE.
2648
+ //
2649
+
2650
+ /**
2651
+ * @class easyXDM.stack.RpcBehavior
2652
+ * This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/>
2653
+ * Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything.
2654
+ * @namespace easyXDM.stack
2655
+ * @constructor
2656
+ * @param {Object} proxy The object to apply the methods to.
2657
+ * @param {Object} config The definition of the local and remote interface to implement.
2658
+ * @cfg {Object} local The local interface to expose.
2659
+ * @cfg {Object} remote The remote methods to expose through the proxy.
2660
+ * @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON.
2661
+ */
2662
+ easyXDM.stack.RpcBehavior = function(proxy, config){
2663
+ var trace = debug.getTracer("easyXDM.stack.RpcBehavior");
2664
+ var pub, serializer = config.serializer || getJSON();
2665
+ var _callbackCounter = 0, _callbacks = {};
2666
+
2667
+ /**
2668
+ * Serializes and sends the message
2669
+ * @private
2670
+ * @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added.
2671
+ */
2672
+ function _send(data){
2673
+ data.jsonrpc = "2.0";
2674
+ pub.down.outgoing(serializer.stringify(data));
2675
+ }
2676
+
2677
+ /**
2678
+ * Creates a method that implements the given definition
2679
+ * @private
2680
+ * @param {Object} The method configuration
2681
+ * @param {String} method The name of the method
2682
+ * @return {Function} A stub capable of proxying the requested method call
2683
+ */
2684
+ function _createMethod(definition, method){
2685
+ var slice = Array.prototype.slice;
2686
+
2687
+ trace("creating method " + method);
2688
+ return function(){
2689
+ trace("executing method " + method);
2690
+ var l = arguments.length, callback, message = {
2691
+ method: method
2692
+ };
2693
+
2694
+ if (l > 0 && typeof arguments[l - 1] === "function") {
2695
+ //with callback, procedure
2696
+ if (l > 1 && typeof arguments[l - 2] === "function") {
2697
+ // two callbacks, success and error
2698
+ callback = {
2699
+ success: arguments[l - 2],
2700
+ error: arguments[l - 1]
2701
+ };
2702
+ message.params = slice.call(arguments, 0, l - 2);
2703
+ }
2704
+ else {
2705
+ // single callback, success
2706
+ callback = {
2707
+ success: arguments[l - 1]
2708
+ };
2709
+ message.params = slice.call(arguments, 0, l - 1);
2710
+ }
2711
+ _callbacks["" + (++_callbackCounter)] = callback;
2712
+ message.id = _callbackCounter;
2713
+ }
2714
+ else {
2715
+ // no callbacks, a notification
2716
+ message.params = slice.call(arguments, 0);
2717
+ }
2718
+ if (definition.namedParams && message.params.length === 1) {
2719
+ message.params = message.params[0];
2720
+ }
2721
+ // Send the method request
2722
+ _send(message);
2723
+ };
2724
+ }
2725
+
2726
+ /**
2727
+ * Executes the exposed method
2728
+ * @private
2729
+ * @param {String} method The name of the method
2730
+ * @param {Number} id The callback id to use
2731
+ * @param {Function} method The exposed implementation
2732
+ * @param {Array} params The parameters supplied by the remote end
2733
+ */
2734
+ function _executeMethod(method, id, fn, params){
2735
+ if (!fn) {
2736
+ trace("requested to execute non-existent procedure " + method);
2737
+ if (id) {
2738
+ _send({
2739
+ id: id,
2740
+ error: {
2741
+ code: -32601,
2742
+ message: "Procedure not found."
2743
+ }
2744
+ });
2745
+ }
2746
+ return;
2747
+ }
2748
+
2749
+ trace("requested to execute procedure " + method);
2750
+ var success, error;
2751
+ if (id) {
2752
+ success = function(result){
2753
+ success = emptyFn;
2754
+ _send({
2755
+ id: id,
2756
+ result: result
2757
+ });
2758
+ };
2759
+ error = function(message, data){
2760
+ error = emptyFn;
2761
+ var msg = {
2762
+ id: id,
2763
+ error: {
2764
+ code: -32099,
2765
+ message: message
2766
+ }
2767
+ };
2768
+ if (data) {
2769
+ msg.error.data = data;
2770
+ }
2771
+ _send(msg);
2772
+ };
2773
+ }
2774
+ else {
2775
+ success = error = emptyFn;
2776
+ }
2777
+ // Call local method
2778
+ if (!isArray(params)) {
2779
+ params = [params];
2780
+ }
2781
+ try {
2782
+ var result = fn.method.apply(fn.scope, params.concat([success, error]));
2783
+ if (!undef(result)) {
2784
+ success(result);
2785
+ }
2786
+ }
2787
+ catch (ex1) {
2788
+ error(ex1.message);
2789
+ }
2790
+ }
2791
+
2792
+ return (pub = {
2793
+ incoming: function(message, origin){
2794
+ var data = serializer.parse(message);
2795
+ if (data.method) {
2796
+ trace("received request to execute method " + data.method + (data.id ? (" using callback id " + data.id) : ""));
2797
+ // A method call from the remote end
2798
+ if (config.handle) {
2799
+ config.handle(data, _send);
2800
+ }
2801
+ else {
2802
+ _executeMethod(data.method, data.id, config.local[data.method], data.params);
2803
+ }
2804
+ }
2805
+ else {
2806
+ trace("received return value destined to callback with id " + data.id);
2807
+ // A method response from the other end
2808
+ var callback = _callbacks[data.id];
2809
+ if (data.error) {
2810
+ if (callback.error) {
2811
+ callback.error(data.error);
2812
+ }
2813
+ else {
2814
+ trace("unhandled error returned.");
2815
+ }
2816
+ }
2817
+ else if (callback.success) {
2818
+ callback.success(data.result);
2819
+ }
2820
+ delete _callbacks[data.id];
2821
+ }
2822
+ },
2823
+ init: function(){
2824
+ trace("init");
2825
+ if (config.remote) {
2826
+ trace("creating stubs");
2827
+ // Implement the remote sides exposed methods
2828
+ for (var method in config.remote) {
2829
+ if (config.remote.hasOwnProperty(method)) {
2830
+ proxy[method] = _createMethod(config.remote[method], method);
2831
+ }
2832
+ }
2833
+ }
2834
+ pub.down.init();
2835
+ },
2836
+ destroy: function(){
2837
+ trace("destroy");
2838
+ for (var method in config.remote) {
2839
+ if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) {
2840
+ delete proxy[method];
2841
+ }
2842
+ }
2843
+ pub.down.destroy();
2844
+ }
2845
+ });
2846
+ };
2847
+ global.easyXDM = easyXDM;
2848
+ })(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent);
js/bluepay_echeck/easyXDM/easyXDM.js ADDED
@@ -0,0 +1,2553 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) {
2
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
3
+ /*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */
4
+ //
5
+ // easyXDM
6
+ // http://easyxdm.net/
7
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
8
+ //
9
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ // of this software and associated documentation files (the "Software"), to deal
11
+ // in the Software without restriction, including without limitation the rights
12
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ // copies of the Software, and to permit persons to whom the Software is
14
+ // furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ // THE SOFTWARE.
26
+ //
27
+
28
+ var global = this;
29
+ var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded
30
+ var emptyFn = Function.prototype;
31
+ var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4)
32
+ var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression
33
+ var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol
34
+ var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global)
35
+ var easyXDM = {};
36
+ var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite
37
+ var IFRAME_PREFIX = "easyXDM_";
38
+ var HAS_NAME_PROPERTY_BUG;
39
+ var useHash = false; // whether to use the hash over the query
40
+ var flashVersion; // will be set if using flash
41
+ var HAS_FLASH_THROTTLED_BUG;
42
+
43
+
44
+ // http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
45
+ function isHostMethod(object, property){
46
+ var t = typeof object[property];
47
+ return t == 'function' ||
48
+ (!!(t == 'object' && object[property])) ||
49
+ t == 'unknown';
50
+ }
51
+
52
+ function isHostObject(object, property){
53
+ return !!(typeof(object[property]) == 'object' && object[property]);
54
+ }
55
+
56
+ // end
57
+
58
+ // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
59
+ function isArray(o){
60
+ return Object.prototype.toString.call(o) === '[object Array]';
61
+ }
62
+
63
+ // end
64
+ function hasFlash(){
65
+ var name = "Shockwave Flash", mimeType = "application/x-shockwave-flash";
66
+
67
+ if (!undef(navigator.plugins) && typeof navigator.plugins[name] == "object") {
68
+ // adapted from the swfobject code
69
+ var description = navigator.plugins[name].description;
70
+ if (description && !undef(navigator.mimeTypes) && navigator.mimeTypes[mimeType] && navigator.mimeTypes[mimeType].enabledPlugin) {
71
+ flashVersion = description.match(/\d+/g);
72
+ }
73
+ }
74
+ if (!flashVersion) {
75
+ var flash;
76
+ try {
77
+ flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
78
+ flashVersion = Array.prototype.slice.call(flash.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1);
79
+ flash = null;
80
+ }
81
+ catch (notSupportedException) {
82
+ }
83
+ }
84
+ if (!flashVersion) {
85
+ return false;
86
+ }
87
+ var major = parseInt(flashVersion[0], 10), minor = parseInt(flashVersion[1], 10);
88
+ HAS_FLASH_THROTTLED_BUG = major > 9 && minor > 0;
89
+ return true;
90
+ }
91
+
92
+ /*
93
+ * Cross Browser implementation for adding and removing event listeners.
94
+ */
95
+ var on, un;
96
+ if (isHostMethod(window, "addEventListener")) {
97
+ on = function(target, type, listener){
98
+ target.addEventListener(type, listener, false);
99
+ };
100
+ un = function(target, type, listener){
101
+ target.removeEventListener(type, listener, false);
102
+ };
103
+ }
104
+ else if (isHostMethod(window, "attachEvent")) {
105
+ on = function(object, sEvent, fpNotify){
106
+ object.attachEvent("on" + sEvent, fpNotify);
107
+ };
108
+ un = function(object, sEvent, fpNotify){
109
+ object.detachEvent("on" + sEvent, fpNotify);
110
+ };
111
+ }
112
+ else {
113
+ throw new Error("Browser not supported");
114
+ }
115
+
116
+ /*
117
+ * Cross Browser implementation of DOMContentLoaded.
118
+ */
119
+ var domIsReady = false, domReadyQueue = [], readyState;
120
+ if ("readyState" in document) {
121
+ // If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and
122
+ // 'interactive' (HTML5 specs, recent WebKit builds) states.
123
+ // https://bugs.webkit.org/show_bug.cgi?id=45119
124
+ readyState = document.readyState;
125
+ domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive"));
126
+ }
127
+ else {
128
+ // If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately
129
+ // when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not.
130
+ // We only need a body to add elements to, so the existence of document.body is enough for us.
131
+ domIsReady = !!document.body;
132
+ }
133
+
134
+ function dom_onReady(){
135
+ if (domIsReady) {
136
+ return;
137
+ }
138
+ domIsReady = true;
139
+ for (var i = 0; i < domReadyQueue.length; i++) {
140
+ domReadyQueue[i]();
141
+ }
142
+ domReadyQueue.length = 0;
143
+ }
144
+
145
+
146
+ if (!domIsReady) {
147
+ if (isHostMethod(window, "addEventListener")) {
148
+ on(document, "DOMContentLoaded", dom_onReady);
149
+ }
150
+ else {
151
+ on(document, "readystatechange", function(){
152
+ if (document.readyState == "complete") {
153
+ dom_onReady();
154
+ }
155
+ });
156
+ if (document.documentElement.doScroll && window === top) {
157
+ var doScrollCheck = function(){
158
+ if (domIsReady) {
159
+ return;
160
+ }
161
+ // http://javascript.nwbox.com/IEContentLoaded/
162
+ try {
163
+ document.documentElement.doScroll("left");
164
+ }
165
+ catch (e) {
166
+ setTimeout(doScrollCheck, 1);
167
+ return;
168
+ }
169
+ dom_onReady();
170
+ };
171
+ doScrollCheck();
172
+ }
173
+ }
174
+
175
+ // A fallback to window.onload, that will always work
176
+ on(window, "load", dom_onReady);
177
+ }
178
+ /**
179
+ * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
180
+ * If functions are added after this event then they will be executed immediately.
181
+ * @param {function} fn The function to add
182
+ * @param {Object} scope An optional scope for the function to be called with.
183
+ */
184
+ function whenReady(fn, scope){
185
+ if (domIsReady) {
186
+ fn.call(scope);
187
+ return;
188
+ }
189
+ domReadyQueue.push(function(){
190
+ fn.call(scope);
191
+ });
192
+ }
193
+
194
+ /**
195
+ * Returns an instance of easyXDM from the parent window with
196
+ * respect to the namespace.
197
+ *
198
+ * @return An instance of easyXDM (in the parent window)
199
+ */
200
+ function getParentObject(){
201
+ var obj = parent;
202
+ if (namespace !== "") {
203
+ for (var i = 0, ii = namespace.split("."); i < ii.length; i++) {
204
+ obj = obj[ii[i]];
205
+ }
206
+ }
207
+ return obj.easyXDM;
208
+ }
209
+
210
+ /**
211
+ * Removes easyXDM variable from the global scope. It also returns control
212
+ * of the easyXDM variable to whatever code used it before.
213
+ *
214
+ * @param {String} ns A string representation of an object that will hold
215
+ * an instance of easyXDM.
216
+ * @return An instance of easyXDM
217
+ */
218
+ function noConflict(ns){
219
+
220
+ window.easyXDM = _easyXDM;
221
+ namespace = ns;
222
+ if (namespace) {
223
+ IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_";
224
+ }
225
+ return easyXDM;
226
+ }
227
+
228
+ /*
229
+ * Methods for working with URLs
230
+ */
231
+ /**
232
+ * Get the domain name from a url.
233
+ * @param {String} url The url to extract the domain from.
234
+ * @return The domain part of the url.
235
+ * @type {String}
236
+ */
237
+ function getDomainName(url){
238
+ return url.match(reURI)[3];
239
+ }
240
+
241
+ /**
242
+ * Get the port for a given URL, or "" if none
243
+ * @param {String} url The url to extract the port from.
244
+ * @return The port part of the url.
245
+ * @type {String}
246
+ */
247
+ function getPort(url){
248
+ return url.match(reURI)[4] || "";
249
+ }
250
+
251
+ /**
252
+ * Returns a string containing the schema, domain and if present the port
253
+ * @param {String} url The url to extract the location from
254
+ * @return {String} The location part of the url
255
+ */
256
+ function getLocation(url){
257
+ var m = url.toLowerCase().match(reURI);
258
+ var proto = m[2], domain = m[3], port = m[4] || "";
259
+ if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) {
260
+ port = "";
261
+ }
262
+ return proto + "//" + domain + port;
263
+ }
264
+
265
+ /**
266
+ * Resolves a relative url into an absolute one.
267
+ * @param {String} url The path to resolve.
268
+ * @return {String} The resolved url.
269
+ */
270
+ function resolveUrl(url){
271
+
272
+ // replace all // except the one in proto with /
273
+ url = url.replace(reDoubleSlash, "$1/");
274
+
275
+ // If the url is a valid url we do nothing
276
+ if (!url.match(/^(http||https):\/\//)) {
277
+ // If this is a relative path
278
+ var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
279
+ if (path.substring(path.length - 1) !== "/") {
280
+ path = path.substring(0, path.lastIndexOf("/") + 1);
281
+ }
282
+
283
+ url = location.protocol + "//" + location.host + path + url;
284
+ }
285
+
286
+ // reduce all 'xyz/../' to just ''
287
+ while (reParent.test(url)) {
288
+ url = url.replace(reParent, "");
289
+ }
290
+
291
+ return url;
292
+ }
293
+
294
+ /**
295
+ * Appends the parameters to the given url.<br/>
296
+ * The base url can contain existing query parameters.
297
+ * @param {String} url The base url.
298
+ * @param {Object} parameters The parameters to add.
299
+ * @return {String} A new valid url with the parameters appended.
300
+ */
301
+ function appendQueryParameters(url, parameters){
302
+
303
+ var hash = "", indexOf = url.indexOf("#");
304
+ if (indexOf !== -1) {
305
+ hash = url.substring(indexOf);
306
+ url = url.substring(0, indexOf);
307
+ }
308
+ var q = [];
309
+ for (var key in parameters) {
310
+ if (parameters.hasOwnProperty(key)) {
311
+ q.push(key + "=" + encodeURIComponent(parameters[key]));
312
+ }
313
+ }
314
+ return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash;
315
+ }
316
+
317
+
318
+ // build the query object either from location.query, if it contains the xdm_e argument, or from location.hash
319
+ var query = (function(input){
320
+ input = input.substring(1).split("&");
321
+ var data = {}, pair, i = input.length;
322
+ while (i--) {
323
+ pair = input[i].split("=");
324
+ data[pair[0]] = decodeURIComponent(pair[1]);
325
+ }
326
+ return data;
327
+ }(/xdm_e=/.test(location.search) ? location.search : location.hash));
328
+
329
+ /*
330
+ * Helper methods
331
+ */
332
+ /**
333
+ * Helper for checking if a variable/property is undefined
334
+ * @param {Object} v The variable to test
335
+ * @return {Boolean} True if the passed variable is undefined
336
+ */
337
+ function undef(v){
338
+ return typeof v === "undefined";
339
+ }
340
+
341
+ /**
342
+ * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
343
+ * @return {JSON} A valid JSON conforming object, or null if not found.
344
+ */
345
+ var getJSON = function(){
346
+ var cached = {};
347
+ var obj = {
348
+ a: [1, 2, 3]
349
+ }, json = "{\"a\":[1,2,3]}";
350
+
351
+ if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
352
+ // this is a working JSON instance
353
+ return JSON;
354
+ }
355
+ if (Object.toJSON) {
356
+ if (Object.toJSON(obj).replace((/\s/g), "") === json) {
357
+ // this is a working stringify method
358
+ cached.stringify = Object.toJSON;
359
+ }
360
+ }
361
+
362
+ if (typeof String.prototype.evalJSON === "function") {
363
+ obj = json.evalJSON();
364
+ if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
365
+ // this is a working parse method
366
+ cached.parse = function(str){
367
+ return str.evalJSON();
368
+ };
369
+ }
370
+ }
371
+
372
+ if (cached.stringify && cached.parse) {
373
+ // Only memoize the result if we have valid instance
374
+ getJSON = function(){
375
+ return cached;
376
+ };
377
+ return cached;
378
+ }
379
+ return null;
380
+ };
381
+
382
+ /**
383
+ * Applies properties from the source object to the target object.<br/>
384
+ * @param {Object} target The target of the properties.
385
+ * @param {Object} source The source of the properties.
386
+ * @param {Boolean} noOverwrite Set to True to only set non-existing properties.
387
+ */
388
+ function apply(destination, source, noOverwrite){
389
+ var member;
390
+ for (var prop in source) {
391
+ if (source.hasOwnProperty(prop)) {
392
+ if (prop in destination) {
393
+ member = source[prop];
394
+ if (typeof member === "object") {
395
+ apply(destination[prop], member, noOverwrite);
396
+ }
397
+ else if (!noOverwrite) {
398
+ destination[prop] = source[prop];
399
+ }
400
+ }
401
+ else {
402
+ destination[prop] = source[prop];
403
+ }
404
+ }
405
+ }
406
+ return destination;
407
+ }
408
+
409
+ // This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName].
410
+ function testForNamePropertyBug(){
411
+ var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
412
+ input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
413
+ HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
414
+ document.body.removeChild(form);
415
+ }
416
+
417
+ /**
418
+ * Creates a frame and appends it to the DOM.
419
+ * @param config {object} This object can have the following properties
420
+ * <ul>
421
+ * <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
422
+ * <li> {object} attr The attributes that should be set on the frame.</li>
423
+ * <li> {DOMElement} container Its parent element (Optional).</li>
424
+ * <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
425
+ * </ul>
426
+ * @return The frames DOMElement
427
+ * @type DOMElement
428
+ */
429
+ function createFrame(config){
430
+ if (undef(HAS_NAME_PROPERTY_BUG)) {
431
+ testForNamePropertyBug();
432
+ }
433
+ var frame;
434
+ // This is to work around the problems in IE6/7 with setting the name property.
435
+ // Internally this is set as 'submitName' instead when using 'iframe.name = ...'
436
+ // This is not required by easyXDM itself, but is to facilitate other use cases
437
+ if (HAS_NAME_PROPERTY_BUG) {
438
+ frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
439
+ }
440
+ else {
441
+ frame = document.createElement("IFRAME");
442
+ frame.name = config.props.name;
443
+ }
444
+
445
+ frame.id = frame.name = config.props.name;
446
+ delete config.props.name;
447
+
448
+ if (typeof config.container == "string") {
449
+ config.container = document.getElementById(config.container);
450
+ }
451
+
452
+ if (!config.container) {
453
+ // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
454
+ apply(frame.style, {
455
+ position: "absolute",
456
+ top: "-2000px",
457
+ // Avoid potential horizontal scrollbar
458
+ left: "0px"
459
+ });
460
+ config.container = document.body;
461
+ }
462
+
463
+ // HACK: IE cannot have the src attribute set when the frame is appended
464
+ // into the container, so we set it to "javascript:false" as a
465
+ // placeholder for now. If we left the src undefined, it would
466
+ // instead default to "about:blank", which causes SSL mixed-content
467
+ // warnings in IE6 when on an SSL parent page.
468
+ var src = config.props.src;
469
+ config.props.src = "javascript:false";
470
+
471
+ // transfer properties to the frame
472
+ apply(frame, config.props);
473
+
474
+ frame.border = frame.frameBorder = 0;
475
+ frame.allowTransparency = true;
476
+ config.container.appendChild(frame);
477
+
478
+ if (config.onLoad) {
479
+ on(frame, "load", config.onLoad);
480
+ }
481
+
482
+ // set the frame URL to the proper value (we previously set it to
483
+ // "javascript:false" to work around the IE issue mentioned above)
484
+ if(config.usePost) {
485
+ var form = config.container.appendChild(document.createElement('form')), input;
486
+ form.target = frame.name;
487
+ form.action = src;
488
+ form.method = 'POST';
489
+ if (typeof(config.usePost) === 'object') {
490
+ for (var i in config.usePost) {
491
+ if (config.usePost.hasOwnProperty(i)) {
492
+ if (HAS_NAME_PROPERTY_BUG) {
493
+ input = document.createElement('<input name="' + i + '"/>');
494
+ } else {
495
+ input = document.createElement("INPUT");
496
+ input.name = i;
497
+ }
498
+ input.value = config.usePost[i];
499
+ form.appendChild(input);
500
+ }
501
+ }
502
+ }
503
+ form.submit();
504
+ form.parentNode.removeChild(form);
505
+ } else {
506
+ frame.src = src;
507
+ }
508
+ config.props.src = src;
509
+
510
+ return frame;
511
+ }
512
+
513
+ /**
514
+ * Check whether a domain is allowed using an Access Control List.
515
+ * The ACL can contain * and ? as wildcards, or can be regular expressions.
516
+ * If regular expressions they need to begin with ^ and end with $.
517
+ * @param {Array/String} acl The list of allowed domains
518
+ * @param {String} domain The domain to test.
519
+ * @return {Boolean} True if the domain is allowed, false if not.
520
+ */
521
+ function checkAcl(acl, domain){
522
+ // normalize into an array
523
+ if (typeof acl == "string") {
524
+ acl = [acl];
525
+ }
526
+ var re, i = acl.length;
527
+ while (i--) {
528
+ re = acl[i];
529
+ re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
530
+ if (re.test(domain)) {
531
+ return true;
532
+ }
533
+ }
534
+ return false;
535
+ }
536
+
537
+ /*
538
+ * Functions related to stacks
539
+ */
540
+ /**
541
+ * Prepares an array of stack-elements suitable for the current configuration
542
+ * @param {Object} config The Transports configuration. See easyXDM.Socket for more.
543
+ * @return {Array} An array of stack-elements with the TransportElement at index 0.
544
+ */
545
+ function prepareTransportStack(config){
546
+ var protocol = config.protocol, stackEls;
547
+ config.isHost = config.isHost || undef(query.xdm_p);
548
+ useHash = config.hash || false;
549
+
550
+ if (!config.props) {
551
+ config.props = {};
552
+ }
553
+ if (!config.isHost) {
554
+ config.channel = query.xdm_c.replace(/["'<>\\]/g, "");
555
+ config.secret = query.xdm_s;
556
+ config.remote = query.xdm_e.replace(/["'<>\\]/g, "");
557
+ ;
558
+ protocol = query.xdm_p;
559
+ if (config.acl && !checkAcl(config.acl, config.remote)) {
560
+ throw new Error("Access denied for " + config.remote);
561
+ }
562
+ }
563
+ else {
564
+ config.remote = resolveUrl(config.remote);
565
+ config.channel = config.channel || "default" + channelId++;
566
+ config.secret = Math.random().toString(16).substring(2);
567
+ if (undef(protocol)) {
568
+ if (getLocation(location.href) == getLocation(config.remote)) {
569
+ /*
570
+ * Both documents has the same origin, lets use direct access.
571
+ */
572
+ protocol = "4";
573
+ }
574
+ else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) {
575
+ /*
576
+ * This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+
577
+ */
578
+ protocol = "1";
579
+ }
580
+ else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) {
581
+ /*
582
+ * The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS
583
+ */
584
+ protocol = "6";
585
+ }
586
+ else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) {
587
+ /*
588
+ * This is supported in Gecko (Firefox 1+)
589
+ */
590
+ protocol = "5";
591
+ }
592
+ else if (config.remoteHelper) {
593
+ /*
594
+ * This is supported in all browsers that retains the value of window.name when
595
+ * navigating from one domain to another, and where parent.frames[foo] can be used
596
+ * to get access to a frame from the same domain
597
+ */
598
+ protocol = "2";
599
+ }
600
+ else {
601
+ /*
602
+ * This is supported in all browsers where [window].location is writable for all
603
+ * The resize event will be used if resize is supported and the iframe is not put
604
+ * into a container, else polling will be used.
605
+ */
606
+ protocol = "0";
607
+ }
608
+ }
609
+ }
610
+ config.protocol = protocol; // for conditional branching
611
+ switch (protocol) {
612
+ case "0":// 0 = HashTransport
613
+ apply(config, {
614
+ interval: 100,
615
+ delay: 2000,
616
+ useResize: true,
617
+ useParent: false,
618
+ usePolling: false
619
+ }, true);
620
+ if (config.isHost) {
621
+ if (!config.local) {
622
+ // If no local is set then we need to find an image hosted on the current domain
623
+ var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image;
624
+ var i = images.length;
625
+ while (i--) {
626
+ image = images[i];
627
+ if (image.src.substring(0, domain.length) === domain) {
628
+ config.local = image.src;
629
+ break;
630
+ }
631
+ }
632
+ if (!config.local) {
633
+ // If no local was set, and we are unable to find a suitable file, then we resort to using the current window
634
+ config.local = window;
635
+ }
636
+ }
637
+
638
+ var parameters = {
639
+ xdm_c: config.channel,
640
+ xdm_p: 0
641
+ };
642
+
643
+ if (config.local === window) {
644
+ // We are using the current window to listen to
645
+ config.usePolling = true;
646
+ config.useParent = true;
647
+ config.local = location.protocol + "//" + location.host + location.pathname + location.search;
648
+ parameters.xdm_e = config.local;
649
+ parameters.xdm_pa = 1; // use parent
650
+ }
651
+ else {
652
+ parameters.xdm_e = resolveUrl(config.local);
653
+ }
654
+
655
+ if (config.container) {
656
+ config.useResize = false;
657
+ parameters.xdm_po = 1; // use polling
658
+ }
659
+ config.remote = appendQueryParameters(config.remote, parameters);
660
+ }
661
+ else {
662
+ apply(config, {
663
+ channel: query.xdm_c,
664
+ remote: query.xdm_e,
665
+ useParent: !undef(query.xdm_pa),
666
+ usePolling: !undef(query.xdm_po),
667
+ useResize: config.useParent ? false : config.useResize
668
+ });
669
+ }
670
+ stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({
671
+ encode: true,
672
+ maxLength: 4000 - config.remote.length
673
+ }), new easyXDM.stack.VerifyBehavior({
674
+ initiate: config.isHost
675
+ })];
676
+ break;
677
+ case "1":
678
+ stackEls = [new easyXDM.stack.PostMessageTransport(config)];
679
+ break;
680
+ case "2":
681
+ config.remoteHelper = resolveUrl(config.remoteHelper);
682
+ stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({
683
+ initiate: config.isHost
684
+ })];
685
+ break;
686
+ case "3":
687
+ stackEls = [new easyXDM.stack.NixTransport(config)];
688
+ break;
689
+ case "4":
690
+ stackEls = [new easyXDM.stack.SameOriginTransport(config)];
691
+ break;
692
+ case "5":
693
+ stackEls = [new easyXDM.stack.FrameElementTransport(config)];
694
+ break;
695
+ case "6":
696
+ if (!flashVersion) {
697
+ hasFlash();
698
+ }
699
+ stackEls = [new easyXDM.stack.FlashTransport(config)];
700
+ break;
701
+ }
702
+ // this behavior is responsible for buffering outgoing messages, and for performing lazy initialization
703
+ stackEls.push(new easyXDM.stack.QueueBehavior({
704
+ lazy: config.lazy,
705
+ remove: true
706
+ }));
707
+ return stackEls;
708
+ }
709
+
710
+ /**
711
+ * Chains all the separate stack elements into a single usable stack.<br/>
712
+ * If an element is missing a necessary method then it will have a pass-through method applied.
713
+ * @param {Array} stackElements An array of stack elements to be linked.
714
+ * @return {easyXDM.stack.StackElement} The last element in the chain.
715
+ */
716
+ function chainStack(stackElements){
717
+ var stackEl, defaults = {
718
+ incoming: function(message, origin){
719
+ this.up.incoming(message, origin);
720
+ },
721
+ outgoing: function(message, recipient){
722
+ this.down.outgoing(message, recipient);
723
+ },
724
+ callback: function(success){
725
+ this.up.callback(success);
726
+ },
727
+ init: function(){
728
+ this.down.init();
729
+ },
730
+ destroy: function(){
731
+ this.down.destroy();
732
+ }
733
+ };
734
+ for (var i = 0, len = stackElements.length; i < len; i++) {
735
+ stackEl = stackElements[i];
736
+ apply(stackEl, defaults, true);
737
+ if (i !== 0) {
738
+ stackEl.down = stackElements[i - 1];
739
+ }
740
+ if (i !== len - 1) {
741
+ stackEl.up = stackElements[i + 1];
742
+ }
743
+ }
744
+ return stackEl;
745
+ }
746
+
747
+ /**
748
+ * This will remove a stackelement from its stack while leaving the stack functional.
749
+ * @param {Object} element The elment to remove from the stack.
750
+ */
751
+ function removeFromStack(element){
752
+ element.up.down = element.down;
753
+ element.down.up = element.up;
754
+ element.up = element.down = null;
755
+ }
756
+
757
+ /*
758
+ * Export the main object and any other methods applicable
759
+ */
760
+ /**
761
+ * @class easyXDM
762
+ * A javascript library providing cross-browser, cross-domain messaging/RPC.
763
+ * @version 2.4.17.0
764
+ * @singleton
765
+ */
766
+ apply(easyXDM, {
767
+ /**
768
+ * The version of the library
769
+ * @type {string}
770
+ */
771
+ version: "2.4.17.0",
772
+ /**
773
+ * This is a map containing all the query parameters passed to the document.
774
+ * All the values has been decoded using decodeURIComponent.
775
+ * @type {object}
776
+ */
777
+ query: query,
778
+ /**
779
+ * @private
780
+ */
781
+ stack: {},
782
+ /**
783
+ * Applies properties from the source object to the target object.<br/>
784
+ * @param {object} target The target of the properties.
785
+ * @param {object} source The source of the properties.
786
+ * @param {boolean} noOverwrite Set to True to only set non-existing properties.
787
+ */
788
+ apply: apply,
789
+
790
+ /**
791
+ * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
792
+ * @return {JSON} A valid JSON conforming object, or null if not found.
793
+ */
794
+ getJSONObject: getJSON,
795
+ /**
796
+ * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
797
+ * If functions are added after this event then they will be executed immediately.
798
+ * @param {function} fn The function to add
799
+ * @param {object} scope An optional scope for the function to be called with.
800
+ */
801
+ whenReady: whenReady,
802
+ /**
803
+ * Removes easyXDM variable from the global scope. It also returns control
804
+ * of the easyXDM variable to whatever code used it before.
805
+ *
806
+ * @param {String} ns A string representation of an object that will hold
807
+ * an instance of easyXDM.
808
+ * @return An instance of easyXDM
809
+ */
810
+ noConflict: noConflict
811
+ });
812
+
813
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
814
+ /*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */
815
+ //
816
+ // easyXDM
817
+ // http://easyxdm.net/
818
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
819
+ //
820
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
821
+ // of this software and associated documentation files (the "Software"), to deal
822
+ // in the Software without restriction, including without limitation the rights
823
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
824
+ // copies of the Software, and to permit persons to whom the Software is
825
+ // furnished to do so, subject to the following conditions:
826
+ //
827
+ // The above copyright notice and this permission notice shall be included in
828
+ // all copies or substantial portions of the Software.
829
+ //
830
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
831
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
832
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
833
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
834
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
835
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
836
+ // THE SOFTWARE.
837
+ //
838
+
839
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
840
+ /*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */
841
+ //
842
+ // easyXDM
843
+ // http://easyxdm.net/
844
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
845
+ //
846
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
847
+ // of this software and associated documentation files (the "Software"), to deal
848
+ // in the Software without restriction, including without limitation the rights
849
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
850
+ // copies of the Software, and to permit persons to whom the Software is
851
+ // furnished to do so, subject to the following conditions:
852
+ //
853
+ // The above copyright notice and this permission notice shall be included in
854
+ // all copies or substantial portions of the Software.
855
+ //
856
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
857
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
858
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
859
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
860
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
861
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
862
+ // THE SOFTWARE.
863
+ //
864
+
865
+ /**
866
+ * @class easyXDM.DomHelper
867
+ * Contains methods for dealing with the DOM
868
+ * @singleton
869
+ */
870
+ easyXDM.DomHelper = {
871
+ /**
872
+ * Provides a consistent interface for adding eventhandlers
873
+ * @param {Object} target The target to add the event to
874
+ * @param {String} type The name of the event
875
+ * @param {Function} listener The listener
876
+ */
877
+ on: on,
878
+ /**
879
+ * Provides a consistent interface for removing eventhandlers
880
+ * @param {Object} target The target to remove the event from
881
+ * @param {String} type The name of the event
882
+ * @param {Function} listener The listener
883
+ */
884
+ un: un,
885
+ /**
886
+ * Checks for the presence of the JSON object.
887
+ * If it is not present it will use the supplied path to load the JSON2 library.
888
+ * This should be called in the documents head right after the easyXDM script tag.
889
+ * http://json.org/json2.js
890
+ * @param {String} path A valid path to json2.js
891
+ */
892
+ requiresJSON: function(path){
893
+ if (!isHostObject(window, "JSON")) {
894
+ // we need to encode the < in order to avoid an illegal token error
895
+ // when the script is inlined in a document.
896
+ document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
897
+ }
898
+ }
899
+ };
900
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
901
+ /*global easyXDM, window, escape, unescape, debug */
902
+ //
903
+ // easyXDM
904
+ // http://easyxdm.net/
905
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
906
+ //
907
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
908
+ // of this software and associated documentation files (the "Software"), to deal
909
+ // in the Software without restriction, including without limitation the rights
910
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
911
+ // copies of the Software, and to permit persons to whom the Software is
912
+ // furnished to do so, subject to the following conditions:
913
+ //
914
+ // The above copyright notice and this permission notice shall be included in
915
+ // all copies or substantial portions of the Software.
916
+ //
917
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
918
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
920
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
921
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
922
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
923
+ // THE SOFTWARE.
924
+ //
925
+
926
+ (function(){
927
+ // The map containing the stored functions
928
+ var _map = {};
929
+
930
+ /**
931
+ * @class easyXDM.Fn
932
+ * This contains methods related to function handling, such as storing callbacks.
933
+ * @singleton
934
+ * @namespace easyXDM
935
+ */
936
+ easyXDM.Fn = {
937
+ /**
938
+ * Stores a function using the given name for reference
939
+ * @param {String} name The name that the function should be referred by
940
+ * @param {Function} fn The function to store
941
+ * @namespace easyXDM.fn
942
+ */
943
+ set: function(name, fn){
944
+ _map[name] = fn;
945
+ },
946
+ /**
947
+ * Retrieves the function referred to by the given name
948
+ * @param {String} name The name of the function to retrieve
949
+ * @param {Boolean} del If the function should be deleted after retrieval
950
+ * @return {Function} The stored function
951
+ * @namespace easyXDM.fn
952
+ */
953
+ get: function(name, del){
954
+ var fn = _map[name];
955
+
956
+ if (del) {
957
+ delete _map[name];
958
+ }
959
+ return fn;
960
+ }
961
+ };
962
+
963
+ }());
964
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
965
+ /*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */
966
+ //
967
+ // easyXDM
968
+ // http://easyxdm.net/
969
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
970
+ //
971
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
972
+ // of this software and associated documentation files (the "Software"), to deal
973
+ // in the Software without restriction, including without limitation the rights
974
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
975
+ // copies of the Software, and to permit persons to whom the Software is
976
+ // furnished to do so, subject to the following conditions:
977
+ //
978
+ // The above copyright notice and this permission notice shall be included in
979
+ // all copies or substantial portions of the Software.
980
+ //
981
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
982
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
983
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
984
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
985
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
986
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
987
+ // THE SOFTWARE.
988
+ //
989
+
990
+ /**
991
+ * @class easyXDM.Socket
992
+ * This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/>
993
+ * The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/>
994
+ * Internally different stacks will be used depending on the browsers features and the available parameters.
995
+ * <h2>How to set up</h2>
996
+ * Setting up the provider:
997
+ * <pre><code>
998
+ * var socket = new easyXDM.Socket({
999
+ * &nbsp; local: "name.html",
1000
+ * &nbsp; onReady: function(){
1001
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
1002
+ * &nbsp; &nbsp; socket.postMessage("foo-message");
1003
+ * &nbsp; },
1004
+ * &nbsp; onMessage: function(message, origin) {
1005
+ * &nbsp;&nbsp; alert("received " + message + " from " + origin);
1006
+ * &nbsp; }
1007
+ * });
1008
+ * </code></pre>
1009
+ * Setting up the consumer:
1010
+ * <pre><code>
1011
+ * var socket = new easyXDM.Socket({
1012
+ * &nbsp; remote: "http:&#47;&#47;remotedomain/page.html",
1013
+ * &nbsp; remoteHelper: "http:&#47;&#47;remotedomain/name.html",
1014
+ * &nbsp; onReady: function(){
1015
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
1016
+ * &nbsp; &nbsp; socket.postMessage("foo-message");
1017
+ * &nbsp; },
1018
+ * &nbsp; onMessage: function(message, origin) {
1019
+ * &nbsp;&nbsp; alert("received " + message + " from " + origin);
1020
+ * &nbsp; }
1021
+ * });
1022
+ * </code></pre>
1023
+ * If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property
1024
+ * and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports.
1025
+ * @namespace easyXDM
1026
+ * @constructor
1027
+ * @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window.
1028
+ * @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed.
1029
+ * @cfg {String} remote (Consumer only) The url to the providers document.
1030
+ * @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional.
1031
+ * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000.
1032
+ * @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300.
1033
+ * @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional.
1034
+ * @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional.
1035
+ * @cfg {Function} onReady A method that should be called when the transport is ready. Optional.
1036
+ * @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional.
1037
+ * @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/>
1038
+ * This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $.
1039
+ * If none of the patterns match an Error will be thrown.
1040
+ * @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>.
1041
+ * Properties such as 'name' and 'src' will be overrided. Optional.
1042
+ */
1043
+ easyXDM.Socket = function(config){
1044
+
1045
+ // create the stack
1046
+ var stack = chainStack(prepareTransportStack(config).concat([{
1047
+ incoming: function(message, origin){
1048
+ config.onMessage(message, origin);
1049
+ },
1050
+ callback: function(success){
1051
+ if (config.onReady) {
1052
+ config.onReady(success);
1053
+ }
1054
+ }
1055
+ }])), recipient = getLocation(config.remote);
1056
+
1057
+ // set the origin
1058
+ this.origin = getLocation(config.remote);
1059
+
1060
+ /**
1061
+ * Initiates the destruction of the stack.
1062
+ */
1063
+ this.destroy = function(){
1064
+ stack.destroy();
1065
+ };
1066
+
1067
+ /**
1068
+ * Posts a message to the remote end of the channel
1069
+ * @param {String} message The message to send
1070
+ */
1071
+ this.postMessage = function(message){
1072
+ stack.outgoing(message, recipient);
1073
+ };
1074
+
1075
+ stack.init();
1076
+ };
1077
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1078
+ /*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */
1079
+ //
1080
+ // easyXDM
1081
+ // http://easyxdm.net/
1082
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1083
+ //
1084
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1085
+ // of this software and associated documentation files (the "Software"), to deal
1086
+ // in the Software without restriction, including without limitation the rights
1087
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1088
+ // copies of the Software, and to permit persons to whom the Software is
1089
+ // furnished to do so, subject to the following conditions:
1090
+ //
1091
+ // The above copyright notice and this permission notice shall be included in
1092
+ // all copies or substantial portions of the Software.
1093
+ //
1094
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1095
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1096
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1097
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1098
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1099
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1100
+ // THE SOFTWARE.
1101
+ //
1102
+
1103
+ /**
1104
+ * @class easyXDM.Rpc
1105
+ * Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation
1106
+ * of methods to be called from the remote end.<br/>
1107
+ * The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/>
1108
+ * This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods.
1109
+ * <h2>How to set up</h2>
1110
+ * <pre><code>
1111
+ * var rpc = new easyXDM.Rpc({
1112
+ * &nbsp; &#47;&#47; this configuration is equal to that used by the Socket.
1113
+ * &nbsp; remote: "http:&#47;&#47;remotedomain/...",
1114
+ * &nbsp; onReady: function(){
1115
+ * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the proxy
1116
+ * &nbsp; &nbsp; rpc.foo(...
1117
+ * &nbsp; }
1118
+ * },{
1119
+ * &nbsp; local: {..},
1120
+ * &nbsp; remote: {..}
1121
+ * });
1122
+ * </code></pre>
1123
+ *
1124
+ * <h2>Exposing functions (procedures)</h2>
1125
+ * <pre><code>
1126
+ * var rpc = new easyXDM.Rpc({
1127
+ * &nbsp; ...
1128
+ * },{
1129
+ * &nbsp; local: {
1130
+ * &nbsp; &nbsp; nameOfMethod: {
1131
+ * &nbsp; &nbsp; &nbsp; method: function(arg1, arg2, success, error){
1132
+ * &nbsp; &nbsp; &nbsp; &nbsp; ...
1133
+ * &nbsp; &nbsp; &nbsp; }
1134
+ * &nbsp; &nbsp; },
1135
+ * &nbsp; &nbsp; &#47;&#47; with shorthand notation
1136
+ * &nbsp; &nbsp; nameOfAnotherMethod: function(arg1, arg2, success, error){
1137
+ * &nbsp; &nbsp; }
1138
+ * &nbsp; },
1139
+ * &nbsp; remote: {...}
1140
+ * });
1141
+ * </code></pre>
1142
+
1143
+ * The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/>
1144
+ * To send a successfull result back you can use
1145
+ * <pre><code>
1146
+ * return foo;
1147
+ * </pre></code>
1148
+ * or
1149
+ * <pre><code>
1150
+ * success(foo);
1151
+ * </pre></code>
1152
+ * To return an error you can use
1153
+ * <pre><code>
1154
+ * throw new Error("foo error");
1155
+ * </code></pre>
1156
+ * or
1157
+ * <pre><code>
1158
+ * error("foo error");
1159
+ * </code></pre>
1160
+ *
1161
+ * <h2>Defining remotely exposed methods (procedures/notifications)</h2>
1162
+ * The definition of the remote end is quite similar:
1163
+ * <pre><code>
1164
+ * var rpc = new easyXDM.Rpc({
1165
+ * &nbsp; ...
1166
+ * },{
1167
+ * &nbsp; local: {...},
1168
+ * &nbsp; remote: {
1169
+ * &nbsp; &nbsp; nameOfMethod: {}
1170
+ * &nbsp; }
1171
+ * });
1172
+ * </code></pre>
1173
+ * To call a remote method use
1174
+ * <pre><code>
1175
+ * rpc.nameOfMethod("arg1", "arg2", function(value) {
1176
+ * &nbsp; alert("success: " + value);
1177
+ * }, function(message) {
1178
+ * &nbsp; alert("error: " + message + );
1179
+ * });
1180
+ * </code></pre>
1181
+ * Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/>
1182
+ * When called with no callback a JSON-RPC 2.0 notification will be executed.
1183
+ * Be aware that you will not be notified of any errors with this method.
1184
+ * <br/>
1185
+ * <h2>Specifying a custom serializer</h2>
1186
+ * If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library
1187
+ * then you can specify a custom serializer using <code>serializer: foo</code>
1188
+ * <pre><code>
1189
+ * var rpc = new easyXDM.Rpc({
1190
+ * &nbsp; ...
1191
+ * },{
1192
+ * &nbsp; local: {...},
1193
+ * &nbsp; remote: {...},
1194
+ * &nbsp; serializer : {
1195
+ * &nbsp; &nbsp; parse: function(string){ ... },
1196
+ * &nbsp; &nbsp; stringify: function(object) {...}
1197
+ * &nbsp; }
1198
+ * });
1199
+ * </code></pre>
1200
+ * If <code>serializer</code> is set then the class will not attempt to use the native implementation.
1201
+ * @namespace easyXDM
1202
+ * @constructor
1203
+ * @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters.
1204
+ * @param {Object} jsonRpcConfig The description of the interface to implement.
1205
+ */
1206
+ easyXDM.Rpc = function(config, jsonRpcConfig){
1207
+
1208
+ // expand shorthand notation
1209
+ if (jsonRpcConfig.local) {
1210
+ for (var method in jsonRpcConfig.local) {
1211
+ if (jsonRpcConfig.local.hasOwnProperty(method)) {
1212
+ var member = jsonRpcConfig.local[method];
1213
+ if (typeof member === "function") {
1214
+ jsonRpcConfig.local[method] = {
1215
+ method: member
1216
+ };
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+
1222
+ // create the stack
1223
+ var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), {
1224
+ callback: function(success){
1225
+ if (config.onReady) {
1226
+ config.onReady(success);
1227
+ }
1228
+ }
1229
+ }]));
1230
+
1231
+ // set the origin
1232
+ this.origin = getLocation(config.remote);
1233
+
1234
+
1235
+ /**
1236
+ * Initiates the destruction of the stack.
1237
+ */
1238
+ this.destroy = function(){
1239
+ stack.destroy();
1240
+ };
1241
+
1242
+ stack.init();
1243
+ };
1244
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1245
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/
1246
+ //
1247
+ // easyXDM
1248
+ // http://easyxdm.net/
1249
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1250
+ //
1251
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1252
+ // of this software and associated documentation files (the "Software"), to deal
1253
+ // in the Software without restriction, including without limitation the rights
1254
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1255
+ // copies of the Software, and to permit persons to whom the Software is
1256
+ // furnished to do so, subject to the following conditions:
1257
+ //
1258
+ // The above copyright notice and this permission notice shall be included in
1259
+ // all copies or substantial portions of the Software.
1260
+ //
1261
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1262
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1263
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1264
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1265
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1266
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1267
+ // THE SOFTWARE.
1268
+ //
1269
+
1270
+ /**
1271
+ * @class easyXDM.stack.SameOriginTransport
1272
+ * SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/>
1273
+ * This can be useful for testing and for when the main application supports both internal and external sources.
1274
+ * @namespace easyXDM.stack
1275
+ * @constructor
1276
+ * @param {Object} config The transports configuration.
1277
+ * @cfg {String} remote The remote document to communicate with.
1278
+ */
1279
+ easyXDM.stack.SameOriginTransport = function(config){
1280
+ var pub, frame, send, targetOrigin;
1281
+
1282
+ return (pub = {
1283
+ outgoing: function(message, domain, fn){
1284
+ send(message);
1285
+ if (fn) {
1286
+ fn();
1287
+ }
1288
+ },
1289
+ destroy: function(){
1290
+ if (frame) {
1291
+ frame.parentNode.removeChild(frame);
1292
+ frame = null;
1293
+ }
1294
+ },
1295
+ onDOMReady: function(){
1296
+ targetOrigin = getLocation(config.remote);
1297
+
1298
+ if (config.isHost) {
1299
+ // set up the iframe
1300
+ apply(config.props, {
1301
+ src: appendQueryParameters(config.remote, {
1302
+ xdm_e: location.protocol + "//" + location.host + location.pathname,
1303
+ xdm_c: config.channel,
1304
+ xdm_p: 4 // 4 = SameOriginTransport
1305
+ }),
1306
+ name: IFRAME_PREFIX + config.channel + "_provider"
1307
+ });
1308
+ frame = createFrame(config);
1309
+ easyXDM.Fn.set(config.channel, function(sendFn){
1310
+ send = sendFn;
1311
+ setTimeout(function(){
1312
+ pub.up.callback(true);
1313
+ }, 0);
1314
+ return function(msg){
1315
+ pub.up.incoming(msg, targetOrigin);
1316
+ };
1317
+ });
1318
+ }
1319
+ else {
1320
+ send = getParentObject().Fn.get(config.channel, true)(function(msg){
1321
+ pub.up.incoming(msg, targetOrigin);
1322
+ });
1323
+ setTimeout(function(){
1324
+ pub.up.callback(true);
1325
+ }, 0);
1326
+ }
1327
+ },
1328
+ init: function(){
1329
+ whenReady(pub.onDOMReady, pub);
1330
+ }
1331
+ });
1332
+ };
1333
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1334
+ /*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/
1335
+ //
1336
+ // easyXDM
1337
+ // http://easyxdm.net/
1338
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1339
+ //
1340
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1341
+ // of this software and associated documentation files (the "Software"), to deal
1342
+ // in the Software without restriction, including without limitation the rights
1343
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1344
+ // copies of the Software, and to permit persons to whom the Software is
1345
+ // furnished to do so, subject to the following conditions:
1346
+ //
1347
+ // The above copyright notice and this permission notice shall be included in
1348
+ // all copies or substantial portions of the Software.
1349
+ //
1350
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1351
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1352
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1353
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1354
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1355
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1356
+ // THE SOFTWARE.
1357
+ //
1358
+
1359
+ /**
1360
+ * @class easyXDM.stack.FlashTransport
1361
+ * FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth.
1362
+ * @namespace easyXDM.stack
1363
+ * @constructor
1364
+ * @param {Object} config The transports configuration.
1365
+ * @cfg {String} remote The remote domain to communicate with.
1366
+ * @cfg {String} secret the pre-shared secret used to secure the communication.
1367
+ * @cfg {String} swf The path to the swf file
1368
+ * @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden.
1369
+ * @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed
1370
+ */
1371
+ easyXDM.stack.FlashTransport = function(config){
1372
+ var pub, // the public interface
1373
+ frame, send, targetOrigin, swf, swfContainer;
1374
+
1375
+ function onMessage(message, origin){
1376
+ setTimeout(function(){
1377
+ pub.up.incoming(message, targetOrigin);
1378
+ }, 0);
1379
+ }
1380
+
1381
+ /**
1382
+ * This method adds the SWF to the DOM and prepares the initialization of the channel
1383
+ */
1384
+ function addSwf(domain){
1385
+ // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.
1386
+ var url = config.swf + "?host=" + config.isHost;
1387
+ var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000);
1388
+
1389
+ // prepare the init function that will fire once the swf is ready
1390
+ easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){
1391
+ easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild;
1392
+ var queue = easyXDM.stack.FlashTransport[domain].queue;
1393
+ for (var i = 0; i < queue.length; i++) {
1394
+ queue[i]();
1395
+ }
1396
+ queue.length = 0;
1397
+ });
1398
+
1399
+ if (config.swfContainer) {
1400
+ swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer;
1401
+ }
1402
+ else {
1403
+ // create the container that will hold the swf
1404
+ swfContainer = document.createElement('div');
1405
+
1406
+ // http://bugs.adobe.com/jira/browse/FP-4796
1407
+ // http://tech.groups.yahoo.com/group/flexcoders/message/162365
1408
+ // https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc
1409
+ apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? {
1410
+ height: "20px",
1411
+ width: "20px",
1412
+ position: "fixed",
1413
+ right: 0,
1414
+ top: 0
1415
+ } : {
1416
+ height: "1px",
1417
+ width: "1px",
1418
+ position: "absolute",
1419
+ overflow: "hidden",
1420
+ right: 0,
1421
+ top: 0
1422
+ });
1423
+ document.body.appendChild(swfContainer);
1424
+ }
1425
+
1426
+ // create the object/embed
1427
+ var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace;
1428
+ swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" +
1429
+ "<param name='allowScriptAccess' value='always'></param>" +
1430
+ "<param name='wmode' value='transparent'>" +
1431
+ "<param name='movie' value='" +
1432
+ url +
1433
+ "'></param>" +
1434
+ "<param name='flashvars' value='" +
1435
+ flashVars +
1436
+ "'></param>" +
1437
+ "<embed type='application/x-shockwave-flash' FlashVars='" +
1438
+ flashVars +
1439
+ "' allowScriptAccess='always' wmode='transparent' src='" +
1440
+ url +
1441
+ "' height='1' width='1'></embed>" +
1442
+ "</object>";
1443
+ }
1444
+
1445
+ return (pub = {
1446
+ outgoing: function(message, domain, fn){
1447
+ swf.postMessage(config.channel, message.toString());
1448
+ if (fn) {
1449
+ fn();
1450
+ }
1451
+ },
1452
+ destroy: function(){
1453
+ try {
1454
+ swf.destroyChannel(config.channel);
1455
+ }
1456
+ catch (e) {
1457
+ }
1458
+ swf = null;
1459
+ if (frame) {
1460
+ frame.parentNode.removeChild(frame);
1461
+ frame = null;
1462
+ }
1463
+ },
1464
+ onDOMReady: function(){
1465
+
1466
+ targetOrigin = config.remote;
1467
+
1468
+ // Prepare the code that will be run after the swf has been intialized
1469
+ easyXDM.Fn.set("flash_" + config.channel + "_init", function(){
1470
+ setTimeout(function(){
1471
+ pub.up.callback(true);
1472
+ });
1473
+ });
1474
+
1475
+ // set up the omMessage handler
1476
+ easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage);
1477
+
1478
+ config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths
1479
+ var swfdomain = getDomainName(config.swf);
1480
+ var fn = function(){
1481
+ // set init to true in case the fn was called was invoked from a separate instance
1482
+ easyXDM.stack.FlashTransport[swfdomain].init = true;
1483
+ swf = easyXDM.stack.FlashTransport[swfdomain].swf;
1484
+ // create the channel
1485
+ swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost);
1486
+
1487
+ if (config.isHost) {
1488
+ // if Flash is going to be throttled and we want to avoid this
1489
+ if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) {
1490
+ apply(config.props, {
1491
+ position: "fixed",
1492
+ right: 0,
1493
+ top: 0,
1494
+ height: "20px",
1495
+ width: "20px"
1496
+ });
1497
+ }
1498
+ // set up the iframe
1499
+ apply(config.props, {
1500
+ src: appendQueryParameters(config.remote, {
1501
+ xdm_e: getLocation(location.href),
1502
+ xdm_c: config.channel,
1503
+ xdm_p: 6, // 6 = FlashTransport
1504
+ xdm_s: config.secret
1505
+ }),
1506
+ name: IFRAME_PREFIX + config.channel + "_provider"
1507
+ });
1508
+ frame = createFrame(config);
1509
+ }
1510
+ };
1511
+
1512
+ if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) {
1513
+ // if the swf is in place and we are the consumer
1514
+ fn();
1515
+ }
1516
+ else {
1517
+ // if the swf does not yet exist
1518
+ if (!easyXDM.stack.FlashTransport[swfdomain]) {
1519
+ // add the queue to hold the init fn's
1520
+ easyXDM.stack.FlashTransport[swfdomain] = {
1521
+ queue: [fn]
1522
+ };
1523
+ addSwf(swfdomain);
1524
+ }
1525
+ else {
1526
+ easyXDM.stack.FlashTransport[swfdomain].queue.push(fn);
1527
+ }
1528
+ }
1529
+ },
1530
+ init: function(){
1531
+ whenReady(pub.onDOMReady, pub);
1532
+ }
1533
+ });
1534
+ };
1535
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1536
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
1537
+ //
1538
+ // easyXDM
1539
+ // http://easyxdm.net/
1540
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1541
+ //
1542
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1543
+ // of this software and associated documentation files (the "Software"), to deal
1544
+ // in the Software without restriction, including without limitation the rights
1545
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1546
+ // copies of the Software, and to permit persons to whom the Software is
1547
+ // furnished to do so, subject to the following conditions:
1548
+ //
1549
+ // The above copyright notice and this permission notice shall be included in
1550
+ // all copies or substantial portions of the Software.
1551
+ //
1552
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1553
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1554
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1555
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1556
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1557
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1558
+ // THE SOFTWARE.
1559
+ //
1560
+
1561
+ /**
1562
+ * @class easyXDM.stack.PostMessageTransport
1563
+ * PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/>
1564
+ * <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/>
1565
+ * <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a>
1566
+ * @namespace easyXDM.stack
1567
+ * @constructor
1568
+ * @param {Object} config The transports configuration.
1569
+ * @cfg {String} remote The remote domain to communicate with.
1570
+ */
1571
+ easyXDM.stack.PostMessageTransport = function(config){
1572
+ var pub, // the public interface
1573
+ frame, // the remote frame, if any
1574
+ callerWindow, // the window that we will call with
1575
+ targetOrigin; // the domain to communicate with
1576
+ /**
1577
+ * Resolves the origin from the event object
1578
+ * @private
1579
+ * @param {Object} event The messageevent
1580
+ * @return {String} The scheme, host and port of the origin
1581
+ */
1582
+ function _getOrigin(event){
1583
+ if (event.origin) {
1584
+ // This is the HTML5 property
1585
+ return getLocation(event.origin);
1586
+ }
1587
+ if (event.uri) {
1588
+ // From earlier implementations
1589
+ return getLocation(event.uri);
1590
+ }
1591
+ if (event.domain) {
1592
+ // This is the last option and will fail if the
1593
+ // origin is not using the same schema as we are
1594
+ return location.protocol + "//" + event.domain;
1595
+ }
1596
+ throw "Unable to retrieve the origin of the event";
1597
+ }
1598
+
1599
+ /**
1600
+ * This is the main implementation for the onMessage event.<br/>
1601
+ * It checks the validity of the origin and passes the message on if appropriate.
1602
+ * @private
1603
+ * @param {Object} event The messageevent
1604
+ */
1605
+ function _window_onMessage(event){
1606
+ var origin = _getOrigin(event);
1607
+ if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
1608
+ pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
1609
+ }
1610
+ }
1611
+
1612
+ return (pub = {
1613
+ outgoing: function(message, domain, fn){
1614
+ callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin);
1615
+ if (fn) {
1616
+ fn();
1617
+ }
1618
+ },
1619
+ destroy: function(){
1620
+ un(window, "message", _window_onMessage);
1621
+ if (frame) {
1622
+ callerWindow = null;
1623
+ frame.parentNode.removeChild(frame);
1624
+ frame = null;
1625
+ }
1626
+ },
1627
+ onDOMReady: function(){
1628
+ targetOrigin = getLocation(config.remote);
1629
+ if (config.isHost) {
1630
+ // add the event handler for listening
1631
+ var waitForReady = function(event){
1632
+ if (event.data == config.channel + "-ready") {
1633
+ // replace the eventlistener
1634
+ callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document;
1635
+ un(window, "message", waitForReady);
1636
+ on(window, "message", _window_onMessage);
1637
+ setTimeout(function(){
1638
+ pub.up.callback(true);
1639
+ }, 0);
1640
+ }
1641
+ };
1642
+ on(window, "message", waitForReady);
1643
+
1644
+ // set up the iframe
1645
+ apply(config.props, {
1646
+ src: appendQueryParameters(config.remote, {
1647
+ xdm_e: getLocation(location.href),
1648
+ xdm_c: config.channel,
1649
+ xdm_p: 1 // 1 = PostMessage
1650
+ }),
1651
+ name: IFRAME_PREFIX + config.channel + "_provider"
1652
+ });
1653
+ frame = createFrame(config);
1654
+ }
1655
+ else {
1656
+ // add the event handler for listening
1657
+ on(window, "message", _window_onMessage);
1658
+ callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document;
1659
+ callerWindow.postMessage(config.channel + "-ready", targetOrigin);
1660
+
1661
+ setTimeout(function(){
1662
+ pub.up.callback(true);
1663
+ }, 0);
1664
+ }
1665
+ },
1666
+ init: function(){
1667
+ whenReady(pub.onDOMReady, pub);
1668
+ }
1669
+ });
1670
+ };
1671
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1672
+ /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/
1673
+ //
1674
+ // easyXDM
1675
+ // http://easyxdm.net/
1676
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1677
+ //
1678
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1679
+ // of this software and associated documentation files (the "Software"), to deal
1680
+ // in the Software without restriction, including without limitation the rights
1681
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1682
+ // copies of the Software, and to permit persons to whom the Software is
1683
+ // furnished to do so, subject to the following conditions:
1684
+ //
1685
+ // The above copyright notice and this permission notice shall be included in
1686
+ // all copies or substantial portions of the Software.
1687
+ //
1688
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1689
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1690
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1691
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1692
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1693
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1694
+ // THE SOFTWARE.
1695
+ //
1696
+
1697
+ /**
1698
+ * @class easyXDM.stack.FrameElementTransport
1699
+ * FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/>
1700
+ * Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running.
1701
+ * @namespace easyXDM.stack
1702
+ * @constructor
1703
+ * @param {Object} config The transports configuration.
1704
+ * @cfg {String} remote The remote document to communicate with.
1705
+ */
1706
+ easyXDM.stack.FrameElementTransport = function(config){
1707
+ var pub, frame, send, targetOrigin;
1708
+
1709
+ return (pub = {
1710
+ outgoing: function(message, domain, fn){
1711
+ send.call(this, message);
1712
+ if (fn) {
1713
+ fn();
1714
+ }
1715
+ },
1716
+ destroy: function(){
1717
+ if (frame) {
1718
+ frame.parentNode.removeChild(frame);
1719
+ frame = null;
1720
+ }
1721
+ },
1722
+ onDOMReady: function(){
1723
+ targetOrigin = getLocation(config.remote);
1724
+
1725
+ if (config.isHost) {
1726
+ // set up the iframe
1727
+ apply(config.props, {
1728
+ src: appendQueryParameters(config.remote, {
1729
+ xdm_e: getLocation(location.href),
1730
+ xdm_c: config.channel,
1731
+ xdm_p: 5 // 5 = FrameElementTransport
1732
+ }),
1733
+ name: IFRAME_PREFIX + config.channel + "_provider"
1734
+ });
1735
+ frame = createFrame(config);
1736
+ frame.fn = function(sendFn){
1737
+ delete frame.fn;
1738
+ send = sendFn;
1739
+ setTimeout(function(){
1740
+ pub.up.callback(true);
1741
+ }, 0);
1742
+ // remove the function so that it cannot be used to overwrite the send function later on
1743
+ return function(msg){
1744
+ pub.up.incoming(msg, targetOrigin);
1745
+ };
1746
+ };
1747
+ }
1748
+ else {
1749
+ // This is to mitigate origin-spoofing
1750
+ if (document.referrer && getLocation(document.referrer) != query.xdm_e) {
1751
+ window.top.location = query.xdm_e;
1752
+ }
1753
+ send = window.frameElement.fn(function(msg){
1754
+ pub.up.incoming(msg, targetOrigin);
1755
+ });
1756
+ pub.up.callback(true);
1757
+ }
1758
+ },
1759
+ init: function(){
1760
+ whenReady(pub.onDOMReady, pub);
1761
+ }
1762
+ });
1763
+ };
1764
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1765
+ /*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/
1766
+ //
1767
+ // easyXDM
1768
+ // http://easyxdm.net/
1769
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1770
+ //
1771
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1772
+ // of this software and associated documentation files (the "Software"), to deal
1773
+ // in the Software without restriction, including without limitation the rights
1774
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1775
+ // copies of the Software, and to permit persons to whom the Software is
1776
+ // furnished to do so, subject to the following conditions:
1777
+ //
1778
+ // The above copyright notice and this permission notice shall be included in
1779
+ // all copies or substantial portions of the Software.
1780
+ //
1781
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1782
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1783
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1784
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1785
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1786
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1787
+ // THE SOFTWARE.
1788
+ //
1789
+
1790
+ /**
1791
+ * @class easyXDM.stack.NameTransport
1792
+ * NameTransport uses the window.name property to relay data.
1793
+ * The <code>local</code> parameter needs to be set on both the consumer and provider,<br/>
1794
+ * and the <code>remoteHelper</code> parameter needs to be set on the consumer.
1795
+ * @constructor
1796
+ * @param {Object} config The transports configuration.
1797
+ * @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host.
1798
+ * @namespace easyXDM.stack
1799
+ */
1800
+ easyXDM.stack.NameTransport = function(config){
1801
+
1802
+ var pub; // the public interface
1803
+ var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl;
1804
+
1805
+ function _sendMessage(message){
1806
+ var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel;
1807
+ callerWindow.contentWindow.sendMessage(message, url);
1808
+ }
1809
+
1810
+ function _onReady(){
1811
+ if (isHost) {
1812
+ if (++readyCount === 2 || !isHost) {
1813
+ pub.up.callback(true);
1814
+ }
1815
+ }
1816
+ else {
1817
+ _sendMessage("ready");
1818
+ pub.up.callback(true);
1819
+ }
1820
+ }
1821
+
1822
+ function _onMessage(message){
1823
+ pub.up.incoming(message, remoteOrigin);
1824
+ }
1825
+
1826
+ function _onLoad(){
1827
+ if (callback) {
1828
+ setTimeout(function(){
1829
+ callback(true);
1830
+ }, 0);
1831
+ }
1832
+ }
1833
+
1834
+ return (pub = {
1835
+ outgoing: function(message, domain, fn){
1836
+ callback = fn;
1837
+ _sendMessage(message);
1838
+ },
1839
+ destroy: function(){
1840
+ callerWindow.parentNode.removeChild(callerWindow);
1841
+ callerWindow = null;
1842
+ if (isHost) {
1843
+ remoteWindow.parentNode.removeChild(remoteWindow);
1844
+ remoteWindow = null;
1845
+ }
1846
+ },
1847
+ onDOMReady: function(){
1848
+ isHost = config.isHost;
1849
+ readyCount = 0;
1850
+ remoteOrigin = getLocation(config.remote);
1851
+ config.local = resolveUrl(config.local);
1852
+
1853
+ if (isHost) {
1854
+ // Register the callback
1855
+ easyXDM.Fn.set(config.channel, function(message){
1856
+ if (isHost && message === "ready") {
1857
+ // Replace the handler
1858
+ easyXDM.Fn.set(config.channel, _onMessage);
1859
+ _onReady();
1860
+ }
1861
+ });
1862
+
1863
+ // Set up the frame that points to the remote instance
1864
+ remoteUrl = appendQueryParameters(config.remote, {
1865
+ xdm_e: config.local,
1866
+ xdm_c: config.channel,
1867
+ xdm_p: 2
1868
+ });
1869
+ apply(config.props, {
1870
+ src: remoteUrl + '#' + config.channel,
1871
+ name: IFRAME_PREFIX + config.channel + "_provider"
1872
+ });
1873
+ remoteWindow = createFrame(config);
1874
+ }
1875
+ else {
1876
+ config.remoteHelper = config.remote;
1877
+ easyXDM.Fn.set(config.channel, _onMessage);
1878
+ }
1879
+
1880
+ // Set up the iframe that will be used for the transport
1881
+ var onLoad = function(){
1882
+ // Remove the handler
1883
+ var w = callerWindow || this;
1884
+ un(w, "load", onLoad);
1885
+ easyXDM.Fn.set(config.channel + "_load", _onLoad);
1886
+ (function test(){
1887
+ if (typeof w.contentWindow.sendMessage == "function") {
1888
+ _onReady();
1889
+ }
1890
+ else {
1891
+ setTimeout(test, 50);
1892
+ }
1893
+ }());
1894
+ };
1895
+
1896
+ callerWindow = createFrame({
1897
+ props: {
1898
+ src: config.local + "#_4" + config.channel
1899
+ },
1900
+ onLoad: onLoad
1901
+ });
1902
+ },
1903
+ init: function(){
1904
+ whenReady(pub.onDOMReady, pub);
1905
+ }
1906
+ });
1907
+ };
1908
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
1909
+ /*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
1910
+ //
1911
+ // easyXDM
1912
+ // http://easyxdm.net/
1913
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
1914
+ //
1915
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
1916
+ // of this software and associated documentation files (the "Software"), to deal
1917
+ // in the Software without restriction, including without limitation the rights
1918
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1919
+ // copies of the Software, and to permit persons to whom the Software is
1920
+ // furnished to do so, subject to the following conditions:
1921
+ //
1922
+ // The above copyright notice and this permission notice shall be included in
1923
+ // all copies or substantial portions of the Software.
1924
+ //
1925
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1926
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1927
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1928
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1929
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1930
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1931
+ // THE SOFTWARE.
1932
+ //
1933
+
1934
+ /**
1935
+ * @class easyXDM.stack.HashTransport
1936
+ * HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/>
1937
+ * <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/>
1938
+ * @namespace easyXDM.stack
1939
+ * @constructor
1940
+ * @param {Object} config The transports configuration.
1941
+ * @cfg {String/Window} local The url to the local file used for proxying messages, or the local window.
1942
+ * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window.
1943
+ * @cfg {Number} interval The interval used when polling for messages.
1944
+ */
1945
+ easyXDM.stack.HashTransport = function(config){
1946
+ var pub;
1947
+ var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow;
1948
+ var useParent, _remoteOrigin;
1949
+
1950
+ function _sendMessage(message){
1951
+ if (!_callerWindow) {
1952
+ return;
1953
+ }
1954
+ var url = config.remote + "#" + (_msgNr++) + "_" + message;
1955
+ ((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url;
1956
+ }
1957
+
1958
+ function _handleHash(hash){
1959
+ _lastMsg = hash;
1960
+ pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin);
1961
+ }
1962
+
1963
+ /**
1964
+ * Checks location.hash for a new message and relays this to the receiver.
1965
+ * @private
1966
+ */
1967
+ function _pollHash(){
1968
+ if (!_listenerWindow) {
1969
+ return;
1970
+ }
1971
+ var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
1972
+ if (indexOf != -1) {
1973
+ hash = href.substring(indexOf);
1974
+ }
1975
+ if (hash && hash != _lastMsg) {
1976
+ _handleHash(hash);
1977
+ }
1978
+ }
1979
+
1980
+ function _attachListeners(){
1981
+ _timer = setInterval(_pollHash, pollInterval);
1982
+ }
1983
+
1984
+ return (pub = {
1985
+ outgoing: function(message, domain){
1986
+ _sendMessage(message);
1987
+ },
1988
+ destroy: function(){
1989
+ window.clearInterval(_timer);
1990
+ if (isHost || !useParent) {
1991
+ _callerWindow.parentNode.removeChild(_callerWindow);
1992
+ }
1993
+ _callerWindow = null;
1994
+ },
1995
+ onDOMReady: function(){
1996
+ isHost = config.isHost;
1997
+ pollInterval = config.interval;
1998
+ _lastMsg = "#" + config.channel;
1999
+ _msgNr = 0;
2000
+ useParent = config.useParent;
2001
+ _remoteOrigin = getLocation(config.remote);
2002
+ if (isHost) {
2003
+ apply(config.props, {
2004
+ src: config.remote,
2005
+ name: IFRAME_PREFIX + config.channel + "_provider"
2006
+ });
2007
+ if (useParent) {
2008
+ config.onLoad = function(){
2009
+ _listenerWindow = window;
2010
+ _attachListeners();
2011
+ pub.up.callback(true);
2012
+ };
2013
+ }
2014
+ else {
2015
+ var tries = 0, max = config.delay / 50;
2016
+ (function getRef(){
2017
+ if (++tries > max) {
2018
+ throw new Error("Unable to reference listenerwindow");
2019
+ }
2020
+ try {
2021
+ _listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"];
2022
+ }
2023
+ catch (ex) {
2024
+ }
2025
+ if (_listenerWindow) {
2026
+ _attachListeners();
2027
+ pub.up.callback(true);
2028
+ }
2029
+ else {
2030
+ setTimeout(getRef, 50);
2031
+ }
2032
+ }());
2033
+ }
2034
+ _callerWindow = createFrame(config);
2035
+ }
2036
+ else {
2037
+ _listenerWindow = window;
2038
+ _attachListeners();
2039
+ if (useParent) {
2040
+ _callerWindow = parent;
2041
+ pub.up.callback(true);
2042
+ }
2043
+ else {
2044
+ apply(config, {
2045
+ props: {
2046
+ src: config.remote + "#" + config.channel + new Date(),
2047
+ name: IFRAME_PREFIX + config.channel + "_consumer"
2048
+ },
2049
+ onLoad: function(){
2050
+ pub.up.callback(true);
2051
+ }
2052
+ });
2053
+ _callerWindow = createFrame(config);
2054
+ }
2055
+ }
2056
+ },
2057
+ init: function(){
2058
+ whenReady(pub.onDOMReady, pub);
2059
+ }
2060
+ });
2061
+ };
2062
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2063
+ /*global easyXDM, window, escape, unescape, debug */
2064
+ //
2065
+ // easyXDM
2066
+ // http://easyxdm.net/
2067
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2068
+ //
2069
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2070
+ // of this software and associated documentation files (the "Software"), to deal
2071
+ // in the Software without restriction, including without limitation the rights
2072
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2073
+ // copies of the Software, and to permit persons to whom the Software is
2074
+ // furnished to do so, subject to the following conditions:
2075
+ //
2076
+ // The above copyright notice and this permission notice shall be included in
2077
+ // all copies or substantial portions of the Software.
2078
+ //
2079
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2080
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2081
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2082
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2083
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2084
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2085
+ // THE SOFTWARE.
2086
+ //
2087
+
2088
+ /**
2089
+ * @class easyXDM.stack.ReliableBehavior
2090
+ * This is a behavior that tries to make the underlying transport reliable by using acknowledgements.
2091
+ * @namespace easyXDM.stack
2092
+ * @constructor
2093
+ * @param {Object} config The behaviors configuration.
2094
+ */
2095
+ easyXDM.stack.ReliableBehavior = function(config){
2096
+ var pub, // the public interface
2097
+ callback; // the callback to execute when we have a confirmed success/failure
2098
+ var idOut = 0, idIn = 0, currentMessage = "";
2099
+
2100
+ return (pub = {
2101
+ incoming: function(message, origin){
2102
+ var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(",");
2103
+ message = message.substring(indexOf + 1);
2104
+
2105
+ if (ack[0] == idOut) {
2106
+ currentMessage = "";
2107
+ if (callback) {
2108
+ callback(true);
2109
+ callback = null;
2110
+ }
2111
+ }
2112
+ if (message.length > 0) {
2113
+ pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin);
2114
+ if (idIn != ack[1]) {
2115
+ idIn = ack[1];
2116
+ pub.up.incoming(message, origin);
2117
+ }
2118
+ }
2119
+
2120
+ },
2121
+ outgoing: function(message, origin, fn){
2122
+ currentMessage = message;
2123
+ callback = fn;
2124
+ pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin);
2125
+ }
2126
+ });
2127
+ };
2128
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2129
+ /*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/
2130
+ //
2131
+ // easyXDM
2132
+ // http://easyxdm.net/
2133
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2134
+ //
2135
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2136
+ // of this software and associated documentation files (the "Software"), to deal
2137
+ // in the Software without restriction, including without limitation the rights
2138
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2139
+ // copies of the Software, and to permit persons to whom the Software is
2140
+ // furnished to do so, subject to the following conditions:
2141
+ //
2142
+ // The above copyright notice and this permission notice shall be included in
2143
+ // all copies or substantial portions of the Software.
2144
+ //
2145
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2146
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2147
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2148
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2149
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2150
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2151
+ // THE SOFTWARE.
2152
+ //
2153
+
2154
+ /**
2155
+ * @class easyXDM.stack.QueueBehavior
2156
+ * This is a behavior that enables queueing of messages. <br/>
2157
+ * It will buffer incoming messages and dispach these as fast as the underlying transport allows.
2158
+ * This will also fragment/defragment messages so that the outgoing message is never bigger than the
2159
+ * set length.
2160
+ * @namespace easyXDM.stack
2161
+ * @constructor
2162
+ * @param {Object} config The behaviors configuration. Optional.
2163
+ * @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation.
2164
+ */
2165
+ easyXDM.stack.QueueBehavior = function(config){
2166
+ var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false;
2167
+
2168
+ function dispatch(){
2169
+ if (config.remove && queue.length === 0) {
2170
+ removeFromStack(pub);
2171
+ return;
2172
+ }
2173
+ if (waiting || queue.length === 0 || destroying) {
2174
+ return;
2175
+ }
2176
+ waiting = true;
2177
+ var message = queue.shift();
2178
+
2179
+ pub.down.outgoing(message.data, message.origin, function(success){
2180
+ waiting = false;
2181
+ if (message.callback) {
2182
+ setTimeout(function(){
2183
+ message.callback(success);
2184
+ }, 0);
2185
+ }
2186
+ dispatch();
2187
+ });
2188
+ }
2189
+ return (pub = {
2190
+ init: function(){
2191
+ if (undef(config)) {
2192
+ config = {};
2193
+ }
2194
+ if (config.maxLength) {
2195
+ maxLength = config.maxLength;
2196
+ doFragment = true;
2197
+ }
2198
+ if (config.lazy) {
2199
+ lazy = true;
2200
+ }
2201
+ else {
2202
+ pub.down.init();
2203
+ }
2204
+ },
2205
+ callback: function(success){
2206
+ waiting = false;
2207
+ var up = pub.up; // in case dispatch calls removeFromStack
2208
+ dispatch();
2209
+ up.callback(success);
2210
+ },
2211
+ incoming: function(message, origin){
2212
+ if (doFragment) {
2213
+ var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10);
2214
+ incoming += message.substring(indexOf + 1);
2215
+ if (seq === 0) {
2216
+ if (config.encode) {
2217
+ incoming = decodeURIComponent(incoming);
2218
+ }
2219
+ pub.up.incoming(incoming, origin);
2220
+ incoming = "";
2221
+ }
2222
+ }
2223
+ else {
2224
+ pub.up.incoming(message, origin);
2225
+ }
2226
+ },
2227
+ outgoing: function(message, origin, fn){
2228
+ if (config.encode) {
2229
+ message = encodeURIComponent(message);
2230
+ }
2231
+ var fragments = [], fragment;
2232
+ if (doFragment) {
2233
+ // fragment into chunks
2234
+ while (message.length !== 0) {
2235
+ fragment = message.substring(0, maxLength);
2236
+ message = message.substring(fragment.length);
2237
+ fragments.push(fragment);
2238
+ }
2239
+ // enqueue the chunks
2240
+ while ((fragment = fragments.shift())) {
2241
+ queue.push({
2242
+ data: fragments.length + "_" + fragment,
2243
+ origin: origin,
2244
+ callback: fragments.length === 0 ? fn : null
2245
+ });
2246
+ }
2247
+ }
2248
+ else {
2249
+ queue.push({
2250
+ data: message,
2251
+ origin: origin,
2252
+ callback: fn
2253
+ });
2254
+ }
2255
+ if (lazy) {
2256
+ pub.down.init();
2257
+ }
2258
+ else {
2259
+ dispatch();
2260
+ }
2261
+ },
2262
+ destroy: function(){
2263
+ destroying = true;
2264
+ pub.down.destroy();
2265
+ }
2266
+ });
2267
+ };
2268
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2269
+ /*global easyXDM, window, escape, unescape, undef, debug */
2270
+ //
2271
+ // easyXDM
2272
+ // http://easyxdm.net/
2273
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2274
+ //
2275
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2276
+ // of this software and associated documentation files (the "Software"), to deal
2277
+ // in the Software without restriction, including without limitation the rights
2278
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2279
+ // copies of the Software, and to permit persons to whom the Software is
2280
+ // furnished to do so, subject to the following conditions:
2281
+ //
2282
+ // The above copyright notice and this permission notice shall be included in
2283
+ // all copies or substantial portions of the Software.
2284
+ //
2285
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2286
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2287
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2288
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2289
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2290
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2291
+ // THE SOFTWARE.
2292
+ //
2293
+
2294
+ /**
2295
+ * @class easyXDM.stack.VerifyBehavior
2296
+ * This behavior will verify that communication with the remote end is possible, and will also sign all outgoing,
2297
+ * and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages.
2298
+ * @namespace easyXDM.stack
2299
+ * @constructor
2300
+ * @param {Object} config The behaviors configuration.
2301
+ * @cfg {Boolean} initiate If the verification should be initiated from this end.
2302
+ */
2303
+ easyXDM.stack.VerifyBehavior = function(config){
2304
+ var pub, mySecret, theirSecret, verified = false;
2305
+
2306
+ function startVerification(){
2307
+ mySecret = Math.random().toString(16).substring(2);
2308
+ pub.down.outgoing(mySecret);
2309
+ }
2310
+
2311
+ return (pub = {
2312
+ incoming: function(message, origin){
2313
+ var indexOf = message.indexOf("_");
2314
+ if (indexOf === -1) {
2315
+ if (message === mySecret) {
2316
+ pub.up.callback(true);
2317
+ }
2318
+ else if (!theirSecret) {
2319
+ theirSecret = message;
2320
+ if (!config.initiate) {
2321
+ startVerification();
2322
+ }
2323
+ pub.down.outgoing(message);
2324
+ }
2325
+ }
2326
+ else {
2327
+ if (message.substring(0, indexOf) === theirSecret) {
2328
+ pub.up.incoming(message.substring(indexOf + 1), origin);
2329
+ }
2330
+ }
2331
+ },
2332
+ outgoing: function(message, origin, fn){
2333
+ pub.down.outgoing(mySecret + "_" + message, origin, fn);
2334
+ },
2335
+ callback: function(success){
2336
+ if (config.initiate) {
2337
+ startVerification();
2338
+ }
2339
+ }
2340
+ });
2341
+ };
2342
+ /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2343
+ /*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */
2344
+ //
2345
+ // easyXDM
2346
+ // http://easyxdm.net/
2347
+ // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
2348
+ //
2349
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2350
+ // of this software and associated documentation files (the "Software"), to deal
2351
+ // in the Software without restriction, including without limitation the rights
2352
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2353
+ // copies of the Software, and to permit persons to whom the Software is
2354
+ // furnished to do so, subject to the following conditions:
2355
+ //
2356
+ // The above copyright notice and this permission notice shall be included in
2357
+ // all copies or substantial portions of the Software.
2358
+ //
2359
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2360
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2361
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2362
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2363
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2364
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2365
+ // THE SOFTWARE.
2366
+ //
2367
+
2368
+ /**
2369
+ * @class easyXDM.stack.RpcBehavior
2370
+ * This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/>
2371
+ * Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything.
2372
+ * @namespace easyXDM.stack
2373
+ * @constructor
2374
+ * @param {Object} proxy The object to apply the methods to.
2375
+ * @param {Object} config The definition of the local and remote interface to implement.
2376
+ * @cfg {Object} local The local interface to expose.
2377
+ * @cfg {Object} remote The remote methods to expose through the proxy.
2378
+ * @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON.
2379
+ */
2380
+ easyXDM.stack.RpcBehavior = function(proxy, config){
2381
+ var pub, serializer = config.serializer || getJSON();
2382
+ var _callbackCounter = 0, _callbacks = {};
2383
+
2384
+ /**
2385
+ * Serializes and sends the message
2386
+ * @private
2387
+ * @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added.
2388
+ */
2389
+ function _send(data){
2390
+ data.jsonrpc = "2.0";
2391
+ pub.down.outgoing(serializer.stringify(data));
2392
+ }
2393
+
2394
+ /**
2395
+ * Creates a method that implements the given definition
2396
+ * @private
2397
+ * @param {Object} The method configuration
2398
+ * @param {String} method The name of the method
2399
+ * @return {Function} A stub capable of proxying the requested method call
2400
+ */
2401
+ function _createMethod(definition, method){
2402
+ var slice = Array.prototype.slice;
2403
+
2404
+ return function(){
2405
+ var l = arguments.length, callback, message = {
2406
+ method: method
2407
+ };
2408
+
2409
+ if (l > 0 && typeof arguments[l - 1] === "function") {
2410
+ //with callback, procedure
2411
+ if (l > 1 && typeof arguments[l - 2] === "function") {
2412
+ // two callbacks, success and error
2413
+ callback = {
2414
+ success: arguments[l - 2],
2415
+ error: arguments[l - 1]
2416
+ };
2417
+ message.params = slice.call(arguments, 0, l - 2);
2418
+ }
2419
+ else {
2420
+ // single callback, success
2421
+ callback = {
2422
+ success: arguments[l - 1]
2423
+ };
2424
+ message.params = slice.call(arguments, 0, l - 1);
2425
+ }
2426
+ _callbacks["" + (++_callbackCounter)] = callback;
2427
+ message.id = _callbackCounter;
2428
+ }
2429
+ else {
2430
+ // no callbacks, a notification
2431
+ message.params = slice.call(arguments, 0);
2432
+ }
2433
+ if (definition.namedParams && message.params.length === 1) {
2434
+ message.params = message.params[0];
2435
+ }
2436
+ // Send the method request
2437
+ _send(message);
2438
+ };
2439
+ }
2440
+
2441
+ /**
2442
+ * Executes the exposed method
2443
+ * @private
2444
+ * @param {String} method The name of the method
2445
+ * @param {Number} id The callback id to use
2446
+ * @param {Function} method The exposed implementation
2447
+ * @param {Array} params The parameters supplied by the remote end
2448
+ */
2449
+ function _executeMethod(method, id, fn, params){
2450
+ if (!fn) {
2451
+ if (id) {
2452
+ _send({
2453
+ id: id,
2454
+ error: {
2455
+ code: -32601,
2456
+ message: "Procedure not found."
2457
+ }
2458
+ });
2459
+ }
2460
+ return;
2461
+ }
2462
+
2463
+ var success, error;
2464
+ if (id) {
2465
+ success = function(result){
2466
+ success = emptyFn;
2467
+ _send({
2468
+ id: id,
2469
+ result: result
2470
+ });
2471
+ };
2472
+ error = function(message, data){
2473
+ error = emptyFn;
2474
+ var msg = {
2475
+ id: id,
2476
+ error: {
2477
+ code: -32099,
2478
+ message: message
2479
+ }
2480
+ };
2481
+ if (data) {
2482
+ msg.error.data = data;
2483
+ }
2484
+ _send(msg);
2485
+ };
2486
+ }
2487
+ else {
2488
+ success = error = emptyFn;
2489
+ }
2490
+ // Call local method
2491
+ if (!isArray(params)) {
2492
+ params = [params];
2493
+ }
2494
+ try {
2495
+ var result = fn.method.apply(fn.scope, params.concat([success, error]));
2496
+ if (!undef(result)) {
2497
+ success(result);
2498
+ }
2499
+ }
2500
+ catch (ex1) {
2501
+ error(ex1.message);
2502
+ }
2503
+ }
2504
+
2505
+ return (pub = {
2506
+ incoming: function(message, origin){
2507
+ var data = serializer.parse(message);
2508
+ if (data.method) {
2509
+ // A method call from the remote end
2510
+ if (config.handle) {
2511
+ config.handle(data, _send);
2512
+ }
2513
+ else {
2514
+ _executeMethod(data.method, data.id, config.local[data.method], data.params);
2515
+ }
2516
+ }
2517
+ else {
2518
+ // A method response from the other end
2519
+ var callback = _callbacks[data.id];
2520
+ if (data.error) {
2521
+ if (callback.error) {
2522
+ callback.error(data.error);
2523
+ }
2524
+ }
2525
+ else if (callback.success) {
2526
+ callback.success(data.result);
2527
+ }
2528
+ delete _callbacks[data.id];
2529
+ }
2530
+ },
2531
+ init: function(){
2532
+ if (config.remote) {
2533
+ // Implement the remote sides exposed methods
2534
+ for (var method in config.remote) {
2535
+ if (config.remote.hasOwnProperty(method)) {
2536
+ proxy[method] = _createMethod(config.remote[method], method);
2537
+ }
2538
+ }
2539
+ }
2540
+ pub.down.init();
2541
+ },
2542
+ destroy: function(){
2543
+ for (var method in config.remote) {
2544
+ if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) {
2545
+ delete proxy[method];
2546
+ }
2547
+ }
2548
+ pub.down.destroy();
2549
+ }
2550
+ });
2551
+ };
2552
+ global.easyXDM = easyXDM;
2553
+ })(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent);
js/bluepay_echeck/easyXDM/easyXDM.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(N,d,p,K,k,H){var b=this;var n=Math.floor(Math.random()*10000);var q=Function.prototype;var Q=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/;var R=/[\-\w]+\/\.\.\//;var F=/([^:])\/\//g;var I="";var o={};var M=N.easyXDM;var U="easyXDM_";var E;var y=false;var i;var h;function C(X,Z){var Y=typeof X[Z];return Y=="function"||(!!(Y=="object"&&X[Z]))||Y=="unknown"}function u(X,Y){return !!(typeof(X[Y])=="object"&&X[Y])}function r(X){return Object.prototype.toString.call(X)==="[object Array]"}function c(){var Z="Shockwave Flash",ad="application/x-shockwave-flash";if(!t(navigator.plugins)&&typeof navigator.plugins[Z]=="object"){var ab=navigator.plugins[Z].description;if(ab&&!t(navigator.mimeTypes)&&navigator.mimeTypes[ad]&&navigator.mimeTypes[ad].enabledPlugin){i=ab.match(/\d+/g)}}if(!i){var Y;try{Y=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");i=Array.prototype.slice.call(Y.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1);Y=null}catch(ac){}}if(!i){return false}var X=parseInt(i[0],10),aa=parseInt(i[1],10);h=X>9&&aa>0;return true}var v,x;if(C(N,"addEventListener")){v=function(Z,X,Y){Z.addEventListener(X,Y,false)};x=function(Z,X,Y){Z.removeEventListener(X,Y,false)}}else{if(C(N,"attachEvent")){v=function(X,Z,Y){X.attachEvent("on"+Z,Y)};x=function(X,Z,Y){X.detachEvent("on"+Z,Y)}}else{throw new Error("Browser not supported")}}var W=false,J=[],L;if("readyState" in d){L=d.readyState;W=L=="complete"||(~navigator.userAgent.indexOf("AppleWebKit/")&&(L=="loaded"||L=="interactive"))}else{W=!!d.body}function s(){if(W){return}W=true;for(var X=0;X<J.length;X++){J[X]()}J.length=0}if(!W){if(C(N,"addEventListener")){v(d,"DOMContentLoaded",s)}else{v(d,"readystatechange",function(){if(d.readyState=="complete"){s()}});if(d.documentElement.doScroll&&N===top){var g=function(){if(W){return}try{d.documentElement.doScroll("left")}catch(X){K(g,1);return}s()};g()}}v(N,"load",s)}function G(Y,X){if(W){Y.call(X);return}J.push(function(){Y.call(X)})}function m(){var Z=parent;if(I!==""){for(var X=0,Y=I.split(".");X<Y.length;X++){Z=Z[Y[X]]}}return Z.easyXDM}function e(X){N.easyXDM=M;I=X;if(I){U="easyXDM_"+I.replace(".","_")+"_"}return o}function z(X){return X.match(Q)[3]}function f(X){return X.match(Q)[4]||""}function j(Z){var X=Z.toLowerCase().match(Q);var aa=X[2],ab=X[3],Y=X[4]||"";if((aa=="http:"&&Y==":80")||(aa=="https:"&&Y==":443")){Y=""}return aa+"//"+ab+Y}function B(X){X=X.replace(F,"$1/");if(!X.match(/^(http||https):\/\//)){var Y=(X.substring(0,1)==="/")?"":p.pathname;if(Y.substring(Y.length-1)!=="/"){Y=Y.substring(0,Y.lastIndexOf("/")+1)}X=p.protocol+"//"+p.host+Y+X}while(R.test(X)){X=X.replace(R,"")}return X}function P(X,aa){var ac="",Z=X.indexOf("#");if(Z!==-1){ac=X.substring(Z);X=X.substring(0,Z)}var ab=[];for(var Y in aa){if(aa.hasOwnProperty(Y)){ab.push(Y+"="+H(aa[Y]))}}return X+(y?"#":(X.indexOf("?")==-1?"?":"&"))+ab.join("&")+ac}var S=(function(X){X=X.substring(1).split("&");var Z={},aa,Y=X.length;while(Y--){aa=X[Y].split("=");Z[aa[0]]=k(aa[1])}return Z}(/xdm_e=/.test(p.search)?p.search:p.hash));function t(X){return typeof X==="undefined"}var O=function(){var Y={};var Z={a:[1,2,3]},X='{"a":[1,2,3]}';if(typeof JSON!="undefined"&&typeof JSON.stringify==="function"&&JSON.stringify(Z).replace((/\s/g),"")===X){return JSON}if(Object.toJSON){if(Object.toJSON(Z).replace((/\s/g),"")===X){Y.stringify=Object.toJSON}}if(typeof String.prototype.evalJSON==="function"){Z=X.evalJSON();if(Z.a&&Z.a.length===3&&Z.a[2]===3){Y.parse=function(aa){return aa.evalJSON()}}}if(Y.stringify&&Y.parse){O=function(){return Y};return Y}return null};function T(X,Y,Z){var ab;for(var aa in Y){if(Y.hasOwnProperty(aa)){if(aa in X){ab=Y[aa];if(typeof ab==="object"){T(X[aa],ab,Z)}else{if(!Z){X[aa]=Y[aa]}}}else{X[aa]=Y[aa]}}}return X}function a(){var Y=d.body.appendChild(d.createElement("form")),X=Y.appendChild(d.createElement("input"));X.name=U+"TEST"+n;E=X!==Y.elements[X.name];d.body.removeChild(Y)}function A(Y){if(t(E)){a()}var ac;if(E){ac=d.createElement('<iframe name="'+Y.props.name+'"/>')}else{ac=d.createElement("IFRAME");ac.name=Y.props.name}ac.id=ac.name=Y.props.name;delete Y.props.name;if(typeof Y.container=="string"){Y.container=d.getElementById(Y.container)}if(!Y.container){T(ac.style,{position:"absolute",top:"-2000px",left:"0px"});Y.container=d.body}var ab=Y.props.src;Y.props.src="javascript:false";T(ac,Y.props);ac.border=ac.frameBorder=0;ac.allowTransparency=true;Y.container.appendChild(ac);if(Y.onLoad){v(ac,"load",Y.onLoad)}if(Y.usePost){var aa=Y.container.appendChild(d.createElement("form")),X;aa.target=ac.name;aa.action=ab;aa.method="POST";if(typeof(Y.usePost)==="object"){for(var Z in Y.usePost){if(Y.usePost.hasOwnProperty(Z)){if(E){X=d.createElement('<input name="'+Z+'"/>')}else{X=d.createElement("INPUT");X.name=Z}X.value=Y.usePost[Z];aa.appendChild(X)}}}aa.submit();aa.parentNode.removeChild(aa)}else{ac.src=ab}Y.props.src=ab;return ac}function V(aa,Z){if(typeof aa=="string"){aa=[aa]}var Y,X=aa.length;while(X--){Y=aa[X];Y=new RegExp(Y.substr(0,1)=="^"?Y:("^"+Y.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"));if(Y.test(Z)){return true}}return false}function l(Z){var ae=Z.protocol,Y;Z.isHost=Z.isHost||t(S.xdm_p);y=Z.hash||false;if(!Z.props){Z.props={}}if(!Z.isHost){Z.channel=S.xdm_c.replace(/["'<>\\]/g,"");Z.secret=S.xdm_s;Z.remote=S.xdm_e.replace(/["'<>\\]/g,"");ae=S.xdm_p;if(Z.acl&&!V(Z.acl,Z.remote)){throw new Error("Access denied for "+Z.remote)}}else{Z.remote=B(Z.remote);Z.channel=Z.channel||"default"+n++;Z.secret=Math.random().toString(16).substring(2);if(t(ae)){if(j(p.href)==j(Z.remote)){ae="4"}else{if(C(N,"postMessage")||C(d,"postMessage")){ae="1"}else{if(Z.swf&&C(N,"ActiveXObject")&&c()){ae="6"}else{if(navigator.product==="Gecko"&&"frameElement" in N&&navigator.userAgent.indexOf("WebKit")==-1){ae="5"}else{if(Z.remoteHelper){ae="2"}else{ae="0"}}}}}}}Z.protocol=ae;switch(ae){case"0":T(Z,{interval:100,delay:2000,useResize:true,useParent:false,usePolling:false},true);if(Z.isHost){if(!Z.local){var ac=p.protocol+"//"+p.host,X=d.body.getElementsByTagName("img"),ad;var aa=X.length;while(aa--){ad=X[aa];if(ad.src.substring(0,ac.length)===ac){Z.local=ad.src;break}}if(!Z.local){Z.local=N}}var ab={xdm_c:Z.channel,xdm_p:0};if(Z.local===N){Z.usePolling=true;Z.useParent=true;Z.local=p.protocol+"//"+p.host+p.pathname+p.search;ab.xdm_e=Z.local;ab.xdm_pa=1}else{ab.xdm_e=B(Z.local)}if(Z.container){Z.useResize=false;ab.xdm_po=1}Z.remote=P(Z.remote,ab)}else{T(Z,{channel:S.xdm_c,remote:S.xdm_e,useParent:!t(S.xdm_pa),usePolling:!t(S.xdm_po),useResize:Z.useParent?false:Z.useResize})}Y=[new o.stack.HashTransport(Z),new o.stack.ReliableBehavior({}),new o.stack.QueueBehavior({encode:true,maxLength:4000-Z.remote.length}),new o.stack.VerifyBehavior({initiate:Z.isHost})];break;case"1":Y=[new o.stack.PostMessageTransport(Z)];break;case"2":Z.remoteHelper=B(Z.remoteHelper);Y=[new o.stack.NameTransport(Z),new o.stack.QueueBehavior(),new o.stack.VerifyBehavior({initiate:Z.isHost})];break;case"3":Y=[new o.stack.NixTransport(Z)];break;case"4":Y=[new o.stack.SameOriginTransport(Z)];break;case"5":Y=[new o.stack.FrameElementTransport(Z)];break;case"6":if(!i){c()}Y=[new o.stack.FlashTransport(Z)];break}Y.push(new o.stack.QueueBehavior({lazy:Z.lazy,remove:true}));return Y}function D(aa){var ab,Z={incoming:function(ad,ac){this.up.incoming(ad,ac)},outgoing:function(ac,ad){this.down.outgoing(ac,ad)},callback:function(ac){this.up.callback(ac)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}};for(var Y=0,X=aa.length;Y<X;Y++){ab=aa[Y];T(ab,Z,true);if(Y!==0){ab.down=aa[Y-1]}if(Y!==X-1){ab.up=aa[Y+1]}}return ab}function w(X){X.up.down=X.down;X.down.up=X.up;X.up=X.down=null}T(o,{version:"2.4.17.0",query:S,stack:{},apply:T,getJSONObject:O,whenReady:G,noConflict:e});o.DomHelper={on:v,un:x,requiresJSON:function(X){if(!u(N,"JSON")){d.write('<script type="text/javascript" src="'+X+'"><\/script>')}}};(function(){var X={};o.Fn={set:function(Y,Z){X[Y]=Z},get:function(Z,Y){var aa=X[Z];if(Y){delete X[Z]}return aa}}}());o.Socket=function(Y){var X=D(l(Y).concat([{incoming:function(ab,aa){Y.onMessage(ab,aa)},callback:function(aa){if(Y.onReady){Y.onReady(aa)}}}])),Z=j(Y.remote);this.origin=j(Y.remote);this.destroy=function(){X.destroy()};this.postMessage=function(aa){X.outgoing(aa,Z)};X.init()};o.Rpc=function(Z,Y){if(Y.local){for(var ab in Y.local){if(Y.local.hasOwnProperty(ab)){var aa=Y.local[ab];if(typeof aa==="function"){Y.local[ab]={method:aa}}}}}var X=D(l(Z).concat([new o.stack.RpcBehavior(this,Y),{callback:function(ac){if(Z.onReady){Z.onReady(ac)}}}]));this.origin=j(Z.remote);this.destroy=function(){X.destroy()};X.init()};o.stack.SameOriginTransport=function(Y){var Z,ab,aa,X;return(Z={outgoing:function(ad,ae,ac){aa(ad);if(ac){ac()}},destroy:function(){if(ab){ab.parentNode.removeChild(ab);ab=null}},onDOMReady:function(){X=j(Y.remote);if(Y.isHost){T(Y.props,{src:P(Y.remote,{xdm_e:p.protocol+"//"+p.host+p.pathname,xdm_c:Y.channel,xdm_p:4}),name:U+Y.channel+"_provider"});ab=A(Y);o.Fn.set(Y.channel,function(ac){aa=ac;K(function(){Z.up.callback(true)},0);return function(ad){Z.up.incoming(ad,X)}})}else{aa=m().Fn.get(Y.channel,true)(function(ac){Z.up.incoming(ac,X)});K(function(){Z.up.callback(true)},0)}},init:function(){G(Z.onDOMReady,Z)}})};o.stack.FlashTransport=function(aa){var ac,X,ab,ad,Y,ae;function af(ah,ag){K(function(){ac.up.incoming(ah,ad)},0)}function Z(ah){var ag=aa.swf+"?host="+aa.isHost;var aj="easyXDM_swf_"+Math.floor(Math.random()*10000);o.Fn.set("flash_loaded"+ah.replace(/[\-.]/g,"_"),function(){o.stack.FlashTransport[ah].swf=Y=ae.firstChild;var ak=o.stack.FlashTransport[ah].queue;for(var al=0;al<ak.length;al++){ak[al]()}ak.length=0});if(aa.swfContainer){ae=(typeof aa.swfContainer=="string")?d.getElementById(aa.swfContainer):aa.swfContainer}else{ae=d.createElement("div");T(ae.style,h&&aa.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0});d.body.appendChild(ae)}var ai="callback=flash_loaded"+ah.replace(/[\-.]/g,"_")+"&proto="+b.location.protocol+"&domain="+z(b.location.href)+"&port="+f(b.location.href)+"&ns="+I;ae.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+aj+"' data='"+ag+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+ag+"'></param><param name='flashvars' value='"+ai+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+ai+"' allowScriptAccess='always' wmode='transparent' src='"+ag+"' height='1' width='1'></embed></object>"}return(ac={outgoing:function(ah,ai,ag){Y.postMessage(aa.channel,ah.toString());if(ag){ag()}},destroy:function(){try{Y.destroyChannel(aa.channel)}catch(ag){}Y=null;if(X){X.parentNode.removeChild(X);X=null}},onDOMReady:function(){ad=aa.remote;o.Fn.set("flash_"+aa.channel+"_init",function(){K(function(){ac.up.callback(true)})});o.Fn.set("flash_"+aa.channel+"_onMessage",af);aa.swf=B(aa.swf);var ah=z(aa.swf);var ag=function(){o.stack.FlashTransport[ah].init=true;Y=o.stack.FlashTransport[ah].swf;Y.createChannel(aa.channel,aa.secret,j(aa.remote),aa.isHost);if(aa.isHost){if(h&&aa.swfNoThrottle){T(aa.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"})}T(aa.props,{src:P(aa.remote,{xdm_e:j(p.href),xdm_c:aa.channel,xdm_p:6,xdm_s:aa.secret}),name:U+aa.channel+"_provider"});X=A(aa)}};if(o.stack.FlashTransport[ah]&&o.stack.FlashTransport[ah].init){ag()}else{if(!o.stack.FlashTransport[ah]){o.stack.FlashTransport[ah]={queue:[ag]};Z(ah)}else{o.stack.FlashTransport[ah].queue.push(ag)}}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.PostMessageTransport=function(aa){var ac,ad,Y,Z;function X(ae){if(ae.origin){return j(ae.origin)}if(ae.uri){return j(ae.uri)}if(ae.domain){return p.protocol+"//"+ae.domain}throw"Unable to retrieve the origin of the event"}function ab(af){var ae=X(af);if(ae==Z&&af.data.substring(0,aa.channel.length+1)==aa.channel+" "){ac.up.incoming(af.data.substring(aa.channel.length+1),ae)}}return(ac={outgoing:function(af,ag,ae){Y.postMessage(aa.channel+" "+af,ag||Z);if(ae){ae()}},destroy:function(){x(N,"message",ab);if(ad){Y=null;ad.parentNode.removeChild(ad);ad=null}},onDOMReady:function(){Z=j(aa.remote);if(aa.isHost){var ae=function(af){if(af.data==aa.channel+"-ready"){Y=("postMessage" in ad.contentWindow)?ad.contentWindow:ad.contentWindow.document;x(N,"message",ae);v(N,"message",ab);K(function(){ac.up.callback(true)},0)}};v(N,"message",ae);T(aa.props,{src:P(aa.remote,{xdm_e:j(p.href),xdm_c:aa.channel,xdm_p:1}),name:U+aa.channel+"_provider"});ad=A(aa)}else{v(N,"message",ab);Y=("postMessage" in N.parent)?N.parent:N.parent.document;Y.postMessage(aa.channel+"-ready",Z);K(function(){ac.up.callback(true)},0)}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.FrameElementTransport=function(Y){var Z,ab,aa,X;return(Z={outgoing:function(ad,ae,ac){aa.call(this,ad);if(ac){ac()}},destroy:function(){if(ab){ab.parentNode.removeChild(ab);ab=null}},onDOMReady:function(){X=j(Y.remote);if(Y.isHost){T(Y.props,{src:P(Y.remote,{xdm_e:j(p.href),xdm_c:Y.channel,xdm_p:5}),name:U+Y.channel+"_provider"});ab=A(Y);ab.fn=function(ac){delete ab.fn;aa=ac;K(function(){Z.up.callback(true)},0);return function(ad){Z.up.incoming(ad,X)}}}else{if(d.referrer&&j(d.referrer)!=S.xdm_e){N.top.location=S.xdm_e}aa=N.frameElement.fn(function(ac){Z.up.incoming(ac,X)});Z.up.callback(true)}},init:function(){G(Z.onDOMReady,Z)}})};o.stack.NameTransport=function(ab){var ac;var ae,ai,aa,ag,ah,Y,X;function af(al){var ak=ab.remoteHelper+(ae?"#_3":"#_2")+ab.channel;ai.contentWindow.sendMessage(al,ak)}function ad(){if(ae){if(++ag===2||!ae){ac.up.callback(true)}}else{af("ready");ac.up.callback(true)}}function aj(ak){ac.up.incoming(ak,Y)}function Z(){if(ah){K(function(){ah(true)},0)}}return(ac={outgoing:function(al,am,ak){ah=ak;af(al)},destroy:function(){ai.parentNode.removeChild(ai);ai=null;if(ae){aa.parentNode.removeChild(aa);aa=null}},onDOMReady:function(){ae=ab.isHost;ag=0;Y=j(ab.remote);ab.local=B(ab.local);if(ae){o.Fn.set(ab.channel,function(al){if(ae&&al==="ready"){o.Fn.set(ab.channel,aj);ad()}});X=P(ab.remote,{xdm_e:ab.local,xdm_c:ab.channel,xdm_p:2});T(ab.props,{src:X+"#"+ab.channel,name:U+ab.channel+"_provider"});aa=A(ab)}else{ab.remoteHelper=ab.remote;o.Fn.set(ab.channel,aj)}var ak=function(){var al=ai||this;x(al,"load",ak);o.Fn.set(ab.channel+"_load",Z);(function am(){if(typeof al.contentWindow.sendMessage=="function"){ad()}else{K(am,50)}}())};ai=A({props:{src:ab.local+"#_4"+ab.channel},onLoad:ak})},init:function(){G(ac.onDOMReady,ac)}})};o.stack.HashTransport=function(Z){var ac;var ah=this,af,aa,X,ad,am,ab,al;var ag,Y;function ak(ao){if(!al){return}var an=Z.remote+"#"+(am++)+"_"+ao;((af||!ag)?al.contentWindow:al).location=an}function ae(an){ad=an;ac.up.incoming(ad.substring(ad.indexOf("_")+1),Y)}function aj(){if(!ab){return}var an=ab.location.href,ap="",ao=an.indexOf("#");if(ao!=-1){ap=an.substring(ao)}if(ap&&ap!=ad){ae(ap)}}function ai(){aa=setInterval(aj,X)}return(ac={outgoing:function(an,ao){ak(an)},destroy:function(){N.clearInterval(aa);if(af||!ag){al.parentNode.removeChild(al)}al=null},onDOMReady:function(){af=Z.isHost;X=Z.interval;ad="#"+Z.channel;am=0;ag=Z.useParent;Y=j(Z.remote);if(af){T(Z.props,{src:Z.remote,name:U+Z.channel+"_provider"});if(ag){Z.onLoad=function(){ab=N;ai();ac.up.callback(true)}}else{var ap=0,an=Z.delay/50;(function ao(){if(++ap>an){throw new Error("Unable to reference listenerwindow")}try{ab=al.contentWindow.frames[U+Z.channel+"_consumer"]}catch(aq){}if(ab){ai();ac.up.callback(true)}else{K(ao,50)}}())}al=A(Z)}else{ab=N;ai();if(ag){al=parent;ac.up.callback(true)}else{T(Z,{props:{src:Z.remote+"#"+Z.channel+new Date(),name:U+Z.channel+"_consumer"},onLoad:function(){ac.up.callback(true)}});al=A(Z)}}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.ReliableBehavior=function(Y){var aa,ac;var ab=0,X=0,Z="";return(aa={incoming:function(af,ad){var ae=af.indexOf("_"),ag=af.substring(0,ae).split(",");af=af.substring(ae+1);if(ag[0]==ab){Z="";if(ac){ac(true);ac=null}}if(af.length>0){aa.down.outgoing(ag[1]+","+ab+"_"+Z,ad);if(X!=ag[1]){X=ag[1];aa.up.incoming(af,ad)}}},outgoing:function(af,ad,ae){Z=af;ac=ae;aa.down.outgoing(X+","+(++ab)+"_"+af,ad)}})};o.stack.QueueBehavior=function(Z){var ac,ad=[],ag=true,aa="",af,X=0,Y=false,ab=false;function ae(){if(Z.remove&&ad.length===0){w(ac);return}if(ag||ad.length===0||af){return}ag=true;var ah=ad.shift();ac.down.outgoing(ah.data,ah.origin,function(ai){ag=false;if(ah.callback){K(function(){ah.callback(ai)},0)}ae()})}return(ac={init:function(){if(t(Z)){Z={}}if(Z.maxLength){X=Z.maxLength;ab=true}if(Z.lazy){Y=true}else{ac.down.init()}},callback:function(ai){ag=false;var ah=ac.up;ae();ah.callback(ai)},incoming:function(ak,ai){if(ab){var aj=ak.indexOf("_"),ah=parseInt(ak.substring(0,aj),10);aa+=ak.substring(aj+1);if(ah===0){if(Z.encode){aa=k(aa)}ac.up.incoming(aa,ai);aa=""}}else{ac.up.incoming(ak,ai)}},outgoing:function(al,ai,ak){if(Z.encode){al=H(al)}var ah=[],aj;if(ab){while(al.length!==0){aj=al.substring(0,X);al=al.substring(aj.length);ah.push(aj)}while((aj=ah.shift())){ad.push({data:ah.length+"_"+aj,origin:ai,callback:ah.length===0?ak:null})}}else{ad.push({data:al,origin:ai,callback:ak})}if(Y){ac.down.init()}else{ae()}},destroy:function(){af=true;ac.down.destroy()}})};o.stack.VerifyBehavior=function(ab){var ac,aa,Y,Z=false;function X(){aa=Math.random().toString(16).substring(2);ac.down.outgoing(aa)}return(ac={incoming:function(af,ad){var ae=af.indexOf("_");if(ae===-1){if(af===aa){ac.up.callback(true)}else{if(!Y){Y=af;if(!ab.initiate){X()}ac.down.outgoing(af)}}}else{if(af.substring(0,ae)===Y){ac.up.incoming(af.substring(ae+1),ad)}}},outgoing:function(af,ad,ae){ac.down.outgoing(aa+"_"+af,ad,ae)},callback:function(ad){if(ab.initiate){X()}}})};o.stack.RpcBehavior=function(ad,Y){var aa,af=Y.serializer||O();var ae=0,ac={};function X(ag){ag.jsonrpc="2.0";aa.down.outgoing(af.stringify(ag))}function ab(ag,ai){var ah=Array.prototype.slice;return function(){var aj=arguments.length,al,ak={method:ai};if(aj>0&&typeof arguments[aj-1]==="function"){if(aj>1&&typeof arguments[aj-2]==="function"){al={success:arguments[aj-2],error:arguments[aj-1]};ak.params=ah.call(arguments,0,aj-2)}else{al={success:arguments[aj-1]};ak.params=ah.call(arguments,0,aj-1)}ac[""+(++ae)]=al;ak.id=ae}else{ak.params=ah.call(arguments,0)}if(ag.namedParams&&ak.params.length===1){ak.params=ak.params[0]}X(ak)}}function Z(an,am,ai,al){if(!ai){if(am){X({id:am,error:{code:-32601,message:"Procedure not found."}})}return}var ak,ah;if(am){ak=function(ao){ak=q;X({id:am,result:ao})};ah=function(ao,ap){ah=q;var aq={id:am,error:{code:-32099,message:ao}};if(ap){aq.error.data=ap}X(aq)}}else{ak=ah=q}if(!r(al)){al=[al]}try{var ag=ai.method.apply(ai.scope,al.concat([ak,ah]));if(!t(ag)){ak(ag)}}catch(aj){ah(aj.message)}}return(aa={incoming:function(ah,ag){var ai=af.parse(ah);if(ai.method){if(Y.handle){Y.handle(ai,X)}else{Z(ai.method,ai.id,Y.local[ai.method],ai.params)}}else{var aj=ac[ai.id];if(ai.error){if(aj.error){aj.error(ai.error)}}else{if(aj.success){aj.success(ai.result)}}delete ac[ai.id]}},init:function(){if(Y.remote){for(var ag in Y.remote){if(Y.remote.hasOwnProperty(ag)){ad[ag]=ab(Y.remote[ag],ag)}}}aa.down.init()},destroy:function(){for(var ag in Y.remote){if(Y.remote.hasOwnProperty(ag)&&ad.hasOwnProperty(ag)){delete ad[ag]}}aa.down.destroy()}})};b.easyXDM=o})(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);
js/bluepay_echeck/easyXDM/{src/name.html → name.html} RENAMED
File without changes
js/bluepay_echeck/easyXDM/src/Core.js DELETED
@@ -1,911 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- var global = this;
28
- var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded
29
- var emptyFn = Function.prototype;
30
- var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4)
31
- var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression
32
- var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol
33
- var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global)
34
- var easyXDM = {};
35
- var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite
36
- var IFRAME_PREFIX = "easyXDM_";
37
- var HAS_NAME_PROPERTY_BUG;
38
- var useHash = false; // whether to use the hash over the query
39
- var flashVersion; // will be set if using flash
40
- var HAS_FLASH_THROTTLED_BUG;
41
- // #ifdef debug
42
- var _trace = emptyFn;
43
- // #endif
44
-
45
-
46
- // http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
47
- function isHostMethod(object, property){
48
- var t = typeof object[property];
49
- return t == 'function' ||
50
- (!!(t == 'object' && object[property])) ||
51
- t == 'unknown';
52
- }
53
-
54
- function isHostObject(object, property){
55
- return !!(typeof(object[property]) == 'object' && object[property]);
56
- }
57
-
58
- // end
59
-
60
- // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
61
- function isArray(o){
62
- return Object.prototype.toString.call(o) === '[object Array]';
63
- }
64
-
65
- // end
66
- function hasFlash(){
67
- var name = "Shockwave Flash", mimeType = "application/x-shockwave-flash";
68
-
69
- if (!undef(navigator.plugins) && typeof navigator.plugins[name] == "object") {
70
- // adapted from the swfobject code
71
- var description = navigator.plugins[name].description;
72
- if (description && !undef(navigator.mimeTypes) && navigator.mimeTypes[mimeType] && navigator.mimeTypes[mimeType].enabledPlugin) {
73
- flashVersion = description.match(/\d+/g);
74
- }
75
- }
76
- if (!flashVersion) {
77
- var flash;
78
- try {
79
- flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
80
- flashVersion = Array.prototype.slice.call(flash.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1);
81
- flash = null;
82
- }
83
- catch (notSupportedException) {
84
- }
85
- }
86
- if (!flashVersion) {
87
- return false;
88
- }
89
- var major = parseInt(flashVersion[0], 10), minor = parseInt(flashVersion[1], 10);
90
- HAS_FLASH_THROTTLED_BUG = major > 9 && minor > 0;
91
- return true;
92
- }
93
-
94
- /*
95
- * Cross Browser implementation for adding and removing event listeners.
96
- */
97
- var on, un;
98
- if (isHostMethod(window, "addEventListener")) {
99
- on = function(target, type, listener){
100
- // #ifdef debug
101
- _trace("adding listener " + type);
102
- // #endif
103
- target.addEventListener(type, listener, false);
104
- };
105
- un = function(target, type, listener){
106
- // #ifdef debug
107
- _trace("removing listener " + type);
108
- // #endif
109
- target.removeEventListener(type, listener, false);
110
- };
111
- }
112
- else if (isHostMethod(window, "attachEvent")) {
113
- on = function(object, sEvent, fpNotify){
114
- // #ifdef debug
115
- _trace("adding listener " + sEvent);
116
- // #endif
117
- object.attachEvent("on" + sEvent, fpNotify);
118
- };
119
- un = function(object, sEvent, fpNotify){
120
- // #ifdef debug
121
- _trace("removing listener " + sEvent);
122
- // #endif
123
- object.detachEvent("on" + sEvent, fpNotify);
124
- };
125
- }
126
- else {
127
- throw new Error("Browser not supported");
128
- }
129
-
130
- /*
131
- * Cross Browser implementation of DOMContentLoaded.
132
- */
133
- var domIsReady = false, domReadyQueue = [], readyState;
134
- if ("readyState" in document) {
135
- // If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and
136
- // 'interactive' (HTML5 specs, recent WebKit builds) states.
137
- // https://bugs.webkit.org/show_bug.cgi?id=45119
138
- readyState = document.readyState;
139
- domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive"));
140
- }
141
- else {
142
- // If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately
143
- // when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not.
144
- // We only need a body to add elements to, so the existence of document.body is enough for us.
145
- domIsReady = !!document.body;
146
- }
147
-
148
- function dom_onReady(){
149
- if (domIsReady) {
150
- return;
151
- }
152
- domIsReady = true;
153
- // #ifdef debug
154
- _trace("firing dom_onReady");
155
- // #endif
156
- for (var i = 0; i < domReadyQueue.length; i++) {
157
- domReadyQueue[i]();
158
- }
159
- domReadyQueue.length = 0;
160
- }
161
-
162
-
163
- if (!domIsReady) {
164
- if (isHostMethod(window, "addEventListener")) {
165
- on(document, "DOMContentLoaded", dom_onReady);
166
- }
167
- else {
168
- on(document, "readystatechange", function(){
169
- if (document.readyState == "complete") {
170
- dom_onReady();
171
- }
172
- });
173
- if (document.documentElement.doScroll && window === top) {
174
- var doScrollCheck = function(){
175
- if (domIsReady) {
176
- return;
177
- }
178
- // http://javascript.nwbox.com/IEContentLoaded/
179
- try {
180
- document.documentElement.doScroll("left");
181
- }
182
- catch (e) {
183
- setTimeout(doScrollCheck, 1);
184
- return;
185
- }
186
- dom_onReady();
187
- };
188
- doScrollCheck();
189
- }
190
- }
191
-
192
- // A fallback to window.onload, that will always work
193
- on(window, "load", dom_onReady);
194
- }
195
- /**
196
- * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
197
- * If functions are added after this event then they will be executed immediately.
198
- * @param {function} fn The function to add
199
- * @param {Object} scope An optional scope for the function to be called with.
200
- */
201
- function whenReady(fn, scope){
202
- if (domIsReady) {
203
- fn.call(scope);
204
- return;
205
- }
206
- domReadyQueue.push(function(){
207
- fn.call(scope);
208
- });
209
- }
210
-
211
- /**
212
- * Returns an instance of easyXDM from the parent window with
213
- * respect to the namespace.
214
- *
215
- * @return An instance of easyXDM (in the parent window)
216
- */
217
- function getParentObject(){
218
- var obj = parent;
219
- if (namespace !== "") {
220
- for (var i = 0, ii = namespace.split("."); i < ii.length; i++) {
221
- // #ifdef debug
222
- if (!obj) {
223
- throw new Error(ii.slice(0, i + 1).join('.') + ' is not an object');
224
- }
225
- // #endif
226
- obj = obj[ii[i]];
227
- }
228
- }
229
- // #ifdef debug
230
- if (!obj || !obj.easyXDM) {
231
- throw new Error('Could not find easyXDM in parent.' + namespace);
232
- }
233
- // #endif
234
- return obj.easyXDM;
235
- }
236
-
237
- /**
238
- * Removes easyXDM variable from the global scope. It also returns control
239
- * of the easyXDM variable to whatever code used it before.
240
- *
241
- * @param {String} ns A string representation of an object that will hold
242
- * an instance of easyXDM.
243
- * @return An instance of easyXDM
244
- */
245
- function noConflict(ns){
246
- // #ifdef debug
247
- if (typeof ns != "string" || !ns) {
248
- throw new Error('namespace must be a non-empty string');
249
- }
250
- _trace("Settings namespace to '" + ns + "'");
251
- // #endif
252
-
253
- window.easyXDM = _easyXDM;
254
- namespace = ns;
255
- if (namespace) {
256
- IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_";
257
- }
258
- return easyXDM;
259
- }
260
-
261
- /*
262
- * Methods for working with URLs
263
- */
264
- /**
265
- * Get the domain name from a url.
266
- * @param {String} url The url to extract the domain from.
267
- * @return The domain part of the url.
268
- * @type {String}
269
- */
270
- function getDomainName(url){
271
- // #ifdef debug
272
- if (!url) {
273
- throw new Error("url is undefined or empty");
274
- }
275
- // #endif
276
- return url.match(reURI)[3];
277
- }
278
-
279
- /**
280
- * Get the port for a given URL, or "" if none
281
- * @param {String} url The url to extract the port from.
282
- * @return The port part of the url.
283
- * @type {String}
284
- */
285
- function getPort(url){
286
- // #ifdef debug
287
- if (!url) {
288
- throw new Error("url is undefined or empty");
289
- }
290
- // #endif
291
- return url.match(reURI)[4] || "";
292
- }
293
-
294
- /**
295
- * Returns a string containing the schema, domain and if present the port
296
- * @param {String} url The url to extract the location from
297
- * @return {String} The location part of the url
298
- */
299
- function getLocation(url){
300
- // #ifdef debug
301
- if (!url) {
302
- throw new Error("url is undefined or empty");
303
- }
304
- if (/^file/.test(url)) {
305
- throw new Error("The file:// protocol is not supported");
306
- }
307
- // #endif
308
- var m = url.toLowerCase().match(reURI);
309
- var proto = m[2], domain = m[3], port = m[4] || "";
310
- if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) {
311
- port = "";
312
- }
313
- return proto + "//" + domain + port;
314
- }
315
-
316
- /**
317
- * Resolves a relative url into an absolute one.
318
- * @param {String} url The path to resolve.
319
- * @return {String} The resolved url.
320
- */
321
- function resolveUrl(url){
322
- // #ifdef debug
323
- if (!url) {
324
- throw new Error("url is undefined or empty");
325
- }
326
- // #endif
327
-
328
- // replace all // except the one in proto with /
329
- url = url.replace(reDoubleSlash, "$1/");
330
-
331
- // If the url is a valid url we do nothing
332
- if (!url.match(/^(http||https):\/\//)) {
333
- // If this is a relative path
334
- var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
335
- if (path.substring(path.length - 1) !== "/") {
336
- path = path.substring(0, path.lastIndexOf("/") + 1);
337
- }
338
-
339
- url = location.protocol + "//" + location.host + path + url;
340
- }
341
-
342
- // reduce all 'xyz/../' to just ''
343
- while (reParent.test(url)) {
344
- url = url.replace(reParent, "");
345
- }
346
-
347
- // #ifdef debug
348
- _trace("resolved url '" + url + "'");
349
- // #endif
350
- return url;
351
- }
352
-
353
- /**
354
- * Appends the parameters to the given url.<br/>
355
- * The base url can contain existing query parameters.
356
- * @param {String} url The base url.
357
- * @param {Object} parameters The parameters to add.
358
- * @return {String} A new valid url with the parameters appended.
359
- */
360
- function appendQueryParameters(url, parameters){
361
- // #ifdef debug
362
- if (!parameters) {
363
- throw new Error("parameters is undefined or null");
364
- }
365
- // #endif
366
-
367
- var hash = "", indexOf = url.indexOf("#");
368
- if (indexOf !== -1) {
369
- hash = url.substring(indexOf);
370
- url = url.substring(0, indexOf);
371
- }
372
- var q = [];
373
- for (var key in parameters) {
374
- if (parameters.hasOwnProperty(key)) {
375
- q.push(key + "=" + encodeURIComponent(parameters[key]));
376
- }
377
- }
378
- return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash;
379
- }
380
-
381
-
382
- // build the query object either from location.query, if it contains the xdm_e argument, or from location.hash
383
- var query = (function(input){
384
- input = input.substring(1).split("&");
385
- var data = {}, pair, i = input.length;
386
- while (i--) {
387
- pair = input[i].split("=");
388
- data[pair[0]] = decodeURIComponent(pair[1]);
389
- }
390
- return data;
391
- }(/xdm_e=/.test(location.search) ? location.search : location.hash));
392
-
393
- /*
394
- * Helper methods
395
- */
396
- /**
397
- * Helper for checking if a variable/property is undefined
398
- * @param {Object} v The variable to test
399
- * @return {Boolean} True if the passed variable is undefined
400
- */
401
- function undef(v){
402
- return typeof v === "undefined";
403
- }
404
-
405
- /**
406
- * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
407
- * @return {JSON} A valid JSON conforming object, or null if not found.
408
- */
409
- var getJSON = function(){
410
- var cached = {};
411
- var obj = {
412
- a: [1, 2, 3]
413
- }, json = "{\"a\":[1,2,3]}";
414
-
415
- if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
416
- // this is a working JSON instance
417
- return JSON;
418
- }
419
- if (Object.toJSON) {
420
- if (Object.toJSON(obj).replace((/\s/g), "") === json) {
421
- // this is a working stringify method
422
- cached.stringify = Object.toJSON;
423
- }
424
- }
425
-
426
- if (typeof String.prototype.evalJSON === "function") {
427
- obj = json.evalJSON();
428
- if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
429
- // this is a working parse method
430
- cached.parse = function(str){
431
- return str.evalJSON();
432
- };
433
- }
434
- }
435
-
436
- if (cached.stringify && cached.parse) {
437
- // Only memoize the result if we have valid instance
438
- getJSON = function(){
439
- return cached;
440
- };
441
- return cached;
442
- }
443
- return null;
444
- };
445
-
446
- /**
447
- * Applies properties from the source object to the target object.<br/>
448
- * @param {Object} target The target of the properties.
449
- * @param {Object} source The source of the properties.
450
- * @param {Boolean} noOverwrite Set to True to only set non-existing properties.
451
- */
452
- function apply(destination, source, noOverwrite){
453
- var member;
454
- for (var prop in source) {
455
- if (source.hasOwnProperty(prop)) {
456
- if (prop in destination) {
457
- member = source[prop];
458
- if (typeof member === "object") {
459
- apply(destination[prop], member, noOverwrite);
460
- }
461
- else if (!noOverwrite) {
462
- destination[prop] = source[prop];
463
- }
464
- }
465
- else {
466
- destination[prop] = source[prop];
467
- }
468
- }
469
- }
470
- return destination;
471
- }
472
-
473
- // This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName].
474
- function testForNamePropertyBug(){
475
- var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
476
- input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
477
- HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
478
- document.body.removeChild(form);
479
- // #ifdef debug
480
- _trace("HAS_NAME_PROPERTY_BUG: " + HAS_NAME_PROPERTY_BUG);
481
- // #endif
482
- }
483
-
484
- /**
485
- * Creates a frame and appends it to the DOM.
486
- * @param config {object} This object can have the following properties
487
- * <ul>
488
- * <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
489
- * <li> {object} attr The attributes that should be set on the frame.</li>
490
- * <li> {DOMElement} container Its parent element (Optional).</li>
491
- * <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
492
- * </ul>
493
- * @return The frames DOMElement
494
- * @type DOMElement
495
- */
496
- function createFrame(config){
497
- // #ifdef debug
498
- _trace("creating frame: " + config.props.src);
499
- // #endif
500
- if (undef(HAS_NAME_PROPERTY_BUG)) {
501
- testForNamePropertyBug();
502
- }
503
- var frame;
504
- // This is to work around the problems in IE6/7 with setting the name property.
505
- // Internally this is set as 'submitName' instead when using 'iframe.name = ...'
506
- // This is not required by easyXDM itself, but is to facilitate other use cases
507
- if (HAS_NAME_PROPERTY_BUG) {
508
- frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
509
- }
510
- else {
511
- frame = document.createElement("IFRAME");
512
- frame.name = config.props.name;
513
- }
514
-
515
- frame.id = frame.name = config.props.name;
516
- delete config.props.name;
517
-
518
- if (typeof config.container == "string") {
519
- config.container = document.getElementById(config.container);
520
- }
521
-
522
- if (!config.container) {
523
- // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
524
- apply(frame.style, {
525
- position: "absolute",
526
- top: "-2000px",
527
- // Avoid potential horizontal scrollbar
528
- left: "0px"
529
- });
530
- config.container = document.body;
531
- }
532
-
533
- // HACK: IE cannot have the src attribute set when the frame is appended
534
- // into the container, so we set it to "javascript:false" as a
535
- // placeholder for now. If we left the src undefined, it would
536
- // instead default to "about:blank", which causes SSL mixed-content
537
- // warnings in IE6 when on an SSL parent page.
538
- var src = config.props.src;
539
- config.props.src = "javascript:false";
540
-
541
- // transfer properties to the frame
542
- apply(frame, config.props);
543
-
544
- frame.border = frame.frameBorder = 0;
545
- frame.allowTransparency = true;
546
- config.container.appendChild(frame);
547
-
548
- if (config.onLoad) {
549
- on(frame, "load", config.onLoad);
550
- }
551
-
552
- // set the frame URL to the proper value (we previously set it to
553
- // "javascript:false" to work around the IE issue mentioned above)
554
- if(config.usePost) {
555
- var form = config.container.appendChild(document.createElement('form')), input;
556
- form.target = frame.name;
557
- form.action = src;
558
- form.method = 'POST';
559
- if (typeof(config.usePost) === 'object') {
560
- for (var i in config.usePost) {
561
- if (config.usePost.hasOwnProperty(i)) {
562
- if (HAS_NAME_PROPERTY_BUG) {
563
- input = document.createElement('<input name="' + i + '"/>');
564
- } else {
565
- input = document.createElement("INPUT");
566
- input.name = i;
567
- }
568
- input.value = config.usePost[i];
569
- form.appendChild(input);
570
- }
571
- }
572
- }
573
- form.submit();
574
- form.parentNode.removeChild(form);
575
- } else {
576
- frame.src = src;
577
- }
578
- config.props.src = src;
579
-
580
- return frame;
581
- }
582
-
583
- /**
584
- * Check whether a domain is allowed using an Access Control List.
585
- * The ACL can contain * and ? as wildcards, or can be regular expressions.
586
- * If regular expressions they need to begin with ^ and end with $.
587
- * @param {Array/String} acl The list of allowed domains
588
- * @param {String} domain The domain to test.
589
- * @return {Boolean} True if the domain is allowed, false if not.
590
- */
591
- function checkAcl(acl, domain){
592
- // normalize into an array
593
- if (typeof acl == "string") {
594
- acl = [acl];
595
- }
596
- var re, i = acl.length;
597
- while (i--) {
598
- re = acl[i];
599
- re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
600
- if (re.test(domain)) {
601
- return true;
602
- }
603
- }
604
- return false;
605
- }
606
-
607
- /*
608
- * Functions related to stacks
609
- */
610
- /**
611
- * Prepares an array of stack-elements suitable for the current configuration
612
- * @param {Object} config The Transports configuration. See easyXDM.Socket for more.
613
- * @return {Array} An array of stack-elements with the TransportElement at index 0.
614
- */
615
- function prepareTransportStack(config){
616
- var protocol = config.protocol, stackEls;
617
- config.isHost = config.isHost || undef(query.xdm_p);
618
- useHash = config.hash || false;
619
- // #ifdef debug
620
- _trace("preparing transport stack");
621
- // #endif
622
-
623
- if (!config.props) {
624
- config.props = {};
625
- }
626
- if (!config.isHost) {
627
- // #ifdef debug
628
- _trace("using parameters from query");
629
- // #endif
630
- config.channel = query.xdm_c.replace(/["'<>\\]/g, "");
631
- config.secret = query.xdm_s;
632
- config.remote = query.xdm_e.replace(/["'<>\\]/g, "");
633
- ;
634
- protocol = query.xdm_p;
635
- if (config.acl && !checkAcl(config.acl, config.remote)) {
636
- throw new Error("Access denied for " + config.remote);
637
- }
638
- }
639
- else {
640
- config.remote = resolveUrl(config.remote);
641
- config.channel = config.channel || "default" + channelId++;
642
- config.secret = Math.random().toString(16).substring(2);
643
- if (undef(protocol)) {
644
- if (getLocation(location.href) == getLocation(config.remote)) {
645
- /*
646
- * Both documents has the same origin, lets use direct access.
647
- */
648
- protocol = "4";
649
- }
650
- else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) {
651
- /*
652
- * This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+
653
- */
654
- protocol = "1";
655
- }
656
- else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) {
657
- /*
658
- * The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS
659
- */
660
- protocol = "6";
661
- }
662
- else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) {
663
- /*
664
- * This is supported in Gecko (Firefox 1+)
665
- */
666
- protocol = "5";
667
- }
668
- else if (config.remoteHelper) {
669
- /*
670
- * This is supported in all browsers that retains the value of window.name when
671
- * navigating from one domain to another, and where parent.frames[foo] can be used
672
- * to get access to a frame from the same domain
673
- */
674
- protocol = "2";
675
- }
676
- else {
677
- /*
678
- * This is supported in all browsers where [window].location is writable for all
679
- * The resize event will be used if resize is supported and the iframe is not put
680
- * into a container, else polling will be used.
681
- */
682
- protocol = "0";
683
- }
684
- // #ifdef debug
685
- _trace("selecting protocol: " + protocol);
686
- // #endif
687
- }
688
- // #ifdef debug
689
- else {
690
- _trace("using protocol: " + protocol);
691
- }
692
- // #endif
693
- }
694
- config.protocol = protocol; // for conditional branching
695
- switch (protocol) {
696
- case "0":// 0 = HashTransport
697
- apply(config, {
698
- interval: 100,
699
- delay: 2000,
700
- useResize: true,
701
- useParent: false,
702
- usePolling: false
703
- }, true);
704
- if (config.isHost) {
705
- if (!config.local) {
706
- // #ifdef debug
707
- _trace("looking for image to use as local");
708
- // #endif
709
- // If no local is set then we need to find an image hosted on the current domain
710
- var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image;
711
- var i = images.length;
712
- while (i--) {
713
- image = images[i];
714
- if (image.src.substring(0, domain.length) === domain) {
715
- config.local = image.src;
716
- break;
717
- }
718
- }
719
- if (!config.local) {
720
- // #ifdef debug
721
- _trace("no image found, defaulting to using the window");
722
- // #endif
723
- // If no local was set, and we are unable to find a suitable file, then we resort to using the current window
724
- config.local = window;
725
- }
726
- }
727
-
728
- var parameters = {
729
- xdm_c: config.channel,
730
- xdm_p: 0
731
- };
732
-
733
- if (config.local === window) {
734
- // We are using the current window to listen to
735
- config.usePolling = true;
736
- config.useParent = true;
737
- config.local = location.protocol + "//" + location.host + location.pathname + location.search;
738
- parameters.xdm_e = config.local;
739
- parameters.xdm_pa = 1; // use parent
740
- }
741
- else {
742
- parameters.xdm_e = resolveUrl(config.local);
743
- }
744
-
745
- if (config.container) {
746
- config.useResize = false;
747
- parameters.xdm_po = 1; // use polling
748
- }
749
- config.remote = appendQueryParameters(config.remote, parameters);
750
- }
751
- else {
752
- apply(config, {
753
- channel: query.xdm_c,
754
- remote: query.xdm_e,
755
- useParent: !undef(query.xdm_pa),
756
- usePolling: !undef(query.xdm_po),
757
- useResize: config.useParent ? false : config.useResize
758
- });
759
- }
760
- stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({
761
- encode: true,
762
- maxLength: 4000 - config.remote.length
763
- }), new easyXDM.stack.VerifyBehavior({
764
- initiate: config.isHost
765
- })];
766
- break;
767
- case "1":
768
- stackEls = [new easyXDM.stack.PostMessageTransport(config)];
769
- break;
770
- case "2":
771
- config.remoteHelper = resolveUrl(config.remoteHelper);
772
- stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({
773
- initiate: config.isHost
774
- })];
775
- break;
776
- case "3":
777
- stackEls = [new easyXDM.stack.NixTransport(config)];
778
- break;
779
- case "4":
780
- stackEls = [new easyXDM.stack.SameOriginTransport(config)];
781
- break;
782
- case "5":
783
- stackEls = [new easyXDM.stack.FrameElementTransport(config)];
784
- break;
785
- case "6":
786
- if (!flashVersion) {
787
- hasFlash();
788
- }
789
- stackEls = [new easyXDM.stack.FlashTransport(config)];
790
- break;
791
- }
792
- // this behavior is responsible for buffering outgoing messages, and for performing lazy initialization
793
- stackEls.push(new easyXDM.stack.QueueBehavior({
794
- lazy: config.lazy,
795
- remove: true
796
- }));
797
- return stackEls;
798
- }
799
-
800
- /**
801
- * Chains all the separate stack elements into a single usable stack.<br/>
802
- * If an element is missing a necessary method then it will have a pass-through method applied.
803
- * @param {Array} stackElements An array of stack elements to be linked.
804
- * @return {easyXDM.stack.StackElement} The last element in the chain.
805
- */
806
- function chainStack(stackElements){
807
- var stackEl, defaults = {
808
- incoming: function(message, origin){
809
- this.up.incoming(message, origin);
810
- },
811
- outgoing: function(message, recipient){
812
- this.down.outgoing(message, recipient);
813
- },
814
- callback: function(success){
815
- this.up.callback(success);
816
- },
817
- init: function(){
818
- this.down.init();
819
- },
820
- destroy: function(){
821
- this.down.destroy();
822
- }
823
- };
824
- for (var i = 0, len = stackElements.length; i < len; i++) {
825
- stackEl = stackElements[i];
826
- apply(stackEl, defaults, true);
827
- if (i !== 0) {
828
- stackEl.down = stackElements[i - 1];
829
- }
830
- if (i !== len - 1) {
831
- stackEl.up = stackElements[i + 1];
832
- }
833
- }
834
- return stackEl;
835
- }
836
-
837
- /**
838
- * This will remove a stackelement from its stack while leaving the stack functional.
839
- * @param {Object} element The elment to remove from the stack.
840
- */
841
- function removeFromStack(element){
842
- element.up.down = element.down;
843
- element.down.up = element.up;
844
- element.up = element.down = null;
845
- }
846
-
847
- /*
848
- * Export the main object and any other methods applicable
849
- */
850
- /**
851
- * @class easyXDM
852
- * A javascript library providing cross-browser, cross-domain messaging/RPC.
853
- * @version %%version%%
854
- * @singleton
855
- */
856
- apply(easyXDM, {
857
- /**
858
- * The version of the library
859
- * @type {string}
860
- */
861
- version: "%%version%%",
862
- /**
863
- * This is a map containing all the query parameters passed to the document.
864
- * All the values has been decoded using decodeURIComponent.
865
- * @type {object}
866
- */
867
- query: query,
868
- /**
869
- * @private
870
- */
871
- stack: {},
872
- /**
873
- * Applies properties from the source object to the target object.<br/>
874
- * @param {object} target The target of the properties.
875
- * @param {object} source The source of the properties.
876
- * @param {boolean} noOverwrite Set to True to only set non-existing properties.
877
- */
878
- apply: apply,
879
-
880
- /**
881
- * A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
882
- * @return {JSON} A valid JSON conforming object, or null if not found.
883
- */
884
- getJSONObject: getJSON,
885
- /**
886
- * This will add a function to the queue of functions to be run once the DOM reaches a ready state.
887
- * If functions are added after this event then they will be executed immediately.
888
- * @param {function} fn The function to add
889
- * @param {object} scope An optional scope for the function to be called with.
890
- */
891
- whenReady: whenReady,
892
- /**
893
- * Removes easyXDM variable from the global scope. It also returns control
894
- * of the easyXDM variable to whatever code used it before.
895
- *
896
- * @param {String} ns A string representation of an object that will hold
897
- * an instance of easyXDM.
898
- * @return An instance of easyXDM
899
- */
900
- noConflict: noConflict
901
- });
902
-
903
- // #ifdef debug
904
- // Expose helper functions so we can test them
905
- apply(easyXDM, {
906
- checkAcl: checkAcl,
907
- getDomainName: getDomainName,
908
- getLocation: getLocation,
909
- appendQueryParameters: appendQueryParameters
910
- });
911
- // #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/Debug.js DELETED
@@ -1,174 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- // #ifdef debug
28
- var debug = {
29
- _deferred: [],
30
- flush: function(){
31
- this.trace("... deferred messages ...");
32
- for (var i = 0, len = this._deferred.length; i < len; i++) {
33
- this.trace(this._deferred[i]);
34
- }
35
- this._deferred.length = 0;
36
- this.trace("... end of deferred messages ...");
37
- },
38
- getTime: function(){
39
- var d = new Date(), h = d.getHours() + "", m = d.getMinutes() + "", s = d.getSeconds() + "", ms = d.getMilliseconds() + "", zeros = "000";
40
- if (h.length == 1) {
41
- h = "0" + h;
42
- }
43
- if (m.length == 1) {
44
- m = "0" + m;
45
- }
46
- if (s.length == 1) {
47
- s = "0" + s;
48
- }
49
- ms = zeros.substring(ms.length) + ms;
50
- return h + ":" + m + ":" + s + "." + ms;
51
- },
52
- /**
53
- * Logs the message to console.log if available
54
- * @param {String} msg The message to log
55
- */
56
- log: function(msg){
57
- // Uses memoizing to cache the implementation
58
- if (!isHostObject(window, "console") || undef(console.log)) {
59
- /**
60
- * Sets log to be an empty function since we have no output available
61
- * @ignore
62
- */
63
- this.log = emptyFn;
64
- }
65
- else {
66
- /**
67
- * Sets log to be a wrapper around console.log
68
- * @ignore
69
- * @param {String} msg
70
- */
71
- this.log = function(msg){
72
- console.log(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ": " + msg);
73
- };
74
- }
75
- this.log(msg);
76
- },
77
- /**
78
- * Will try to trace the given message either to a DOMElement with the id "log",
79
- * or by using console.info.
80
- * @param {String} msg The message to trace
81
- */
82
- trace: function(msg){
83
- // Uses memoizing to cache the implementation
84
- if (!domIsReady) {
85
- if (this._deferred.length === 0) {
86
- easyXDM.whenReady(debug.flush, debug);
87
- }
88
- this._deferred.push(msg);
89
- this.log(msg);
90
- }
91
- else {
92
- var el = document.getElementById("log");
93
- // is there a log element present?
94
- if (el) {
95
- /**
96
- * Sets trace to be a function that outputs the messages to the DOMElement with id "log"
97
- * @ignore
98
- * @param {String} msg
99
- */
100
- this.trace = function(msg){
101
- try {
102
- el.appendChild(document.createElement("div")).appendChild(document.createTextNode(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg));
103
- el.scrollTop = el.scrollHeight;
104
- }
105
- catch (e) {
106
- //In case we are unloading
107
- }
108
- };
109
- }
110
- else if (isHostObject(window, "console") && !undef(console.info)) {
111
- /**
112
- * Sets trace to be a wrapper around console.info
113
- * @ignore
114
- * @param {String} msg
115
- */
116
- this.trace = function(msg){
117
- console.info(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg);
118
- };
119
- }
120
- else {
121
- /**
122
- * Create log window
123
- * @ignore
124
- */
125
- var domain = location.host, windowname = domain.replace(/[\-.:]/g, "") + "easyxdm_log", logWin;
126
- try {
127
- logWin = window.open("", windowname, "width=800,height=200,status=0,navigation=0,scrollbars=1");
128
- }
129
- catch (e) {
130
- }
131
- if (logWin) {
132
- var doc = logWin.document;
133
- el = doc.getElementById("log");
134
- if (!el) {
135
- doc.write("<html><head><title>easyXDM log " + domain + "</title></head>");
136
- doc.write("<body><div id=\"log\"></div></body></html>");
137
- doc.close();
138
- el = doc.getElementById("log");
139
- }
140
- this.trace = function(msg){
141
- try {
142
- el.appendChild(doc.createElement("div")).appendChild(doc.createTextNode(location.host + (namespace ? ":" + namespace : "") + " - " + this.getTime() + ":" + msg));
143
- el.scrollTop = el.scrollHeight;
144
- }
145
- catch (e) {
146
- //In case we are unloading
147
- }
148
- };
149
- this.trace("---- new logger at " + location.href);
150
- }
151
-
152
- if (!el) {
153
- // We are unable to use any logging
154
- this.trace = emptyFn;
155
- }
156
- }
157
- this.trace(msg);
158
- }
159
- },
160
- /**
161
- * Creates a method usable for tracing.
162
- * @param {String} name The name the messages should be marked with
163
- * @return {Function} A function that accepts a single string as argument.
164
- */
165
- getTracer: function(name){
166
- return function(msg){
167
- debug.trace(name + ": " + msg);
168
- };
169
- }
170
- };
171
- debug.log("easyXDM present on '" + location.href);
172
- easyXDM.Debug = debug;
173
- _trace = debug.getTracer("{Private}");
174
- // #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/DomHelper.js DELETED
@@ -1,69 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.DomHelper
29
- * Contains methods for dealing with the DOM
30
- * @singleton
31
- */
32
- easyXDM.DomHelper = {
33
- /**
34
- * Provides a consistent interface for adding eventhandlers
35
- * @param {Object} target The target to add the event to
36
- * @param {String} type The name of the event
37
- * @param {Function} listener The listener
38
- */
39
- on: on,
40
- /**
41
- * Provides a consistent interface for removing eventhandlers
42
- * @param {Object} target The target to remove the event from
43
- * @param {String} type The name of the event
44
- * @param {Function} listener The listener
45
- */
46
- un: un,
47
- /**
48
- * Checks for the presence of the JSON object.
49
- * If it is not present it will use the supplied path to load the JSON2 library.
50
- * This should be called in the documents head right after the easyXDM script tag.
51
- * http://json.org/json2.js
52
- * @param {String} path A valid path to json2.js
53
- */
54
- requiresJSON: function(path){
55
- if (!isHostObject(window, "JSON")) {
56
- // #ifdef debug
57
- debug.log("loading external JSON");
58
- // #endif
59
- // we need to encode the < in order to avoid an illegal token error
60
- // when the script is inlined in a document.
61
- document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
62
- }
63
- // #ifdef debug
64
- else {
65
- debug.log("native JSON found");
66
- }
67
- // #endif
68
- }
69
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/Fn.js DELETED
@@ -1,78 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, debug */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- (function(){
28
- // The map containing the stored functions
29
- var _map = {};
30
-
31
- /**
32
- * @class easyXDM.Fn
33
- * This contains methods related to function handling, such as storing callbacks.
34
- * @singleton
35
- * @namespace easyXDM
36
- */
37
- easyXDM.Fn = {
38
- /**
39
- * Stores a function using the given name for reference
40
- * @param {String} name The name that the function should be referred by
41
- * @param {Function} fn The function to store
42
- * @namespace easyXDM.fn
43
- */
44
- set: function(name, fn){
45
- // #ifdef debug
46
- this._trace("storing function " + name);
47
- // #endif
48
- _map[name] = fn;
49
- },
50
- /**
51
- * Retrieves the function referred to by the given name
52
- * @param {String} name The name of the function to retrieve
53
- * @param {Boolean} del If the function should be deleted after retrieval
54
- * @return {Function} The stored function
55
- * @namespace easyXDM.fn
56
- */
57
- get: function(name, del){
58
- // #ifdef debug
59
- this._trace("retrieving function " + name);
60
- // #endif
61
- var fn = _map[name];
62
- // #ifdef debug
63
- if (!fn) {
64
- this._trace(name + " not found");
65
- }
66
- // #endif
67
-
68
- if (del) {
69
- delete _map[name];
70
- }
71
- return fn;
72
- }
73
- };
74
-
75
- // #ifdef debug
76
- easyXDM.Fn._trace = debug.getTracer("easyXDM.Fn");
77
- // #endif
78
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/Rpc.js DELETED
@@ -1,171 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.Rpc
29
- * Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation
30
- * of methods to be called from the remote end.<br/>
31
- * The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/>
32
- * This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods.
33
- * <h2>How to set up</h2>
34
- * <pre><code>
35
- * var rpc = new easyXDM.Rpc({
36
- * &nbsp; &#47;&#47; this configuration is equal to that used by the Socket.
37
- * &nbsp; remote: "http:&#47;&#47;remotedomain/...",
38
- * &nbsp; onReady: function(){
39
- * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the proxy
40
- * &nbsp; &nbsp; rpc.foo(...
41
- * &nbsp; }
42
- * },{
43
- * &nbsp; local: {..},
44
- * &nbsp; remote: {..}
45
- * });
46
- * </code></pre>
47
- *
48
- * <h2>Exposing functions (procedures)</h2>
49
- * <pre><code>
50
- * var rpc = new easyXDM.Rpc({
51
- * &nbsp; ...
52
- * },{
53
- * &nbsp; local: {
54
- * &nbsp; &nbsp; nameOfMethod: {
55
- * &nbsp; &nbsp; &nbsp; method: function(arg1, arg2, success, error){
56
- * &nbsp; &nbsp; &nbsp; &nbsp; ...
57
- * &nbsp; &nbsp; &nbsp; }
58
- * &nbsp; &nbsp; },
59
- * &nbsp; &nbsp; &#47;&#47; with shorthand notation
60
- * &nbsp; &nbsp; nameOfAnotherMethod: function(arg1, arg2, success, error){
61
- * &nbsp; &nbsp; }
62
- * &nbsp; },
63
- * &nbsp; remote: {...}
64
- * });
65
- * </code></pre>
66
-
67
- * The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/>
68
- * To send a successfull result back you can use
69
- * <pre><code>
70
- * return foo;
71
- * </pre></code>
72
- * or
73
- * <pre><code>
74
- * success(foo);
75
- * </pre></code>
76
- * To return an error you can use
77
- * <pre><code>
78
- * throw new Error("foo error");
79
- * </code></pre>
80
- * or
81
- * <pre><code>
82
- * error("foo error");
83
- * </code></pre>
84
- *
85
- * <h2>Defining remotely exposed methods (procedures/notifications)</h2>
86
- * The definition of the remote end is quite similar:
87
- * <pre><code>
88
- * var rpc = new easyXDM.Rpc({
89
- * &nbsp; ...
90
- * },{
91
- * &nbsp; local: {...},
92
- * &nbsp; remote: {
93
- * &nbsp; &nbsp; nameOfMethod: {}
94
- * &nbsp; }
95
- * });
96
- * </code></pre>
97
- * To call a remote method use
98
- * <pre><code>
99
- * rpc.nameOfMethod("arg1", "arg2", function(value) {
100
- * &nbsp; alert("success: " + value);
101
- * }, function(message) {
102
- * &nbsp; alert("error: " + message + );
103
- * });
104
- * </code></pre>
105
- * Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/>
106
- * When called with no callback a JSON-RPC 2.0 notification will be executed.
107
- * Be aware that you will not be notified of any errors with this method.
108
- * <br/>
109
- * <h2>Specifying a custom serializer</h2>
110
- * If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library
111
- * then you can specify a custom serializer using <code>serializer: foo</code>
112
- * <pre><code>
113
- * var rpc = new easyXDM.Rpc({
114
- * &nbsp; ...
115
- * },{
116
- * &nbsp; local: {...},
117
- * &nbsp; remote: {...},
118
- * &nbsp; serializer : {
119
- * &nbsp; &nbsp; parse: function(string){ ... },
120
- * &nbsp; &nbsp; stringify: function(object) {...}
121
- * &nbsp; }
122
- * });
123
- * </code></pre>
124
- * If <code>serializer</code> is set then the class will not attempt to use the native implementation.
125
- * @namespace easyXDM
126
- * @constructor
127
- * @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters.
128
- * @param {Object} jsonRpcConfig The description of the interface to implement.
129
- */
130
- easyXDM.Rpc = function(config, jsonRpcConfig){
131
- // #ifdef debug
132
- var trace = debug.getTracer("easyXDM.Rpc");
133
- trace("constructor");
134
- // #endif
135
-
136
- // expand shorthand notation
137
- if (jsonRpcConfig.local) {
138
- for (var method in jsonRpcConfig.local) {
139
- if (jsonRpcConfig.local.hasOwnProperty(method)) {
140
- var member = jsonRpcConfig.local[method];
141
- if (typeof member === "function") {
142
- jsonRpcConfig.local[method] = {
143
- method: member
144
- };
145
- }
146
- }
147
- }
148
- }
149
-
150
- // create the stack
151
- var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), {
152
- callback: function(success){
153
- if (config.onReady) {
154
- config.onReady(success);
155
- }
156
- }
157
- }]));
158
-
159
- // set the origin
160
- this.origin = getLocation(config.remote);
161
-
162
-
163
- /**
164
- * Initiates the destruction of the stack.
165
- */
166
- this.destroy = function(){
167
- stack.destroy();
168
- };
169
-
170
- stack.init();
171
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/Socket.js DELETED
@@ -1,117 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.Socket
29
- * This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/>
30
- * The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/>
31
- * Internally different stacks will be used depending on the browsers features and the available parameters.
32
- * <h2>How to set up</h2>
33
- * Setting up the provider:
34
- * <pre><code>
35
- * var socket = new easyXDM.Socket({
36
- * &nbsp; local: "name.html",
37
- * &nbsp; onReady: function(){
38
- * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
39
- * &nbsp; &nbsp; socket.postMessage("foo-message");
40
- * &nbsp; },
41
- * &nbsp; onMessage: function(message, origin) {
42
- * &nbsp;&nbsp; alert("received " + message + " from " + origin);
43
- * &nbsp; }
44
- * });
45
- * </code></pre>
46
- * Setting up the consumer:
47
- * <pre><code>
48
- * var socket = new easyXDM.Socket({
49
- * &nbsp; remote: "http:&#47;&#47;remotedomain/page.html",
50
- * &nbsp; remoteHelper: "http:&#47;&#47;remotedomain/name.html",
51
- * &nbsp; onReady: function(){
52
- * &nbsp; &nbsp; &#47;&#47; you need to wait for the onReady callback before using the socket
53
- * &nbsp; &nbsp; socket.postMessage("foo-message");
54
- * &nbsp; },
55
- * &nbsp; onMessage: function(message, origin) {
56
- * &nbsp;&nbsp; alert("received " + message + " from " + origin);
57
- * &nbsp; }
58
- * });
59
- * </code></pre>
60
- * If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property
61
- * and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports.
62
- * @namespace easyXDM
63
- * @constructor
64
- * @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window.
65
- * @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed.
66
- * @cfg {String} remote (Consumer only) The url to the providers document.
67
- * @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional.
68
- * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000.
69
- * @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300.
70
- * @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional.
71
- * @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional.
72
- * @cfg {Function} onReady A method that should be called when the transport is ready. Optional.
73
- * @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional.
74
- * @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/>
75
- * This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $.
76
- * If none of the patterns match an Error will be thrown.
77
- * @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>.
78
- * Properties such as 'name' and 'src' will be overrided. Optional.
79
- */
80
- easyXDM.Socket = function(config){
81
- // #ifdef debug
82
- var trace = debug.getTracer("easyXDM.Socket");
83
- trace("constructor");
84
- // #endif
85
-
86
- // create the stack
87
- var stack = chainStack(prepareTransportStack(config).concat([{
88
- incoming: function(message, origin){
89
- config.onMessage(message, origin);
90
- },
91
- callback: function(success){
92
- if (config.onReady) {
93
- config.onReady(success);
94
- }
95
- }
96
- }])), recipient = getLocation(config.remote);
97
-
98
- // set the origin
99
- this.origin = getLocation(config.remote);
100
-
101
- /**
102
- * Initiates the destruction of the stack.
103
- */
104
- this.destroy = function(){
105
- stack.destroy();
106
- };
107
-
108
- /**
109
- * Posts a message to the remote end of the channel
110
- * @param {String} message The message to send
111
- */
112
- this.postMessage = function(message){
113
- stack.outgoing(message, recipient);
114
- };
115
-
116
- stack.init();
117
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/begin_scope.txt DELETED
@@ -1 +0,0 @@
1
- (function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) {
 
js/bluepay_echeck/easyXDM/src/changes.html DELETED
@@ -1,413 +0,0 @@
1
- <!doctype HTML>
2
- <html>
3
- <head>
4
- <title>Changes</title>
5
- </head>
6
- <body>
7
- <ul>
8
- <li>
9
- 2.4.16 09.02.12
10
- <br/>
11
- Improved many of the samples</br>
12
- Fixed issues with logging</br>
13
- Added support for posting to the initial src</br>
14
- Several minor bugfixes</br>
15
- +++ See commit log
16
- </li>
17
- <li>
18
- 2.4.15 07.07.11
19
- <br/>
20
- Fixed an issue with the FlashTransport and domains containing hyphens.
21
- <br/>
22
- Fixed an issue with the FlashTransport and IE7 due to aggressive caching.
23
- <br/>
24
- The stack will now only fall back to the FlashTransport if the swf: property has explicitly been set.
25
- </li>
26
- <li>
27
- 2.4.14 07.06.11
28
- <br/>
29
- Fixed several issues with the FlashTransport. These includes proper support for valid domain names, non-standard ports, a race condition relating to
30
- creating multiple transports rapidly, allowing multiple transports to different providers, support for CDN.
31
- <br/>
32
- Refactored the testForNamePropertyBug so that it no longer errs when subjected to refreshing
33
- <br/>
34
- Fixed an issue with Safari, capitalized urls and the PostMessageTransport.
35
- <br/>
36
- Fixed an issue with some errors being thrown in IE8 due to named FE's having two 'references' in IE, one inside and one outside the function.
37
- </li>
38
- <li>
39
- 2.4.13 02.05.11
40
- <br/>
41
- Improved the FlashTransport in many ways, worked around a bug in Flash<10, added support for messages above 40k, the swf can now be hosted on both domains.
42
- <br/>
43
- Fixed several security related issues.
44
- <br/>
45
- Removed the NixTransport from the build.
46
- </li>
47
- <li>
48
- 2.4.12 12.04.11
49
- <br/>
50
- Added the FlashTransport that takes over for the NixTransport as a response to <a href="http://www.microsoft.com/technet/security/Bulletin/MS11-018.mspx">Microsoft Security Bulletin MS11-018</a>.
51
- <br/>
52
- Fixed several examples and some minor bugs
53
- </li>
54
- <li>
55
- 2.4.11 22.03.11
56
- <br/>
57
- Move hidden iframes to the top instead of left in order to support both right-to-left and left-to-right pages (Anton Kovalyov)
58
- <br/>
59
- Refactored the way attributes/properties were applied to created iframes in order to avoid redraw bugs in IE (George Courtsunis)
60
- <br/>
61
- Added support for passing data from the consumer to the provider using the hash instead of the query.
62
- <br/>
63
- Switched from using insertBefore to appendChild for adding the iframe to the DOM
64
- <br/>
65
- Minor improvements regarding url comparisons etc.
66
- </li>
67
- <li>
68
- 2.4.10 02.01.11
69
- <br/>
70
- easyXDM.noConflict added by Anton Kovalyov, this enables you to easily embed easyXDM in a distribution without risking version collisions.
71
- <br/>
72
- Fixed a bug in the DOM
73
- <code>
74
- whenReady
75
- </code>
76
- code where easyXDM wouldn't get initialized when loaded dynamically on WebKit.
77
- <br/>
78
- Improved the documentation and the shipped examples.
79
- </li>
80
- <li>
81
- 2.4.9 10.11.10
82
- <br/>
83
- Improved the
84
- <code>
85
- whenReady
86
- </code>
87
- feature - easyXDM will now work correctly in IE9 too.
88
- <br/>
89
- Replaced the xhr.html endpoint with a stricter /cors/ endpoint. This adhers to the CORS standard and enables a similar autorization scheme.
90
- <br/>
91
- Improved the error message sent by the RpcBehavior. This now includes extra error data passed from the origin of the error.
92
- </li>
93
- <li>
94
- 2.4.8 15.09.10
95
- <br/>
96
- Fixed a bug in the SameOriginTransport that could cause onReady to fire prior to the constructor of the Socket/Rpc returning.
97
- <br/>
98
- Removed the browser sniffing related to the element.name bug (IE). This also makes easyXMD work correctly in IE9 (beta)!
99
- <br/>
100
- <strong>Removed the ajax feature from the core in order to streamline the library.</strong>
101
- If you rely on this, then please use the
102
- <code>
103
- tinylib
104
- </code>
105
- library present in
106
- <code>
107
- xhr.html
108
- </code>
109
- (the only place easyXDM itself used the ajax feature).
110
- <br/>
111
- Added support to the Rpc object for using named parameters.
112
- </li>
113
- <li>
114
- 2.4.7 23.08.10
115
- <br/>
116
- Fixed <a href="http://github.com/oyvindkinsey/easyXDM/issues/issue/28">http://github.com/oyvindkinsey/easyXDM/issues/issue/28</a>
117
- <br/>
118
- Implemented consistent naming of the iframes so that they can be accessed using the frames collection.
119
- <br/>
120
- Improved the ReliableBehavior. The HashTransport is now working much better and is more deterministic.
121
- </li>
122
- <li>
123
- 2.4.6 03.08.10
124
- <br/>
125
- Fixed a small bug in the RpcBehaviors error handling. The message passed back on errors was formatted wrongly with the [data]
126
- field a property of the message instead of of the error object.
127
- </li>
128
- <li>
129
- 2.4.5 03.08.10
130
- <br/>
131
- Fixed a bug in the dom_onReady function. This would cause easyXDM to load unreliably when loaded using a script loader.
132
- </li>
133
- <li>
134
- 2.4.4 02.08.10
135
- <br/>
136
- Fixed <a href="http://github.com/oyvindkinsey/easyXDM/issues/issue/23">http://github.com/oyvindkinsey/easyXDM/issues/issue/23</a>
137
- <br/>
138
- Implemented return of ajax error messages: <a href="http://github.com/oyvindkinsey/easyXDM/issues/issue/24">http://github.com/oyvindkinsey/easyXDM/issues/issue/24</a>
139
- <br/>
140
- Implemented lazy initialization: <a href="http://github.com/oyvindkinsey/easyXDM/issues/issue/25">http://github.com/oyvindkinsey/easyXDM/issues/issue/25</a>
141
- <br/>
142
- Implemented DOMContentReady detection: <a href="http://github.com/oyvindkinsey/easyXDM/issues/issue/26">http://github.com/oyvindkinsey/easyXDM/issues/issue/26</a>
143
- <br/>
144
- </li>
145
- <li>
146
- 2.4.3 26.07.10
147
- <br/>
148
- Added two more transports, the SameOriginTransport and the FrameElementTransport.
149
- Made some improvements in the NixTransport
150
- </li>
151
- <li>
152
- 2.4.2 25.07.10
153
- <br/>
154
- Major improvements on the support for older browsers.
155
- The use of resize in the HashTransport to notify about incoming messages has now been removed as it was not reliant across browsers.
156
- The library has now been tested on IE6/7/8, Opera 10, Firefox 2, 3.6, Safari 3.2, 5 and Chrome 5, and there are now no tests that are failing.
157
- </li>
158
- <li>
159
- 2.4.1 25.07.10
160
- <br/>
161
- Fixed http://github.com/oyvindkinsey/easyXDM/issues/issue/22
162
- Implemented http://github.com/oyvindkinsey/easyXDM/issues/issue/20
163
- Fixed some minor issues relating to ajax.
164
- </li>
165
- <li>
166
- 2.4.0 20.06.10
167
- <br/>
168
- Implemented http://github.com/oyvindkinsey/easyXDM/issues/19
169
- You can now interact with the Socket/Rpc prior to the onReady event being fired.
170
- These actions will be buffered and executed once the transport is ready.
171
- Fixed an issue that lead to the minified file *not* being properly minified.
172
- </li>
173
- <li>
174
- 2.3.3 18.06.10
175
- <br/>
176
- Fixed http://github.com/oyvindkinsey/easyXDM/issues/issue/15
177
- Fixed http://github.com/oyvindkinsey/easyXDM/issues/issue/17
178
- </li>
179
- <li>
180
- 2.3.2 05.06.10
181
- <br/>
182
- Improved the ajax feature - this is now propely implemented and which should make the xhr.html file more suiting.
183
- Minor security fixes to the NixTransport.
184
- The transport configuration now takes a 'props' property that can be used to apply arbitrary properties onto the created iframe.
185
- This can be used to style the iframe using e.g 'props: {style: {border: "1px solid red"}}'
186
- </li>
187
- <li>
188
- 2.3.1 24.05.10
189
- <br/>
190
- Fixed a bug in the NixTransport that would cause the provider to fire onReady before the constructor has returned.
191
- </li>
192
- <li>
193
- 2.3.0 22.05.10
194
- <br/>
195
- Fixed some minor bugs (debug related)
196
- The biggest change is a new first-class transport for IE6 and IE7, a transport that is actually faster than postMessage for IE8!
197
- This means that you can now support IE6+ and Opera 9+ Firefox 3+ and Chrome using javascript only (no more name.html!)
198
- </li>
199
- <li>
200
- 2.2.0 21.04.10
201
- <br/>
202
- Rpc
203
- No more isVoid/isAsync
204
- These are no longer needed as all of this is automatically handled by the RpcBehavior.
205
- Optional callbacks when calling methods, success, success+error, or none if the remote method does not return data or you just don't care about it
206
- A shorthand notation for defining local methods, nameOfMethod: function(... instead of nameOfMethod: { method: function(...
207
- Smaller code base due to a simpler(!) RpcBehavior
208
- Overall
209
- Reduced the public API
210
- This makes it more manageable for most
211
- Proper documentation with code examples for Socket and Rpc
212
- Restructured internal methods so that they are faster and more easy to minify
213
- </li>
214
- <li>
215
- 2.1.0 18.04.10
216
- <br/>
217
- The Rpc behavior is now using the JSON-PRC 2.0 protocol, and will now also support an error callback.
218
- The Rpc class will also make sure that the serializer being used actually works, and so is not wrecked by the inclusion
219
- of PrototypeJs and other libraries that interferes with HTML5's JSON object.
220
- The xhr.html file is now completely self-contained and now uses separate callbacks for success and error.
221
- Lots of small changes to improve scope lookup, and to improve minifying the code.
222
- </li>
223
- <li>
224
- 2.0.1 27.03.10
225
- <br/>
226
- See commit log at github
227
- github.com/oyvindkinsey/easyXDM
228
- </li>
229
- <li>
230
- 2.0 18.03.10
231
- <br/>
232
- Refactored all the transport classes into stack elements.
233
- The transports are now exposed as a single Socket that selects the appropriate stack to initialize based on the available features and config parameters.
234
- Removed the Channel class as this can easily be implemented when needed using the Socket class and JSON.parse/stringify.
235
- Refactored the Interface class and renamed it Rpc as this is more descriptive.
236
- The optional onReady method is now a member of the config argument instead of being a separate one.
237
- Removed the serializing namespace as this was not used internally, and as it can easily be injected when needed.
238
- Renamed the methods for adding and removing events to on and un.
239
- The HashTransport is now only used when access to name.html (old hash.html) is not available.
240
- </li>
241
- <li>
242
- 1.8.0 27.02.10
243
- <br/>
244
- Both the HashTransport and the Nametransport has received a major overhaul.
245
- Generic Behaviors are now implemented, and deal with reliability (making the HashTransport reliable), queueing and sender verification.
246
- This means that all the transports are now equal when it comes to behavior, the only difference is speed.
247
- They are all reliant,
248
- they are all able to queue and dispatch messages automatically
249
- they are all secure from spoofing
250
- and they are all easy to use!
251
- With the new behavior architecture it will also be easier to add new functionality
252
- - it might even be that the transport internals will be moved into similar behaviors.
253
- </li>
254
- <li>
255
- 1.7.5 25.02.10
256
- <br/>
257
- Made several improvements to the HashTransport - this now verifies that it actually can communicate with the other end
258
- and thereby disables the spoofing the origin (as previously possible).
259
- </li>
260
- <li>
261
- 1.7.4 - 22.02.10
262
- <br/>
263
- Implemented queing for NameTransport, this also made it more reliable.
264
- This means that all transports now support rapid sending of messages, even within the same js thread.
265
- The tests has also been updated, and from tests that are supposed to fail are now skipped by default.
266
- 1.7.3 - 21.02.10
267
- <br/>
268
- Fixed NameTransport - for some unknown reason, the implementation released did not work.
269
- </li>
270
- <li>
271
- 1.7.2 - 19.02.10
272
- <br/>
273
- Applied an important bugfix contributed by Bjorn Blomqvist (http://github.com/bjornblomqvist).
274
- The bug breaks easyXDM under the following conditions
275
- the host is set up to use the BestAvailableTransport
276
- the host is set up with local: window (to support HashTransport without hash.html)
277
- the browser supports postMessage
278
- </li>
279
- <li>
280
- 1.7.1 - 19.02.10
281
- <br/>
282
- Refactored the transport classes so that all query arguments are namespaced.
283
- This should avoid errors happening due to colliding argument names.
284
- Examples of such errors are when using a wordpress page as the host, as wordpress' p argument (used for paging) would
285
- cause easyXDM to believe it was the provider instead of the consumer (host).
286
- Breaking changes:
287
- As longs as both parties are using the new version no errors will occur.
288
- But this version is unable to communicate with earlier versions.
289
- </li>
290
- <li>
291
- 1.7.0 - 02.02.10
292
- <br/>
293
- Many adjustments has been made to how the transports select mode and how the BestAvailableTransport selects a transport.
294
- For the host the BestAvailableTransport will pick the best transport dependend on the available features and parameters.
295
- For the guest the BestAvailableTransport will choose the on specified in use by reading the query line.
296
- A new transport, NameTransport has also been introduced, and is now preferred over HashTransport as long as the
297
- correct parameters are set. This is due to its ability to transfer huge amounts of data compared to the HashTransport.
298
- This does on the other hand mean that the host need to specify the location of the remote hash.html.
299
- Breaking changes:
300
- The NameTransport will not work with users who has the old hash.html file, it is therefor adviced that you
301
- rename the hash.html file so that your uses will download the correct version.
302
- </li>
303
- <li>
304
- 1.6.0 - 04.01.10
305
- <br/>
306
- Added the option to use the already loaded window as the local document for messaging when falling back
307
- to the HashTransport. This can be done by setting 'local:window' in the transports configuration.
308
- The documentation has also been changed sligtly making it a bit easier to see the necessary configuration attributes
309
- The version is being upped to 1.6 as we now have complete support for scenarios where you are not able to upload
310
- the hash.html file to the local domain, something I think is a big step forward.
311
- </li>
312
- <li>
313
- 1.5.5 - 02.01.10
314
- <br/>
315
- For scenarios where you are unable to place hash.html on the local domain, you can now
316
- set the local attribute to point at any file available on the domain, like robots.txt or favicon.ico,
317
- and set the readyAfter attribute to when you want the library to transition to the ready state.
318
- It is important that the local file has had time to load before this.
319
- </li>
320
- <li>
321
- 1.5.4 - 11.11.09
322
- <br/>
323
- easyXDM.Interface can now take an new configuration parameter, 'serializer'.
324
- This will be used instead of the JSON object if present and has to implement the same signature as the JSON object.
325
- This is to enable users to use serializing methods present in their main framework.
326
- Users of prototypejs will have to use this to override the serializer using the following serializer object
327
- <pre>
328
- {
329
- stringify(obj){
330
- return Object.toJSON(obj);
331
- },
332
- parse(str){
333
- return str.evalJSON();
334
- }
335
- }
336
- </pre>
337
- This is due to prototypejs adding the toJSON method to Array.prototype which causes the native JSON object to fail.
338
- The test suite has also been fixed so that it doesnt crash WebKit.
339
- </li>
340
- <li>
341
- 1.5.3 - 06.09.09
342
- <br/>
343
- The transports now support using remote urls containing query parameters.
344
- Added the easyXDM.apply method, and also easyXMD.WidgetManager and easyXDM.Widget.
345
- The widget classes makes it extremely easy to support widgets.
346
- </li>
347
- <li>
348
- 1.5.2 - 29.08.09
349
- <br/>
350
- Modified the HashTransport to using the resize event to trigger new messages to be read.
351
- This is a lot faster and less resource consuming than polling.
352
- For iframes placed in a container we still use polling so that we don't disturbe the layout.
353
- Added a test suite.
354
- </li>
355
- <li>
356
- 1.5.1 - 17.08.09
357
- <br/>
358
- Namespaces are now in lowercase. This makes it easier to distinguish between classes
359
- and namespaces.
360
- Refactored the createFrame method as we do no longer require the ability to name frames.
361
- Took away passing the version as a parameter to hash.html, versioning should be handled
362
- by renaming the file or by other means.
363
- Breaking changes:
364
- Namespaces changed to all lowercase letters.
365
- </li>
366
- <li>
367
- 1.5.0 - 08.08.09
368
- <br/>
369
- Restructured the HashTransport so that all dependencies are contained in one class.
370
- Also removed the need to use the fragile window.open(.. method to get a reference
371
- to the window to read from.
372
- hash.html is now called with the version as a parameter. This should help to avoid the cached
373
- version being used accross version changes.
374
- Breaking changes:
375
- hash.html calls a new method with a new signature.
376
- </li>
377
- <li>
378
- 1.4.0 - 07.08.09
379
- <br/>
380
- Renamed the library to easyXDM to avoid being associated with the XSS-vulnerability
381
- Alle references to easyXSS can be replaced with easyXDM
382
- The communication protocol has not changed, so easyXDM 1.4.0 is 100% compatible with easyXSS 1.4.0
383
- </li>
384
- <li>
385
- 1.4.0 - 07.08.09
386
- <br/>
387
- Restructured the implementation of easyXSS.Interface, this now creates its own easyXSS.Channel,
388
- just like easyXSS.Channel creates its own easyXSS.Transport.ITransport.
389
- The internals of this class has also been restructured and should be easier to understand.
390
- Breaking changes:
391
- The easyXSS.Interface constructor now takes the configuration of a channel instead of a ready channel.
392
- </li>
393
- <li>
394
- 1.3.0 - 02.08.09
395
- <br/>
396
- Restructured the code again sot that it will be easier to understand.
397
- Changed to using the 'new classname' construct instead of easyXSS.createClassname
398
- Added documentation to the examples.
399
- Breaking changes:
400
- Removed several create.. methods.
401
- </li>
402
- <li>
403
- 1.2
404
- <br/>
405
- Restructured the code to allow better documentation
406
- Converted most of the code to JsDoc format
407
- The debug version will try to easyXSS.trace all relevant actions to console.info if available
408
- Breaking changes:
409
- The method called by hash.html has moved.
410
- </li>
411
- </ul>
412
- </body>
413
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/cors/index.html DELETED
@@ -1,214 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM cross-domain XHMLHttpRequest provider</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- // This should be changed so that it points to the minified version before use in production.
7
- </script>
8
- <script type="text/javascript">
9
- // Update to point to your copy
10
- easyXDM.DomHelper.requiresJSON("../json2.js");
11
- </script>
12
- <script type="text/javascript">
13
-
14
- /*
15
- * This is a CORS (Cross-Origin Resource Sharing) and AJAX enabled endpoint for easyXDM.
16
- * The ACL code is adapted from pmxdr (http://github.com/eligrey/pmxdr/) by Eli Grey (http://eligrey.com/)
17
- *
18
- */
19
- // From http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
20
- function isHostMethod(object, property){
21
- var t = typeof object[property];
22
- return t == 'function' ||
23
- (!!(t == 'object' && object[property])) ||
24
- t == 'unknown';
25
- }
26
-
27
- /**
28
- * Creates a cross-browser XMLHttpRequest object
29
- * @return {XMLHttpRequest} A XMLHttpRequest object.
30
- */
31
- var getXhr = (function(){
32
- if (isHostMethod(window, "XMLHttpRequest")) {
33
- return function(){
34
- return new XMLHttpRequest();
35
- };
36
- }
37
- else {
38
- var item = (function(){
39
- var list = ["Microsoft", "Msxml2", "Msxml3"], i = list.length;
40
- while (i--) {
41
- try {
42
- item = list[i] + ".XMLHTTP";
43
- var obj = new ActiveXObject(item);
44
- return item;
45
- }
46
- catch (e) {
47
- }
48
- }
49
- }());
50
- return function(){
51
- return new ActiveXObject(item);
52
- };
53
- }
54
- }());
55
-
56
- // this file is by default set up to use Access Control - this means that it will use the headers set by the server to decide whether or not to allow the call to return
57
- var useAccessControl = true;
58
- // always trusted origins, can be exact strings or regular expressions
59
- var alwaysTrustedOrigins = [(/\.?easyxdm\.net/), (/xdm1/)];
60
-
61
- // instantiate a new easyXDM object which will handle the request
62
- var remote = new easyXDM.Rpc({
63
- local: "../name.html",
64
- swf: "../easyxdm.swf"
65
- }, {
66
- local: {
67
- // define the exposed method
68
- request: function(config, success, error){
69
-
70
- // apply default values if not set
71
- easyXDM.apply(config, {
72
- method: "POST",
73
- headers: {
74
- "Content-Type": "application/x-www-form-urlencoded",
75
- "X-Requested-With": "XMLHttpRequest"
76
- },
77
- success: Function.prototype,
78
- error: function(msg){
79
- throw new Error(msg);
80
- },
81
- data: {},
82
- timeout: 10 * 1000
83
- }, true);
84
-
85
- // set the CORS request header
86
- // only if there is no XHR2 features
87
- if (!window.XMLHttpRequest || !('withCredentials' in (new XMLHttpRequest))) {
88
- config.headers.Origin = remote.origin;
89
- }
90
-
91
- var isPOST = config.method == "POST";
92
-
93
- // convert the data into a format we can send to the server
94
- var pairs = [];
95
- for (var key in config.data) {
96
- if (config.data.hasOwnProperty(key)) {
97
- pairs.push(encodeURIComponent(key) + "=" + encodeURIComponent(config.data[key]));
98
- }
99
- }
100
- var data = pairs.join("&");
101
-
102
- // create the XMLHttpRequest object
103
- var req = getXhr();
104
- var url = !isPOST && data
105
- ? config.url + (~config.url.indexOf('?') ? '&' : '?') + data
106
- : config.url;
107
- req.open(config.method, url, true);
108
-
109
- // apply the request headers
110
- for (var prop in config.headers) {
111
- if (config.headers.hasOwnProperty(prop) && config.headers[prop]) {
112
- req.setRequestHeader(prop, config.headers[prop]);
113
- }
114
- }
115
-
116
- // set a timeout
117
- var timeout;
118
- timeout = setTimeout(function(){
119
- // reset the handler
120
- req.onreadystatechange = Function.prototype;
121
- req.abort();
122
- req = null;
123
- error({
124
- message: "timeout after " + config.timeout + " second",
125
- status: 0,
126
- data: null,
127
- toString: function(){
128
- return this.message + " Status: " + this.status;
129
- }
130
- }, null);
131
- }, config.timeout);
132
-
133
- // check if this origin should always be trusted
134
- var alwaysTrusted = false, i = alwaysTrustedOrigins.length;
135
- while (i-- && !alwaysTrusted) {
136
- if (alwaysTrustedOrigins[i] instanceof RegExp) {
137
- alwaysTrusted = alwaysTrustedOrigins[i].test(remote.origin);
138
- }
139
- else if (typeof alwaysTrustedOrigins[i] == "string") {
140
- alwaysTrusted = (remote.origin === alwaysTrustedOrigins[i]);
141
- }
142
- }
143
-
144
-
145
- // define the onreadystate handler
146
- req.onreadystatechange = function(){
147
- if (req.readyState == 4) {
148
- clearTimeout(timeout);
149
-
150
- // parse the response headers
151
- var rawHeaders = req.getAllResponseHeaders(), headers = {}, headers_lowercase = {}, reHeader = /([\w-_]+):\s+(.*)$/gm, m;
152
- while ((m = reHeader.exec(rawHeaders))) {
153
- headers_lowercase[m[1].toLowerCase()] = headers[m[1]] = m[2];
154
- }
155
-
156
- if (req.status < 200 || req.status >= 300) {
157
- if (useAccessControl) {
158
- error("INVALID_STATUS_CODE");
159
- }
160
- else {
161
- error("INVALID_STATUS_CODE", {
162
- status: req.status,
163
- data: req.responseText
164
- });
165
- }
166
- }
167
- else {
168
-
169
- var errorMessage;
170
- if (useAccessControl) {
171
- // normalize the valuse access controls
172
- var aclAllowedOrigin = (headers_lowercase["access-control-allow-origin"] || "").replace(/\s/g, "");
173
- var aclAllowedMethods = (headers_lowercase["access-control-allow-methods"] || "").replace(/\s/g, "");
174
-
175
- // determine if origin is trusted
176
- if (alwaysTrusted || aclAllowedOrigin == "*" || aclAllowedOrigin.indexOf(remote.origin) != -1) {
177
- // determine if the request method was allowed
178
- if (aclAllowedMethods && aclAllowedMethods != "*" && aclAllowedMethods.indexOf(config.method) == -1) {
179
- errorMessage = "DISALLOWED_REQUEST_METHOD";
180
- }
181
- }
182
- else {
183
- errorMessage = "DISALLOWED_ORIGIN";
184
- }
185
-
186
- }
187
-
188
- if (errorMessage) {
189
- error(errorMessage);
190
- }
191
- else {
192
- success({
193
- data: req.responseText,
194
- status: req.status,
195
- headers: headers
196
- });
197
- }
198
- }
199
- // reset the handler
200
- req.onreadystatechange = Function.prototype;
201
- req = null;
202
- }
203
- };
204
-
205
- // issue the request
206
- req.send(isPOST ? data : "");
207
- }
208
- }
209
- });
210
- </script>
211
- </head>
212
- <body>
213
- </body>
214
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/easyXDM.debug.js DELETED
@@ -1,47 +0,0 @@
1
- /*jslint evil: true */
2
- /**
3
- * easyXDM
4
- * http://easyxdm.net/
5
- * Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in
15
- * all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
- /**
26
- * This just aggregates all the separate files
27
- */
28
- (function(){
29
- var scripts = document.getElementsByTagName("script"), src = scripts[scripts.length - 1].src.replace("easyXDM.debug.js", "");
30
-
31
- document.write(unescape("%3Cscript src='" + src + "Core.js' type='text/javascript'%3E%3C/script%3E"));
32
- document.write(unescape("%3Cscript src='" + src + "Debug.js' type='text/javascript'%3E%3C/script%3E"));
33
- document.write(unescape("%3Cscript src='" + src + "DomHelper.js' type='text/javascript'%3E%3C/script%3E"));
34
- document.write(unescape("%3Cscript src='" + src + "Fn.js' type='text/javascript'%3E%3C/script%3E"));
35
- document.write(unescape("%3Cscript src='" + src + "Socket.js' type='text/javascript'%3E%3C/script%3E"));
36
- document.write(unescape("%3Cscript src='" + src + "Rpc.js' type='text/javascript'%3E%3C/script%3E"));
37
- document.write(unescape("%3Cscript src='" + src + "stack/FlashTransport.js' type='text/javascript'%3E%3C/script%3E"));
38
- document.write(unescape("%3Cscript src='" + src + "stack/SameOriginTransport.js' type='text/javascript'%3E%3C/script%3E"));
39
- document.write(unescape("%3Cscript src='" + src + "stack/PostMessageTransport.js' type='text/javascript'%3E%3C/script%3E"));
40
- document.write(unescape("%3Cscript src='" + src + "stack/FrameElementTransport.js' type='text/javascript'%3E%3C/script%3E"));
41
- document.write(unescape("%3Cscript src='" + src + "stack/NameTransport.js' type='text/javascript'%3E%3C/script%3E"));
42
- document.write(unescape("%3Cscript src='" + src + "stack/HashTransport.js' type='text/javascript'%3E%3C/script%3E"));
43
- document.write(unescape("%3Cscript src='" + src + "stack/ReliableBehavior.js' type='text/javascript'%3E%3C/script%3E"));
44
- document.write(unescape("%3Cscript src='" + src + "stack/QueueBehavior.js' type='text/javascript'%3E%3C/script%3E"));
45
- document.write(unescape("%3Cscript src='" + src + "stack/VerifyBehavior.js' type='text/javascript'%3E%3C/script%3E"));
46
- document.write(unescape("%3Cscript src='" + src + "stack/RpcBehavior.js' type='text/javascript'%3E%3C/script%3E"));
47
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/easyxdm.swf DELETED
Binary file
js/bluepay_echeck/easyXDM/src/end_scope.txt DELETED
@@ -1,2 +0,0 @@
1
- global.easyXDM = easyXDM;
2
- })(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent);
 
 
js/bluepay_echeck/easyXDM/src/example/blank.html DELETED
@@ -1,10 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>Blank page</title>
5
- </head>
6
- <body>
7
- This page will be replaced with the actuall content in just a jiffy..
8
- </body>
9
- </html>
10
-
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/bookmark.html DELETED
@@ -1,50 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
- <title></title>
6
- </head>
7
- <body>
8
- <img src="../tests/s.gif" />
9
- <script type="text/javascript">
10
- if (location.host.indexOf("easyxdm.net") !== -1) {
11
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
12
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
13
- }
14
- </script>
15
- <script type="text/javascript">
16
- if (location.host.indexOf("easyxdm.net") !== -1) {
17
- try {
18
- var pageTracker = _gat._getTracker("UA-9535591-3");
19
- pageTracker._setDomainName(".easyxdm.net");
20
- pageTracker._trackPageview();
21
- }
22
- catch (err) {
23
- }
24
- }
25
- </script>
26
- <a id="bookmark" src="">Bookmark</a>
27
- <script type="text/javascript">
28
- var baseUrl = location.href.substring(0, location.href.lastIndexOf("/"));
29
-
30
- // to simplify development, we create the bookmarklet as a regular function
31
- function bookmark(){
32
- if (typeof myBookmark === "undefined") {
33
- var script = document.createElement("script");
34
- script.type = "text/javascript";
35
- script.src = baseUrl + "/bookmark.js";
36
- document.getElementsByTagName("head")[0].appendChild(script);
37
- }
38
- else {
39
- myBookmark.run();
40
- }
41
- }
42
-
43
- // and then we include it using .toString().
44
- document.getElementById("bookmark").href = 'javascript:(' +
45
- (bookmark.toString().replace('baseUrl + "', '"' + baseUrl)).replace(/\s+/g, " ") +
46
- ')();';
47
- // when finished, you just copy the url from the rendered page
48
- </script>
49
- </body>
50
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/bookmark.js DELETED
@@ -1,74 +0,0 @@
1
- var myBookmark = (function(){
2
- var s1, s2, isLoaded = false, xhr, head = document.getElementsByTagName('head')[0];
3
- var scripts = document.getElementsByTagName("script");
4
- var REMOTE = (function(){
5
- var remote = location.href;
6
- switch (location.host) {
7
- case "provider.easyxdm.net":
8
- location.href = remote.replace("provider", "consumer");
9
- break;
10
- case "xdm1":
11
- remote = remote.replace("xdm1", "xdm2");
12
- break;
13
- default:
14
- remote = "http://provider.easyxdm.net/current/example/";
15
- }
16
- return remote.substring(0, remote.lastIndexOf("/"));
17
- }());
18
-
19
- function run(){
20
- if (typeof xhr === "undefined") {
21
- return;
22
- }
23
- xhr.post("example/glossary.php", {
24
- param1: "a",
25
- param2: "b"
26
- }, function(json){
27
- alert(json.glossary.title);
28
- });
29
- }
30
-
31
- function scriptOnLoad(){
32
- if (isLoaded || typeof easyXDM === "undefined" || typeof JSON === "undefined") {
33
- return;
34
- }
35
- isLoaded = true;
36
- xhr = new easyXDM.Rpc({
37
- remote: REMOTE + "/../xhr.html",
38
- onReady: function(){
39
- run();
40
- }
41
- }, {
42
- remote: {
43
- post: {}
44
- }
45
- });
46
-
47
- }
48
- s1 = document.createElement("script");
49
- s1.type = "text/javascript";
50
- s1.src = REMOTE + "/../easyXDM.debug.js";
51
- s1.onreadystatechange = function(){
52
- if (this.readyState === "complete" || this.readyState === "loaded") {
53
- scriptOnLoad();
54
- }
55
- };
56
- s1.onload = scriptOnLoad;
57
- head.appendChild(s1);
58
-
59
- if (typeof JSON === "undefined" || !JSON) {
60
- s2 = document.createElement("script");
61
- s2.type = "text/javascript";
62
- s2.src = REMOTE + "/../json2.js";
63
- s2.onreadystatechange = function(){
64
- if (this.readyState === "complete" || this.readyState === "loaded") {
65
- scriptOnLoad();
66
- }
67
- };
68
- s2.onload = scriptOnLoad;
69
- head.appendChild(s2);
70
- }
71
- return {
72
- run: run
73
- };
74
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/bridge.html DELETED
@@ -1,135 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- /* Here we demo how to have two visible web applications communicate together.
15
- * This is done by having the remote interface open a visible window and loading
16
- * the application in this.
17
- * Since the remote interface has access to the entire DOM (including javascript)
18
- * of the opened window, the remote interface is able to interface freely with the
19
- * remote web application and can serve as a bridge between the two applications.
20
- */
21
- var REMOTE = (function(){
22
- var remote = location.href;
23
- switch (location.host) {
24
- case "provider.easyxdm.net":
25
- location.href = remote.replace("provider", "consumer");
26
- break;
27
- case "easyxdm.net":
28
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
29
- break;
30
- case "consumer.easyxdm.net":
31
- remote = remote.replace("consumer", "provider");
32
- break;
33
- case "xdm1":
34
- remote = remote.replace("xdm1", "xdm2");
35
- break;
36
- }
37
- return remote.substring(0, remote.lastIndexOf("/"));
38
- }());
39
-
40
-
41
-
42
-
43
- var proxy, win;
44
- function openPopup(){
45
- if (win) {
46
- // this allows to open new windows if the popup was closed
47
- if (win.closed) {
48
- win = window.open(REMOTE + '/blank.html', 'mainapp', "width=400, height=400");
49
- proxy.open("mainapp");
50
- }
51
- return;
52
- }
53
- // open up the popup
54
- win = window.open(REMOTE + '/blank.html', 'mainapp', "width=400, height=400");
55
-
56
- document.getElementById("btn").disabled = "";
57
-
58
- proxy = new easyXDM.Rpc(/** The configuration */{
59
- /**
60
- * Register the url to name.html, this must be an absolute path
61
- * or a path relative to the root.
62
- * @field
63
- */
64
- local: "../name.html",
65
- swf: REMOTE + "/../easyxdm.swf",
66
- /**
67
- * Register the url to the remote interface
68
- * @field
69
- */
70
- remote: REMOTE + "/remote.html",
71
- remoteHelper: REMOTE + "/../name.html"
72
- }, {
73
- remote: {
74
- open: {},
75
- postMessage: {}
76
- },
77
- local: {
78
- /**
79
- * Register the method that should handle incoming data
80
- * @param {Object} data
81
- * @param {String} origin
82
- */
83
- postMessage: function(data){
84
- var div = document.createElement("div");
85
- div.innerHTML = "data from '" + proxy.origin + "'";
86
- document.body.appendChild(div);
87
- for (var key in data) {
88
- if (data.hasOwnProperty(key)) {
89
- div = document.createElement("div");
90
- div.innerHTML = key + "=" + data[key];
91
- document.body.appendChild(div);
92
- }
93
- }
94
- }
95
- }
96
- });
97
-
98
- // lets tell the proxy to open up the window as soon as possible
99
- proxy.open("mainapp");
100
- }
101
- </script>
102
- </head>
103
- <body>
104
- <div style="border:1px solid black;padding:3px;margin:10px;">
105
- <a href="index.html">Index of examples</a>
106
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
107
- |
108
- | <a href="http://easyxdm.net/">easyXDM.net</a>
109
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
110
- <br/>
111
- The examples are executing slower than the production build due to the extensive tracing.
112
- <br/>
113
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
114
- </div>
115
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
116
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
117
- </div>
118
- <input id="btnOpen" type="button" onclick="openPopup();" value="Open popup"/><!-- Send som data to the other side --><input id="btn" disabled="disabled" type="button" onclick="proxy.postMessage({a:'b',c:'d',e:'f'});" value="send data to remote"/>
119
- <script type="text/javascript">
120
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
121
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
122
- </script>
123
- <script type="text/javascript">
124
- if (location.host.indexOf("easyxdm.net") !== -1) {
125
- try {
126
- var pageTracker = _gat._getTracker("UA-9535591-3");
127
- pageTracker._setDomainName(".easyxdm.net");
128
- pageTracker._trackPageview();
129
- }
130
- catch (err) {
131
- }
132
- }
133
- </script>
134
- </body>
135
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/data.html DELETED
@@ -1,133 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var serializer = {
9
- /**
10
- * Serializes a hashtable and returns it as a string
11
- * @param {Object} data The data to serialize
12
- * @returns The serialized string
13
- * @type {String}
14
- */
15
- stringify: function(data){
16
- var message = "";
17
- for (var key in data) {
18
- if (data.hasOwnProperty(key)) {
19
- message += key + "=" + escape(data[key]) + "&";
20
- }
21
- }
22
- return message.substring(0, message.length - 1);
23
- },
24
- /**
25
- * Deserializes a string and returns a hashtable
26
- * @param {String} message The string to deserialize
27
- * @returns An hashtable populated with key-value pairs
28
- * @type {Object}
29
- */
30
- parse: function(message){
31
- var data = {};
32
- var d = message.split("&");
33
- var pair, key, value;
34
- for (var i = 0, len = d.length; i < len; i++) {
35
- pair = d[i];
36
- key = pair.substring(0, pair.indexOf("="));
37
- value = pair.substring(key.length + 1);
38
- data[key] = unescape(value);
39
- }
40
- return data;
41
- }
42
- };
43
-
44
- var channel;
45
- var REMOTE = (function(){
46
- var remote = location.href;
47
- switch (location.host) {
48
- case "provider.easyxdm.net":
49
- location.href = remote.replace("provider", "consumer");
50
- break;
51
- case "easyxdm.net":
52
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
53
- break;
54
- case "consumer.easyxdm.net":
55
- remote = remote.replace("consumer", "provider");
56
- break;
57
- case "xdm1":
58
- remote = remote.replace("xdm1", "xdm2");
59
- break;
60
- }
61
- return remote.substring(0, remote.lastIndexOf("/"));
62
- }());
63
- window.onload = function(){
64
- /**
65
- * When the window is finished loading start setting up the channel
66
- */
67
- channel = new easyXDM.Socket(/** The configuration */{
68
- /**
69
- * Register the url to hash.html, this must be an absolute path
70
- * or a path relative to the root.
71
- * @field
72
- */
73
- local: "../name.html",
74
- swf: REMOTE + "/../easyxdm.swf",
75
- /**
76
- * Register the url to the remote interface
77
- * @field
78
- */
79
- remote: REMOTE + "/remotedata.html",
80
- remoteHelper: REMOTE + "/../name.html",
81
- onReady: function(){
82
- /**
83
- * Send some data to the other side
84
- */
85
- channel.postMessage(serializer.stringify({
86
- propA: "abc",
87
- propB: "def",
88
- propC: 44
89
- }));
90
- }
91
- });
92
- };
93
- </script>
94
- </head>
95
- <body>
96
- <div style="border:1px solid black;padding:3px;margin:10px;">
97
- <a href="index.html">Index of examples</a>
98
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
99
- |
100
- | <a href="http://easyxdm.net/">easyXDM.net</a>
101
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
102
- <br/>
103
- The examples are executing slower than the production build due to the extensive tracing.
104
- <br/>
105
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
106
- </div>
107
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
108
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
109
- </div>
110
- </div>
111
- <br/>
112
- <br/>
113
- <input type="text" id="code" size="100" value="channel.postMessage(serializer.stringify({propC:'c',procD:'d',propE:88}))"/>
114
- <button onclick="eval(document.getElementById('code').value);">
115
- eval code
116
- </button>
117
- <script type="text/javascript">
118
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
119
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
120
- </script>
121
- <script type="text/javascript">
122
- if (location.host.indexOf("easyxdm.net") !== -1) {
123
- try {
124
- var pageTracker = _gat._getTracker("UA-9535591-3");
125
- pageTracker._setDomainName(".easyxdm.net");
126
- pageTracker._trackPageview();
127
- }
128
- catch (err) {
129
- }
130
- }
131
- </script>
132
- </body>
133
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/glossary.aspx DELETED
@@ -1,29 +0,0 @@
1
- <%
2
- Response.ContentType = "application/json"
3
- Response.AddHeader("x-foo", "bar")
4
- Response.AddHeader("Access-Control-Allow-Origin", "http://xdm4")
5
- Response.AddHeader("Access-Control-Allow-Methods", "POST")
6
-
7
- %>
8
- {
9
- "glossary": {
10
- "title": "example glossary",
11
- "GlossDiv": {
12
- "title": "S",
13
- "GlossList": {
14
- "GlossEntry": {
15
- "ID": "SGML",
16
- "SortAs": "SGML",
17
- "GlossTerm": "Standard Generalized Markup Language",
18
- "Acronym": "SGML",
19
- "Abbrev": "ISO 8879:1986",
20
- "GlossDef": {
21
- "para": "A meta-markup language, used to create markup languages such as DocBook.",
22
- "GlossSeeAlso": ["GML", "XML"]
23
- },
24
- "GlossSee": "markup"
25
- }
26
- }
27
- }
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/index.html DELETED
@@ -1,75 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- </head>
6
- <body>
7
- <div style="border:1px solid black;padding:3px;margin:10px;">
8
- <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
9
- |
10
- | <a href="http://easyxdm.net/">easyXDM.net</a>
11
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
12
- <br/>
13
- The examples are executing slower than the production build due to the extensive tracing.
14
- <br/>
15
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
16
- </div>
17
- <ul>
18
- <li>
19
- <a href="transport.html">Transport</a>
20
- <br/>
21
- Example of passing a string message from one domain to another using the Socket.
22
- </li>
23
- <li>
24
- <a href="data.html">Data</a>
25
- <br/>
26
- Example of passing data using a Socket and a custom serializer/deserializer.
27
- </li>
28
- <li>
29
- <a href="methods.html">Methods</a>
30
- <br/>
31
- Example of using the Rpc object for executing Remote Procedure Calls with arguments and having results returned.
32
- </li>
33
- <li>
34
- <a href="resize_iframe.html">Resize iframe</a>
35
- <br/>
36
- Example on how to use easyXDM to automatically resize an iframe. This uses an intermediate frame to enable navigation of the contained document
37
- </li>
38
- <li>
39
- <a href="upload.html">Upload</a>
40
- <br/>
41
- Example on how to facilitate 'cross domain AJAX upload'.
42
- </li>
43
- <li>
44
- <a href="widgets.html">Widgets</a>
45
- <br/>
46
- Example on how to use easyXDM to build a framework for widgets using a pub/sub schema.
47
- </li>
48
- <li>
49
- <a href="xhr.html">XHR</a>
50
- <br/>
51
- Example of using the shipped /cors/ endpoint to retrieve resources across the domain boundary.
52
- </li>
53
- <li>
54
- <a href="bridge.html">Bridge</a>
55
- <br/>
56
- Experimental example of how to 'bridge' two web apps together.
57
- </li>
58
- </ul>
59
- <script type="text/javascript">
60
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
61
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
62
- </script>
63
- <script type="text/javascript">
64
- if (location.host.indexOf("easyxdm.net") !== -1) {
65
- try {
66
- var pageTracker = _gat._getTracker("UA-9535591-3");
67
- pageTracker._setDomainName(".easyxdm.net");
68
- pageTracker._trackPageview();
69
- }
70
- catch (err) {
71
- }
72
- }
73
- </script>
74
- </body>
75
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/methods.html DELETED
@@ -1,148 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- var REMOTE = (function(){
15
- var remote = location.href;
16
- switch (location.host) {
17
- case "provider.easyxdm.net":
18
- location.href = remote.replace("provider", "consumer");
19
- break;
20
- case "easyxdm.net":
21
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
22
- break;
23
- case "consumer.easyxdm.net":
24
- remote = remote.replace("consumer", "provider");
25
- break;
26
- case "xdm1":
27
- remote = remote.replace("xdm1", "xdm2");
28
- break;
29
- }
30
- return remote.substring(0, remote.lastIndexOf("/"));
31
- }());
32
- var remote = new easyXDM.Rpc(/** The channel configuration */{
33
- /**
34
- * Register the url to hash.html, this must be an absolute path
35
- * or a path relative to the root.
36
- * @field
37
- */
38
- local: "../name.html",
39
- swf: REMOTE + "/../easyxdm.swf",
40
- /**
41
- * Register the url to the remote interface
42
- * @field
43
- */
44
- remote: REMOTE + "/remotemethods.html",
45
- remoteHelper: REMOTE + "/../name.html",
46
- /**
47
- * Register the DOMElement that the generated IFrame should be inserted into
48
- */
49
- container: "embedded",
50
- props: {
51
- style: {
52
- border: "2px dotted red",
53
- height: "200px"
54
- }
55
- },
56
- onReady: function(){
57
- /**
58
- * Call a method on the other side
59
- */
60
- remote.noOp();
61
- }
62
- }, /** The interface configuration */ {
63
- remote: {
64
- addNumbers: {},
65
- multiplyNumbers: {},
66
- noOp: {}
67
- },
68
- local: {
69
- alertMessage: function(msg){
70
- alert(msg);
71
- }
72
- }
73
- });
74
-
75
- function add(a, b){
76
- remote.addNumbers(a, b, function(result){
77
- alert(a + " + " + b + " = " + result);
78
- });
79
- }
80
-
81
- function multiply(a, b){
82
- remote.multiplyNumbers(a, b, function(result){
83
- alert(a + " x " + b + " = " + result);
84
- });
85
- }
86
- </script>
87
- <style type="text/css">
88
-
89
- #embedded iframe {
90
- width: 100%;
91
- height: 100%;
92
- }
93
- </style>
94
- </head>
95
- <body>
96
- <div style="border:1px solid black;padding:3px;margin:10px;">
97
- <a href="index.html">Index of examples</a>
98
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
99
- |
100
- | <a href="http://easyxdm.net/">easyXDM.net</a>
101
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
102
- <br/>
103
- The examples are executing slower than the production build due to the extensive tracing.
104
- <br/>
105
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
106
- </div>
107
- <script type="text/javascript">
108
- document.write("Domain: " + location.host);
109
- </script>
110
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
111
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
112
- </div>
113
- <div id="embedded">
114
- </div>
115
- <div>
116
- The remote implementation is synchronous and will return immediately
117
- <br/>
118
- <input type="button" onclick="add(3,5);" value="call addNumbers on remote domain"/>
119
- <br/>
120
- <br/>
121
- The remote implementation of multiplyNumbers is asynchronous and will return after 5seconds
122
- <br/>
123
- This shows that you can use async calls in the remote method, eg. XHR calls
124
- <br/>
125
- <input type="button" onclick="multiply(3,5);" value="call multiplyNumbers on remote domain"/>
126
- <br/>
127
- <br/>
128
- This calls a non-returning method on the remote side
129
- <br/>
130
- <input type="button" onclick="remote.noOp();" value="call noOp on the remote domain"/>
131
- </div>
132
- <script type="text/javascript">
133
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
134
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
135
- </script>
136
- <script type="text/javascript">
137
- if (location.host.indexOf("easyxdm.net") !== -1) {
138
- try {
139
- var pageTracker = _gat._getTracker("UA-9535591-3");
140
- pageTracker._setDomainName(".easyxdm.net");
141
- pageTracker._trackPageview();
142
- }
143
- catch (err) {
144
- }
145
- }
146
- </script>
147
- </body>
148
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remote.html DELETED
@@ -1,83 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- var win, remoteapp; // reference to the popups window
15
- var proxy = new easyXDM.Rpc(/** The configuration */{
16
- local: "../name.html",
17
- swf: "../easyxdm.swf"
18
- }, {
19
- local: {
20
- /**
21
- * This is used to open up the popup. A popup with the given name should already be opened
22
- * in the user click handler.
23
- */
24
- open: function(name){
25
- remoteapp = null;
26
- // we now open the window, passing the name of this window (includes the channel name)
27
- // in case it has to look us up using the framename
28
- win = window.open('remoteapp.html' + '#easyXDM_' + easyXDM.query.xdm_c + '_provider', name, "width=400, height=400");
29
- },
30
- /**
31
- * This is where we receive the data
32
- * @param {Object} data The data
33
- */
34
- postMessage: function(data){
35
- if (win.closed) {
36
- alert("the popup has been closed - please open it again");
37
- return;
38
- }
39
- var div = remoteapp.document.createElement("div");
40
- div.innerHTML = "data from '" + proxy.origin + "'";
41
- if (remoteapp) {
42
- remoteapp.document.body.appendChild(div);
43
- for (var key in data) {
44
- if (data.hasOwnProperty(key)) {
45
- div = remoteapp.document.createElement("div");
46
- div.innerHTML = key + "=" + data[key];
47
- remoteapp.document.body.appendChild(div);
48
- }
49
- }
50
- remoteapp.focus();
51
- }
52
- }
53
- },
54
- remote: {
55
- postMessage: {}
56
- }
57
- });
58
-
59
-
60
- /**
61
- * The popup must use this window to register itself
62
- * @param {DOMWindow} app The window object of the popup
63
- */
64
- function setApp(app){
65
- remoteapp = app;
66
- }
67
-
68
- /**
69
- * The popup must use this method to send data. This clones the object in order to
70
- * work around a but in IE
71
- * @param {Object} data The data to send
72
- */
73
- function sendData(data){
74
- var copy = {};
75
- // copy the object in order to avoid the JSON serialization bug
76
- easyXDM.apply(copy, data);
77
- proxy.postMessage(copy);
78
- }
79
- </script>
80
- </head>
81
- <body>
82
- </body>
83
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remoteapp.html DELETED
@@ -1,37 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript">
6
- var target = location.hash.substring(1);
7
-
8
- var host = window.opener.frames[target];
9
-
10
- if (window.opener) {
11
- try {
12
- // test if we have access to the document
13
- if (window.opener.document.title) {
14
- host = window.opener;
15
- }
16
-
17
- }
18
- catch (xDomainError) {
19
- // we have an opener, but it's not on our domain,
20
- host = window.opener.frames[target];
21
- }
22
-
23
- if (host) {
24
- try {
25
- host.setApp(window);
26
- }
27
- catch (browserHostError) {
28
- alert("was unable to gain a reference to the iframe");
29
- }
30
- }
31
- }
32
- </script>
33
- </head>
34
- <body>
35
- <!-- Send some data to the other side using the proxy --><input type="button" onclick="host.sendData({a:'b',c:'d',e:'f'});" value="send data to local"/>
36
- </body>
37
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remotedata.html DELETED
@@ -1,64 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var serializer = {
9
- /**
10
- * Serializes a hashtable and returns it as a string
11
- * @param {Object} data The data to serialize
12
- * @returns The serialized string
13
- * @type {String}
14
- */
15
- stringify: function(data){
16
- var message = "";
17
- for (var key in data) {
18
- if (data.hasOwnProperty(key)) {
19
- message += key + "=" + escape(data[key]) + "&";
20
- }
21
- }
22
- return message.substring(0, message.length - 1);
23
- },
24
- /**
25
- * Deserializes a string and returns a hashtable
26
- * @param {String} message The string to deserialize
27
- * @returns An hashtable populated with key-value pairs
28
- * @type {Object}
29
- */
30
- parse: function(message){
31
- var data = {};
32
- var d = message.split("&");
33
- var pair, key, value;
34
- for (var i = 0, len = d.length; i < len; i++) {
35
- pair = d[i];
36
- key = pair.substring(0, pair.indexOf("="));
37
- value = pair.substring(key.length + 1);
38
- data[key] = unescape(value);
39
- }
40
- return data;
41
- }
42
- };
43
-
44
- var socket = new easyXDM.Socket(/** The configuration */{
45
- local: "../name.html",
46
- swf: "../easyxdm.swf",
47
- /**
48
- * Register the method that should handle incoming data
49
- * @param {Object} data
50
- * @param {String} origin
51
- */
52
- onMessage: function(data, origin){
53
- data = serializer.parse(data);
54
- alert("Received data from '" + origin + "':");
55
- for (var key in data) {
56
- alert("Property '" + key + "'=" + data[key]);
57
- }
58
- }
59
- });
60
- </script>
61
- </head>
62
- <body>
63
- </body>
64
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remotemethods.html DELETED
@@ -1,46 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- var remote = new easyXDM.Rpc(/** The channel configuration*/{
15
- local: "../name.html",
16
- swf: "../easyxdm.swf"
17
- }, /** The configuration */ {
18
- remote: {
19
- alertMessage: {}
20
- },
21
- local: {
22
- addNumbers: function(a, b){
23
- return a + b;
24
- },
25
- multiplyNumbers: function(a, b, fn){
26
- window.setTimeout(function(){
27
- fn(a * b);
28
- }, 5000);
29
- },
30
- noOp: function(){
31
- alert("Method not returning any data");
32
- }
33
- }
34
- });
35
- </script>
36
- </head>
37
- <body>
38
- <script type="text/javascript">
39
- document.write("Domain: " + location.host);
40
- </script>
41
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
42
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
43
- </div>
44
- <input type="button" onclick="remote.alertMessage('message from remote');" value="call alertMessage on local domain"/>
45
- </body>
46
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remoterpcbackend.html DELETED
@@ -1,36 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- var remote = new easyXDM.Rpc(/** The channel configuration*/{
15
- local: "../name.html"
16
- }, /** The configuration */ {
17
- /**
18
- *
19
- * @param {Object} rpc A JSON-RPC 2.0 request object
20
- * @param {Function} reply The callback method. Takes a single JSON-RPC 2.0 response object.
21
- */
22
- handle: function(rpc, reply){
23
- alert("requested to execute procedure '" + rpc.method + "'");
24
- }
25
- });
26
- </script>
27
- </head>
28
- <body>
29
- <script type="text/javascript">
30
- document.write("Domain: " + location.host);
31
- </script>
32
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
33
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
34
- </div>
35
- </body>
36
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/remotetransport.html DELETED
@@ -1,24 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var transport = new easyXDM.Socket(/** The configuration */{
9
- local: "../name.html",
10
- swf: "../easyxdm.swf",
11
- /**
12
- * Register the method that should handle incoming messages
13
- * @param {String} data
14
- * @param {String} origin
15
- */
16
- onMessage: function(message, origin){
17
- alert("Received '" + message + "' from '" + origin + "'");
18
- }
19
- });
20
- </script>
21
- </head>
22
- <body>
23
- </body>
24
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/resize_iframe.html DELETED
@@ -1,70 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var REMOTE = (function(){
9
- var remote = location.href;
10
- switch (location.host) {
11
- case "provider.easyxdm.net":
12
- location.href = remote.replace("provider", "consumer");
13
- break;
14
- case "easyxdm.net":
15
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
16
- break;
17
- case "consumer.easyxdm.net":
18
- remote = remote.replace("consumer", "provider");
19
- break;
20
- case "xdm1":
21
- remote = remote.replace("xdm1", "xdm2");
22
- break;
23
- }
24
- return remote.substring(0, remote.lastIndexOf("/"));
25
- }());
26
-
27
- var transport = new easyXDM.Socket(/** The configuration */{
28
- remote: REMOTE + "/resize_intermediate.html?url=resized_iframe_1.html",
29
- swf: REMOTE + "/../easyxdm.swf",
30
- container: "embedded",
31
- onMessage: function(message, origin){
32
- this.container.getElementsByTagName("iframe")[0].style.height = message + "px";
33
- }
34
- });
35
- </script>
36
- </head>
37
- <body>
38
- <div style="border:1px solid black;padding:3px;margin:10px;">
39
- <a href="index.html">Index of examples</a>
40
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
41
- |
42
- | <a href="http://easyxdm.net/">easyXDM.net</a>
43
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
44
- <br/>
45
- The examples are executing slower than the production build due to the extensive tracing.
46
- <br/>
47
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
48
- </div>
49
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
50
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
51
- </div>
52
- <div id="embedded">
53
- </div>
54
- <script type="text/javascript">
55
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
56
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
57
- </script>
58
- <script type="text/javascript">
59
- if (location.host.indexOf("easyxdm.net") !== -1) {
60
- try {
61
- var pageTracker = _gat._getTracker("UA-9535591-3");
62
- pageTracker._setDomainName(".easyxdm.net");
63
- pageTracker._trackPageview();
64
- }
65
- catch (err) {
66
- }
67
- }
68
- </script>
69
- </body>
70
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/resize_intermediate.html DELETED
@@ -1,67 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js"></script>
6
- <script type="text/javascript">
7
- var iframe;
8
- var socket = new easyXDM.Socket({
9
- swf : "../easyxdm.swf",
10
- onReady : function() {
11
- iframe = document.createElement("iframe");
12
- iframe.frameBorder = 0;
13
- document.body.appendChild(iframe);
14
- iframe.src = easyXDM.query.url;
15
-
16
- var timer;
17
- iframe.onload = function() {
18
- var d = iframe.contentWindow.document;
19
- var originalHeight = d.body.clientHeight || d.body.offsetHeight || d.body.scrollHeight;
20
-
21
- // We want to monitor the document for resize events in case of the use of accordions and such,
22
- // but unfortunately only the window node emits the resize event, and we need the body's.
23
- // The only solution then is to use polling..
24
-
25
- // Lets start the polling if not all ready started
26
- if(!timer) {
27
- timer = setInterval(function() {
28
- try {
29
- var d = iframe.contentWindow.document;
30
- var newHeight = d.body.clientHeight || d.body.offsetHeight || d.body.scrollHeight;
31
- if(newHeight != originalHeight) {
32
- // The height has changed since last we checked
33
- originalHeight = newHeight;
34
- socket.postMessage(originalHeight);
35
- }
36
- } catch(e) {
37
- // We tried to read the property at some point when it wasn't available
38
- }
39
- }, 300);
40
- }
41
- // Send the first message
42
- socket.postMessage(originalHeight);
43
- };
44
- },
45
- onMessage : function(url, origin) {
46
- iframe.src = url;
47
- }
48
- });
49
-
50
- </script>
51
- <style type="text/css">
52
- html, body {
53
- overflow: hidden;
54
- margin: 0px;
55
- padding: 0px;
56
- width: 100%;
57
- height: 100%;
58
- }
59
- iframe {
60
- width: 100%;
61
- height: 100%;
62
- border: 0px;
63
- }
64
- </style>
65
- </head>
66
- <body></body>
67
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/resized_iframe_1.html DELETED
@@ -1,21 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <style type="text/css">
6
- html, body {
7
- overflow: hidden;
8
- margin: 0px;
9
- padding: 0px;
10
- background-color: green;
11
- }
12
- </style>
13
- </head>
14
- <body>
15
- <a href="resized_iframe_2.html">resized_iframe_2.html</a>
16
- <br/>
17
- Nam nulla nibh, tempus ut dictum eget, euismod vitae metus. Donec vitae nulla nec quam sagittis gravida vel quis eros. Nullam vel est justo. Donec euismod interdum magna, et rutrum libero tincidunt vel. Praesent imperdiet, magna et suscipit facilisis, nulla justo consequat nisl, et mollis elit nunc a est. Sed felis quam, condimentum eget gravida non, semper non quam. Duis vestibulum sem id erat tristique eleifend. Phasellus ante nunc, pulvinar nec facilisis at, hendrerit sed leo. Morbi lacinia nisl id nunc faucibus lacinia. Curabitur adipiscing leo a odio aliquet hendrerit. Nullam laoreet pulvinar suscipit.
18
- Cras ante tortor, rutrum non pharetra vel, tempor et velit. Mauris semper, libero sit amet interdum interdum, metus purus rutrum libero, eget suscipit lectus augue eu magna. Aliquam quis dui a nunc luctus faucibus. Sed viverra augue rutrum odio placerat laoreet. Nulla scelerisque augue nec enim condimentum sollicitudin. Proin accumsan, turpis in viverra lobortis, nulla mauris euismod turpis, sit amet auctor felis lacus sed leo. Nullam posuere bibendum urna, ut mattis eros varius ac. Mauris sed metus orci, ut lobortis eros. Sed imperdiet bibendum tincidunt. Donec adipiscing sapien vitae ligula faucibus quis auctor nisi pretium. Morbi at nulla quam, in aliquet quam. Suspendisse potenti. Fusce varius gravida egestas. Nulla lectus velit, posuere et auctor a, congue id massa. Quisque ut lectus eu metus malesuada sollicitudin ac a risus.
19
- Nullam massa ipsum, pulvinar ut facilisis a, commodo ut orci. Mauris ac ipsum diam, sit amet laoreet tortor. In pretium, nulla vel ornare euismod, nibh augue pharetra magna, at semper felis diam in ipsum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus blandit ornare dignissim. Fusce et nulla urna. Morbi nec ante erat. Nullam ut urna libero. Nulla non ipsum purus, et cursus lectus. Etiam vehicula, mauris in faucibus vehicula, dolor quam sodales neque, sed laoreet est augue at lacus. Nunc tincidunt lacinia elit eu dignissim. Mauris at enim mauris. Donec congue auctor dui, eget posuere ante accumsan in. Nulla non quam enim, eget tempor arcu. Suspendisse nec nibh diam, ut congue est. Fusce at urna eget velit posuere ornare nec eget mauris. Sed accumsan magna et enim mollis dignissim.
20
- </body>
21
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/resized_iframe_2.html DELETED
@@ -1,33 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <style type="text/css">
6
- html, body {
7
- overflow: hidden;
8
- margin: 0px;
9
- padding: 0px;
10
- background-color: red;
11
- }
12
- </style>
13
- </head>
14
- <body>
15
- <a href="resized_iframe_1.html">resized_iframe_1.html</a>
16
- <br/>
17
- (This page will resize its content after three seconds)
18
- <br/>
19
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eu felis libero, non ultricies ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed in lorem libero. Phasellus malesuada, mauris eget suscipit tristique, dolor dui blandit purus, ut mollis eros dolor et elit. Ut consequat ultrices metus, pretium mattis dui adipiscing vitae. Nunc cursus, sapien vehicula auctor faucibus, enim orci pretium risus, id congue ligula justo sed felis. Proin nec quam justo. Cras tempor odio eget orci lacinia sit amet malesuada leo feugiat. In accumsan tincidunt enim, vitae ultricies arcu egestas in. Nulla rhoncus eros vel ipsum venenatis porta. Suspendisse id erat nec mauris ultricies consectetur id feugiat odio. Vestibulum pretium tristique magna sed ultrices. Suspendisse tortor mauris, facilisis et lobortis quis, suscipit sed est. Sed vitae tortor at lacus pretium blandit. Donec vitae nibh quis orci mollis fringilla. Duis tempus augue nec ipsum euismod elementum.
20
- Donec pharetra sem nec lacus posuere et lacinia ligula sollicitudin. Morbi semper commodo posuere. In adipiscing nulla ut urna fermentum vestibulum. Sed consectetur massa non neque facilisis interdum. Quisque semper massa et urna euismod nec fermentum metus feugiat. Morbi tempor commodo enim non lacinia. Aliquam elementum tortor mattis odio congue a egestas lacus bibendum. Integer nec leo massa, a ullamcorper mi. Morbi vitae massa arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
21
- Nam nulla nibh, tempus ut dictum eget, euismod vitae metus. Donec vitae nulla nec quam sagittis gravida vel quis eros. Nullam vel est justo. Donec euismod interdum magna, et rutrum libero tincidunt vel. Praesent imperdiet, magna et suscipit facilisis, nulla justo consequat nisl, et mollis elit nunc a est. Sed felis quam, condimentum eget gravida non, semper non quam. Duis vestibulum sem id erat tristique eleifend. Phasellus ante nunc, pulvinar nec facilisis at, hendrerit sed leo. Morbi lacinia nisl id nunc faucibus lacinia. Curabitur adipiscing leo a odio aliquet hendrerit. Nullam laoreet pulvinar suscipit.
22
- Cras ante tortor, rutrum non pharetra vel, tempor et velit. Mauris semper, libero sit amet interdum interdum, metus purus rutrum libero, eget suscipit lectus augue eu magna. Aliquam quis dui a nunc luctus faucibus. Sed viverra augue rutrum odio placerat laoreet. Nulla scelerisque augue nec enim condimentum sollicitudin. Proin accumsan, turpis in viverra lobortis, nulla mauris euismod turpis, sit amet auctor felis lacus sed leo. Nullam posuere bibendum urna, ut mattis eros varius ac. Mauris sed metus orci, ut lobortis eros. Sed imperdiet bibendum tincidunt. Donec adipiscing sapien vitae ligula faucibus quis auctor nisi pretium. Morbi at nulla quam, in aliquet quam. Suspendisse potenti. Fusce varius gravida egestas. Nulla lectus velit, posuere et auctor a, congue id massa. Quisque ut lectus eu metus malesuada sollicitudin ac a risus.
23
- Nullam massa ipsum, pulvinar ut facilisis a, commodo ut orci. Mauris ac ipsum diam, sit amet laoreet tortor. In pretium, nulla vel ornare euismod, nibh augue pharetra magna, at semper felis diam in ipsum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus blandit ornare dignissim. Fusce et nulla urna. Morbi nec ante erat. Nullam ut urna libero. Nulla non ipsum purus, et cursus lectus. Etiam vehicula, mauris in faucibus vehicula, dolor quam sodales neque, sed laoreet est augue at lacus. Nunc tincidunt lacinia elit eu dignissim. Mauris at enim mauris. Donec congue auctor dui, eget posuere ante accumsan in. Nulla non quam enim, eget tempor arcu. Suspendisse nec nibh diam, ut congue est. Fusce at urna eget velit posuere ornare nec eget mauris. Sed accumsan magna et enim mollis dignissim.
24
- <script type="text/javascript">
25
- // here we fake an action that would the casue the body's size to mutate.
26
- setTimeout(function() {
27
- var html = document.body.innerHTML;
28
- document.body.innerHTML = html.substring(0, html.length / 2);
29
- }, 3000);
30
-
31
- </script>
32
- </body>
33
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/transport.html DELETED
@@ -1,82 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
-
9
- var REMOTE = (function(){
10
- var remote = location.href;
11
- switch (location.host) {
12
- case "provider.easyxdm.net":
13
- location.href = remote.replace("provider", "consumer");
14
- break;
15
- case "easyxdm.net":
16
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
17
- break;
18
- case "consumer.easyxdm.net":
19
- remote = remote.replace("consumer", "provider");
20
- break;
21
- case "xdm1":
22
- remote = remote.replace("xdm1", "xdm2");
23
- break;
24
- }
25
- return remote.substring(0, remote.lastIndexOf("/"));
26
- }());
27
- var transport = new easyXDM.Socket(/** The configuration */{
28
- /**
29
- * Register the url to name.html, this must be an absolute path
30
- * or a path relative to the root.
31
- * @field
32
- */
33
- local: "../name.html",
34
- swf: REMOTE + "/../easyxdm.swf",
35
- /**
36
- * Register the url to the remote interface
37
- * @field
38
- */
39
- remote: REMOTE + "/remotetransport.html",
40
- remoteHelper: REMOTE + "/../name.html",
41
- onReady: function(){
42
- /**
43
- * If we want to do something once the transport is ready then we can place it here
44
- */
45
- }
46
- });
47
- // messages will be buffered until the transport is ready
48
- transport.postMessage("This is a message sent from " + location);
49
- </script>
50
- </head>
51
- <body>
52
- <div style="border:1px solid black;padding:3px;margin:10px;">
53
- <a href="index.html">Index of examples</a>
54
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
55
- |
56
- | <a href="http://easyxdm.net/">easyXDM.net</a>
57
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
58
- <br/>
59
- The examples are executing slower than the production build due to the extensive tracing.
60
- <br/>
61
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
62
- </div>
63
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
64
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
65
- </div>
66
- <script type="text/javascript">
67
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
68
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
69
- </script>
70
- <script type="text/javascript">
71
- if (location.host.indexOf("easyxdm.net") !== -1) {
72
- try {
73
- var pageTracker = _gat._getTracker("UA-9535591-3");
74
- pageTracker._setDomainName(".easyxdm.net");
75
- pageTracker._trackPageview();
76
- }
77
- catch (err) {
78
- }
79
- }
80
- </script>
81
- </body>
82
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/upload.html DELETED
@@ -1,100 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
-
15
- // this is just some bootstrapping code in order to provide
16
- // the correct host name depending on where it is being run.
17
- var REMOTE = (function(){
18
- var remote = location.href;
19
- switch (location.host) {
20
- case "provider.easyxdm.net":
21
- location.href = remote.replace("provider", "consumer");
22
- break;
23
- case "easyxdm.net":
24
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
25
- break;
26
- case "consumer.easyxdm.net":
27
- remote = remote.replace("consumer", "provider");
28
- break;
29
- case "xdm1":
30
- remote = remote.replace("xdm1", "xdm2");
31
- break;
32
- }
33
- return remote.substring(0, remote.lastIndexOf("/"));
34
- }());
35
-
36
-
37
-
38
- var btn;
39
- var remote = new easyXDM.Rpc({
40
- remote: REMOTE + "/upload_rpc.html",
41
- swf: REMOTE + "/../easyxdm.swf",
42
- onReady: function(){
43
- //display the upload form
44
- var frm = document.getElementById("frmUpload");
45
- frm.action = REMOTE + "/upload_handler.aspx";
46
- frm.style.display = "block";
47
- btn = document.getElementById("btnSubmit");
48
-
49
- frm.onsubmit = function(){
50
- btn.disabled = "disabled";
51
- };
52
- }
53
- }, {
54
- local: {
55
- returnUploadResponse: function(response){
56
- // here you should call back into your regular workflow
57
- btn.disabled = null;
58
- alert(response.msg);
59
- }
60
- }
61
- });
62
- </script>
63
- </head>
64
- <body>
65
- <div style="border:1px solid black;padding:3px;margin:10px;">
66
- <a href="index.html">Index of examples</a>
67
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
68
- |
69
- | <a href="http://easyxdm.net/">easyXDM.net</a>
70
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
71
- <br/>
72
- The examples are executing slower than the production build due to the extensive tracing.
73
- <br/>
74
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
75
- </div>
76
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
77
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
78
- </div>
79
- <form id="frmUpload" style="display:none" method="POST" target="upload_target" enctype="multipart/form-data">
80
- <input type="file" name="upload_file"/><input type="submit" id="btnSubmit" value="Upload file"/>
81
- </form><!--
82
- tracking code
83
- -->
84
- <script type="text/javascript">
85
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
86
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
87
- </script>
88
- <script type="text/javascript">
89
- if (location.host.indexOf("easyxdm.net") !== -1) {
90
- try {
91
- var pageTracker = _gat._getTracker("UA-9535591-3");
92
- pageTracker._setDomainName(".easyxdm.net");
93
- pageTracker._trackPageview();
94
- }
95
- catch (err) {
96
- }
97
- }
98
- </script>
99
- </body>
100
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/upload_handler.aspx DELETED
@@ -1,15 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- </head>
6
- <body>
7
- <script type="text/javascript">
8
- // this should be outputted by the server side code
9
- parent.rpc.returnUploadResponse({
10
- status: "success",
11
- msg: "The upload succeeded!"
12
- });
13
- </script>
14
- </body>
15
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/upload_rpc.html DELETED
@@ -1,25 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- easyXDM.DomHelper.requiresJSON("../json2.js");
9
- </script>
10
- <script type="text/javascript">
11
- // the `rpc` object will be referenced by the upload handler
12
- var rpc = new easyXDM.Rpc({
13
- swf: "../easyxdm.swf"
14
- }, {
15
- remote: {
16
- returnUploadResponse: {}
17
- }
18
- });
19
- </script>
20
- </head>
21
- <body>
22
- <iframe name="upload_target" src="about:blank">
23
- </iframe>
24
- </body>
25
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/widget.html DELETED
@@ -1,49 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM.Widget</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- easyXDM.DomHelper.requiresJSON("../json2.js");
9
- </script>
10
- <script type="text/javascript" src="../easyXDM.Widgets.debug.js">
11
- </script>
12
- <script type="text/javascript">
13
- easyXDM.whenReady(function(){
14
- var widget = new easyXDM.Widget({
15
- subscriptions: ["testtopic"],
16
- swf: "../easyxdm.swf",
17
- initialize: function(widget, widgetManager){
18
- // Set up the widget
19
- var _container, _btnPublish;
20
-
21
- // Render the UI
22
- _container = document.body.appendChild(document.createElement("div"));
23
- _btnPublish = _container.appendChild(document.createElement("button"));
24
- _btnPublish.innerHTML = "Publish";
25
- easyXDM.DomHelper.on(_btnPublish, "click", function(){
26
- widget.publish("testtopic", {
27
- latitude: 1,
28
- longitude: 2
29
- });
30
- });
31
-
32
- // Register the handler for incoming messages
33
- widget.registerMessageHandler(function(url, topic, data){
34
- _container.appendChild(document.createElement("div")).innerHTML = "got data on topic " + topic + " from " + url;
35
- });
36
- },
37
- initialized: function(widget, widgetManager){
38
- widget.publish("testtopic", {
39
- latitude: 1,
40
- longitude: 2
41
- });
42
- }
43
- });
44
- });
45
- </script>
46
- </head>
47
- <body>
48
- </body>
49
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/widgets.html DELETED
@@ -1,75 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- easyXDM.DomHelper.requiresJSON("../json2.js");
9
- </script>
10
- <script type="text/javascript" src="../easyXDM.Widgets.debug.js">
11
- </script>
12
- <script type="text/javascript">
13
- var _widgetManager;
14
- easyXDM.whenReady(function(){
15
- _widgetManager = new easyXDM.WidgetManager({
16
- swf: "../easyxdm.swf",
17
- container: document.getElementById("widgets")
18
- });
19
- document.getElementById("widget1url").value = location.href.replace("consumer", "provider").replace("widgets.html", "widget.html");
20
- document.getElementById("widget2url").value = location.href.replace("consumer.", "").replace("widgets.html", "widget.html");
21
- });
22
- </script>
23
- <style type="text/css">
24
-
25
- #widgets {
26
- height: 400px;
27
- }
28
-
29
- #widgets iframe {
30
- width: 200px;
31
- height: 300px;
32
- float: left;
33
- }
34
- </style>
35
- </head>
36
- <body>
37
- <div style="border:1px solid black;padding:3px;margin:10px;">
38
- <a href="index.html">Index of examples</a>
39
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
40
- |
41
- | <a href="http://easyxdm.net/">easyXDM.net</a>
42
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
43
- <br/>
44
- The examples are executing slower than the production build due to the extensive tracing.
45
- <br/>
46
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
47
- </div>
48
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
49
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
50
- </div>
51
- <div>
52
- <input type="text" id="widget1url" style="width:300px" value=""/><input type="button" onclick="_widgetManager.addWidget(document.getElementById('widget1url').value,{});" value="Add Widget"/><input type="button" onclick="_widgetManager.removeWidget(document.getElementById('widget1url').value);" value="Remove Widget"/>
53
- </div>
54
- <div>
55
- <input type="text" id="widget2url" style="width:300px" value=""/><input type="button" onclick="_widgetManager.addWidget(document.getElementById('widget2url').value,{});" value="Add Widget"/><input type="button" onclick="_widgetManager.removeWidget(document.getElementById('widget2url').value);" value="Remove Widget"/>
56
- </div><input type="button" onclick="_widgetManager.publish('testtopic','abc');" value="publish"/>
57
- <div id="widgets">
58
- </div>
59
- <script type="text/javascript">
60
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
61
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
62
- </script>
63
- <script type="text/javascript">
64
- if (location.host.indexOf("easyxdm.net") !== -1) {
65
- try {
66
- var pageTracker = _gat._getTracker("UA-9535591-3");
67
- pageTracker._setDomainName(".easyxdm.net");
68
- pageTracker._trackPageview();
69
- }
70
- catch (err) {
71
- }
72
- }
73
- </script>
74
- </body>
75
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/example/xhr.html DELETED
@@ -1,112 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- /**
9
- * Request the use of the JSON object
10
- */
11
- easyXDM.DomHelper.requiresJSON("../json2.js");
12
- </script>
13
- <script type="text/javascript">
14
- // this is only bootstrapping code
15
- var REMOTE = (function(){
16
- var remote = location.href;
17
- switch (location.host) {
18
- case "provider.easyxdm.net":
19
- location.href = remote.replace("provider", "consumer");
20
- break;
21
- case "easyxdm.net":
22
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
23
- break;
24
- case "consumer.easyxdm.net":
25
- remote = remote.replace("consumer", "provider");
26
- break;
27
- case "xdm1":
28
- remote = remote.replace("xdm1", "xdm2");
29
- break;
30
- }
31
- return remote.substring(0, remote.lastIndexOf("/"));
32
- }());
33
-
34
- // this is really what you are after
35
- var xhr = new easyXDM.Rpc({
36
- local: "../name.html",
37
- swf: REMOTE + "/../easyxdm.swf",
38
- remote: REMOTE + "/../cors/",
39
- remoteHelper: REMOTE + "/../name.html"
40
- }, {
41
- remote: {
42
- request: {}
43
- }
44
- });
45
-
46
- function getGlossary(){
47
- xhr.request({
48
- url: "../example/glossary.aspx",
49
- method: "POST",
50
- headers: {
51
- "x-auth-token": "abcde"
52
- },
53
- data: {
54
- param1: "a",
55
- param2: "b"
56
- }
57
- }, function(rpcdata){
58
- var json = easyXDM.getJSONObject().parse(rpcdata.data);
59
-
60
- document.getElementById("response").innerHTML = json.glossary.title;
61
- document.getElementById("header").innerHTML = rpcdata.headers["x-foo"];
62
- });
63
-
64
- }
65
- </script>
66
- </head>
67
- <body>
68
- <div style="border:1px solid black;padding:3px;margin:10px;">
69
- <a href="index.html">Index of examples</a>
70
- | <a href="http://github.com/oyvindkinsey/easyXDM/#readme">Readme at github</a>
71
- |
72
- | <a href="http://easyxdm.net/">easyXDM.net</a>
73
- | <a href="http://groups.google.com/group/easyxdm">easyXDM at Google Groups</a>
74
- <br/>
75
- The examples are executing slower than the production build due to the extensive tracing.
76
- <br/>
77
- If you are alerted about a popup, then this is only the trace log feature. You can ignore this.
78
- </div>
79
- <script type="text/javascript">
80
- document.write("Domain: " + location.host);
81
- </script>
82
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
83
- <div id="log" style="height:100px;border:1px dotted black;overflow:auto">
84
- </div>
85
- <div id="embedded">
86
- </div>
87
- <div>
88
- This example shows how to use easyXDM to call regular ajax/cors services (no JSONP) from remote domains.
89
- <br/>
90
- <input type="button" onclick="getGlossary()" value="Call getGlossary using the exposed method"/>
91
- <br/>
92
- Data from response:<span id="response"></span>
93
- <br/>
94
- Data from header:<span id="header"></span>
95
- </div>
96
- <script type="text/javascript">
97
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
98
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
99
- </script>
100
- <script type="text/javascript">
101
- if (location.host.indexOf("easyxdm.net") !== -1) {
102
- try {
103
- var pageTracker = _gat._getTracker("UA-9535591-3");
104
- pageTracker._setDomainName(".easyxdm.net");
105
- pageTracker._trackPageview();
106
- }
107
- catch (err) {
108
- }
109
- }
110
- </script>
111
- </body>
112
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/flash/net.easyxdm.flash/Main.as DELETED
@@ -1,196 +0,0 @@
1
- //
2
- // easyXDM
3
- // http://easyxdm.net/
4
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
5
- //
6
- // Permission is hereby granted, free of charge, to any person obtaining a copy
7
- // of this software and associated documentation files (the "Software"), to deal
8
- // in the Software without restriction, including without limitation the rights
9
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- // copies of the Software, and to permit persons to whom the Software is
11
- // furnished to do so, subject to the following conditions:
12
- //
13
- // The above copyright notice and this permission notice shall be included in
14
- // all copies or substantial portions of the Software.
15
- //
16
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- // THE SOFTWARE.
23
- //
24
-
25
-
26
-
27
- /* Security model:
28
- * SWF's can be loaded from any of the two domains, and messages are only received from these two.
29
- * Alternatively a single SWF can be loaded from a common domain (CDN).
30
- * security.allowXDomain is used to let the page interact with the SWF.
31
- * */
32
-
33
- import flash.external.ExternalInterface;
34
- import System.security;
35
-
36
- /**
37
- * This class facilitates flash based communication between domains.
38
- * @author Øyvind Sean Kinsey
39
- */
40
- class Main
41
- {
42
- private static var INITIALIZED:Boolean = false;
43
-
44
- // only allow javascript accessors
45
- private static function Validate(input:String):Boolean {
46
- var i = input.length;
47
- while (i--) {
48
- var charCode = input.charCodeAt(i);
49
- if ( (charCode >= 64 && charCode <= 90 /*Uppercase*/) || (charCode >= 97 && charCode <= 122 /*Lowercase*/) ) continue;
50
- if (charCode >= 48 && charCode <= 57 /*Numbers*/) continue;
51
- if (charCode == 95/*_*/ || charCode == 36 /*$*/ || charCode == 45 /*-*/ || charCode == 46 /*.*/ || charCode == 58 /*:*/) continue;
52
-
53
- return false;
54
- }
55
- return true;
56
- }
57
-
58
-
59
- // docs at http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/js/html/wwhelp.htm
60
- public static function main(swfRoot:MovieClip):Void
61
- {
62
- // this is so that main can only be run once - this ensures that the domain passed really is the one
63
- // being used to communicate with the SWF.
64
- if (Main.INITIALIZED) return; else Main.INITIALIZED = true;
65
-
66
- // validate the passed arguments
67
- if (!Validate(_root.ns) || !Validate(_root.proto) || !Validate(_root.domain) || !Validate(_root.port) || !Validate(_root.callback)) return;
68
-
69
- // LocalConnection has a max length
70
- var maxMessageLength = 40000;
71
-
72
- // map of all the senders
73
- var sendMap = { }, connectionMap = { };
74
-
75
- // set up the prefix as a string based accessor to remove the risk of XSS
76
- var prefix:String = _root.ns ? _root.ns + "." : "";
77
-
78
- // this will be our origin
79
- var origin = _root.proto + "//" + _root.domain + _root.port;
80
-
81
- // set up the logger, if any
82
- var log = _root.log == "true" ? function(msg) {
83
- ExternalInterface.call(prefix + "easyXDM.Debug.trace", " swf: " + msg);
84
- } : function() {
85
- };
86
-
87
-
88
- log("enabling communication with " + _root.domain);
89
- // allow javascript in the page to interact with the SWF
90
- security[_root.proto == "http:" ? "allowInsecureDomain" : "allowDomain"](_root.domain);
91
- // add the postMessage method
92
- ExternalInterface.addCallback("postMessage", { }, function(channel:String, message:String) {
93
- sendMap[channel](message);
94
- });
95
-
96
- // add the createChannel method
97
- ExternalInterface.addCallback("createChannel", { }, function(channel:String, secret:String, remoteOrigin:String, isHost:Boolean) {
98
- if (!Main.Validate(channel)) return;
99
- log("creating channel " + channel);
100
-
101
- // get the remote domain
102
- var remoteDomain:String = remoteOrigin.substr(remoteOrigin.indexOf("://") + 3);
103
- if (remoteDomain.indexOf(":") != -1) remoteDomain = remoteDomain.substr(0, remoteDomain.indexOf(":"));
104
- // the sending channel has _ prepended so that all allowed domains can use it
105
- var sendingChannelName:String = "_" + channel + "_" + secret + "_" + (isHost ? "consumer" : "provider");
106
- var receivingChannelName:String = "_" + channel + "_" + secret + "_" + (isHost ? "provider" : "consumer");
107
- var incommingFragments = [];
108
-
109
- // set up the listening connection
110
- var listeningConnection:LocalConnection = connectionMap[channel] = new LocalConnection();
111
- // set up the sending connection
112
- var sendingConnection:LocalConnection = new LocalConnection();
113
-
114
- // domain of the current SWF (for cdn support)
115
- var localSwfDomain:String = listeningConnection.domain();
116
-
117
- // allow messages from only the two possible domains
118
- listeningConnection.allowDomain =
119
- listeningConnection.allowInsecureDomain = function(domain) {
120
- var allowed:Boolean = (domain == remoteDomain || domain == _root.domain || domain == localSwfDomain);
121
- log("allowDomain: " + allowed.toString());
122
- return allowed;
123
- };
124
-
125
- // set up the onMessage handler - this combines fragmented messages
126
- listeningConnection.onMessage = function(message, fromOrigin, remaining) {
127
- if (fromOrigin !== remoteOrigin) {
128
- log("received message from " + fromOrigin + ", expected from " + remoteOrigin);
129
- return;
130
- }
131
- incommingFragments.push(message);
132
- if (remaining <= 0) {
133
- log("received final fragment");
134
- // escape \\ and pass on
135
- ExternalInterface.call(prefix + "easyXDM.Fn.get(\"flash_" + channel + "_onMessage\")", incommingFragments.join("").split("\\").join("\\\\"), remoteOrigin);
136
- incommingFragments = [];
137
- }else {
138
- log("received fragment, length is " + message.length + " remaining is " + remaining);
139
- }
140
- };
141
-
142
- // the host must delay calling channel_init until the other end is ready
143
- listeningConnection.onReady = function() {
144
- log("received ready");
145
- if (isHost) {
146
- log("calling ready");
147
- sendingConnection.send(sendingChannelName, "onReady");
148
- ExternalInterface.call(prefix + "easyXDM.Fn.get(\"flash_" + channel + "_init\")");
149
- }
150
- };
151
-
152
- // connect
153
- if (listeningConnection.connect(receivingChannelName)) {
154
- log("listening on " + receivingChannelName);
155
- } else {
156
- log("could not listen on " + receivingChannelName);
157
- }
158
-
159
- sendingConnection.onStatus = function(infoObject:Object) {
160
- log("level: " + infoObject.level);
161
- };
162
-
163
- sendMap[channel] = function(message:String) {
164
- log("sending to " + sendingChannelName + ", length is " + message.length);
165
-
166
- var fragments = [], fragment, length = message.length, pos = 0;
167
- while (pos <= length) {
168
- fragment = message.substr(pos, maxMessageLength);;
169
- pos += maxMessageLength;
170
- log("fragmentlength: " + fragment.length + ", remaining: " + (length - pos))
171
- if (!sendingConnection.send(sendingChannelName, "onMessage", fragment, origin, length - pos)) {
172
- log("sending failed");
173
- }
174
- }
175
- };
176
-
177
- // start the channel
178
- if (!isHost) {
179
- log("calling ready");
180
- sendingConnection.send(sendingChannelName, "onReady");
181
- ExternalInterface.call(prefix + "easyXDM.Fn.get(\"flash_" + channel + "_init\")");
182
- }
183
- });
184
-
185
- // add the destroyChannel method
186
- ExternalInterface.addCallback("destroyChannel", { }, function(channel:String) {
187
- delete sendMap[channel];
188
- connectionMap[channel].close();
189
- delete connectionMap[channel];
190
- });
191
-
192
- // kick things off
193
- log("calling init");
194
- ExternalInterface.call(prefix + "easyXDM.Fn.get(\"" + _root.callback + "\")");
195
- }
196
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/flash/net.easyxdm.flash/net.easyxdm.flash.as2proj DELETED
@@ -1,55 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <project>
3
- <!-- Output SWF options -->
4
- <output>
5
- <movie disabled="False" />
6
- <movie input="" />
7
- <movie path="..\..\..\src\easyxdm.swf" />
8
- <movie fps="30" />
9
- <movie width="800" />
10
- <movie height="600" />
11
- <movie version="8" />
12
- <movie background="#FFFFFF" />
13
- </output>
14
- <!-- Other classes to be compiled into your SWF -->
15
- <classpaths>
16
- <class path="src" />
17
- </classpaths>
18
- <!-- Build options -->
19
- <build>
20
- <option verbose="False" />
21
- <option strict="False" />
22
- <option infer="False" />
23
- <option useMain="True" />
24
- <option useMX="False" />
25
- <option warnUnusedImports="False" />
26
- <option traceMode="FlashMX" />
27
- <option traceFunction="" />
28
- <option libraryPrefix="" />
29
- <option excludeFile="" />
30
- <option groupClasses="False" />
31
- <option frame="1" />
32
- <option keep="True" />
33
- </build>
34
- <!-- Class files to compile (other referenced classes will automatically be included) -->
35
- <compileTargets>
36
- <compile path="Main.as" />
37
- </compileTargets>
38
- <!-- Assets to embed into the output SWF -->
39
- <library>
40
- <!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
41
- </library>
42
- <!-- Paths to exclude from the Project Explorer tree -->
43
- <hiddenPaths>
44
- <!-- example: <hidden path="..." /> -->
45
- </hiddenPaths>
46
- <!-- Executed before build -->
47
- <preBuildCommand />
48
- <!-- Executed after build -->
49
- <postBuildCommand alwaysRun="False" />
50
- <!-- Other project options -->
51
- <options>
52
- <option showHiddenPaths="False" />
53
- <option testMovie="Default" />
54
- </options>
55
- </project>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/flash/test/doma.html DELETED
@@ -1,70 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=7">
6
- <title>Flash</title>
7
- <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript">
8
- </script>
9
- <style>
10
- body {
11
- background-color: red;
12
- }
13
- </style>
14
- </head>
15
- <body>
16
- DOMA<input type="text" id="txtIn" value="bb"/>
17
- <button onclick="send()">
18
- send
19
- </button>
20
- <br/>
21
- <div id="output">
22
- </div>
23
- <div id="altContent">
24
- </div>
25
- <script type="text/javascript">
26
- var channelId = Math.floor(Math.random() * 100) * 100;
27
-
28
- function init(){
29
- console.log("init " + channelId);
30
- swf = document.getElementById(attributes.id);
31
-
32
- swf.createChannel("easyXDM_channel" + channelId, "http://xdm2.local", true, "foo[\"onMessage\"]", "key");
33
-
34
- var ifr = document.createElement("iframe");
35
- document.body.appendChild(ifr);
36
- ifr.src = "http://xdm2.local/easyXDM/src/flash/test/domb.html#" + channelId;
37
-
38
- }
39
-
40
- var foo = {
41
- onMessage: function(msg, origin){
42
- document.getElementById("output").appendChild(document.createTextNode(msg + "-foo:" + origin));
43
-
44
- }
45
- };
46
- function log(msg){
47
- console.log(location.host + ": " + msg);
48
- }
49
-
50
- function send(){
51
- swf.postMessage("easyXDM_channel" + channelId, document.getElementById("txtIn").value, "http://xdm2.local");
52
- }
53
-
54
- var flashvars = {
55
- init:"init"
56
- };
57
- var params = {
58
- menu: "false",
59
- scale: "noScale",
60
- allowFullscreen: "true",
61
- allowScriptAccess: "always",
62
- bgcolor: "#FFFFFF"
63
- };
64
- var attributes = {
65
- id: "neteasyxdmflash"
66
- };
67
- swfobject.embedSWF("../../../tools/easyxdm.swf", "altContent", "10", "10", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
68
- </script>
69
- </body>
70
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/flash/test/domb.html DELETED
@@ -1,67 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=7">
6
- <title>Flash</title>
7
- <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript">
8
- </script>
9
- <style>
10
- body {
11
- background-color: blue;
12
- }
13
- </style>
14
- </head>
15
- <body>
16
- DOMB<input type="text" id="txtIn" value="aa"/>
17
- <button onclick="send()">
18
- send
19
- </button>
20
- <div id="output">
21
- </div>
22
- <div id="altContent">
23
- </div>
24
- <script type="text/javascript">
25
- var swf;
26
-
27
- var channelId = location.hash.substring(1);
28
- log("channelId from hash=" + channelId);
29
- function init(){
30
- console.log("init " + channelId);
31
- swf = document.getElementById(attributes.id);
32
- swf.createChannel("easyXDM_channel" + channelId, "http://xdm1.local", false, "foo[\"onMessage\"]", "key");
33
- }
34
-
35
- var foo = {
36
- onMessage: function(msg, origin){
37
- document.getElementById("output").appendChild(document.createTextNode(msg + "-foo:" + origin));
38
-
39
- }
40
- };
41
-
42
- function log(msg){
43
- console.log(location.host + ": " + msg);
44
- }
45
-
46
- function send(){
47
- swf.postMessage("easyXDM_channel" + channelId, document.getElementById("txtIn").value, "http://xdm1.local");
48
- }
49
-
50
-
51
- var flashvars = {
52
- init: "init"
53
- };
54
- var params = {
55
- menu: "false",
56
- scale: "noScale",
57
- allowFullscreen: "true",
58
- allowScriptAccess: "always",
59
- bgcolor: "#FFFFFF"
60
- };
61
- var attributes = {
62
- id: "neteasyxdmflash"
63
- };
64
- swfobject.embedSWF("../../../tools/easyxdm.swf", "altContent", "10", "10", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
65
- </script>
66
- </body>
67
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/header.html DELETED
@@ -1,7 +0,0 @@
1
- <!--
2
- easyXDM
3
- http://easydm.net/
4
- Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
5
-
6
- MIT Licensed - http://easyxdm.net/license/mit.txt
7
- -->
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/header.js DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * easyXDM
3
- * http://easyxdm.net/
4
- * Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- * THE SOFTWARE.
23
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/resources.txt DELETED
@@ -1,3 +0,0 @@
1
- http://bitterjavascript.com/shared/security/window_naming/window_naming_issues.htm
2
-
3
- http://shouldersofgiants.co.uk/Blog/post/2009/08/17/Another-Cross-Domain-iFrame-Communication-Technique.aspx
 
 
 
js/bluepay_echeck/easyXDM/src/stack/FlashTransport.js DELETED
@@ -1,227 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.FlashTransport
29
- * FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth.
30
- * @namespace easyXDM.stack
31
- * @constructor
32
- * @param {Object} config The transports configuration.
33
- * @cfg {String} remote The remote domain to communicate with.
34
- * @cfg {String} secret the pre-shared secret used to secure the communication.
35
- * @cfg {String} swf The path to the swf file
36
- * @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden.
37
- * @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed
38
- */
39
- easyXDM.stack.FlashTransport = function(config){
40
- // #ifdef debug
41
- var trace = debug.getTracer("easyXDM.stack.FlashTransport");
42
- trace("constructor");
43
- if (!config.swf) {
44
- throw new Error("Path to easyxdm.swf is missing");
45
- }
46
- // #endif
47
- var pub, // the public interface
48
- frame, send, targetOrigin, swf, swfContainer;
49
-
50
- function onMessage(message, origin){
51
- setTimeout(function(){
52
- // #ifdef debug
53
- trace("received message");
54
- // #endif
55
- pub.up.incoming(message, targetOrigin);
56
- }, 0);
57
- }
58
-
59
- /**
60
- * This method adds the SWF to the DOM and prepares the initialization of the channel
61
- */
62
- function addSwf(domain){
63
- // #ifdef debug
64
- trace("creating factory with SWF from " + domain);
65
- // #endif
66
- // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.
67
- var url = config.swf + "?host=" + config.isHost;
68
- var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000);
69
-
70
- // prepare the init function that will fire once the swf is ready
71
- easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){
72
- easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild;
73
- var queue = easyXDM.stack.FlashTransport[domain].queue;
74
- for (var i = 0; i < queue.length; i++) {
75
- queue[i]();
76
- }
77
- queue.length = 0;
78
- });
79
-
80
- if (config.swfContainer) {
81
- swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer;
82
- }
83
- else {
84
- // create the container that will hold the swf
85
- swfContainer = document.createElement('div');
86
-
87
- // http://bugs.adobe.com/jira/browse/FP-4796
88
- // http://tech.groups.yahoo.com/group/flexcoders/message/162365
89
- // https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc
90
- apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? {
91
- height: "20px",
92
- width: "20px",
93
- position: "fixed",
94
- right: 0,
95
- top: 0
96
- } : {
97
- height: "1px",
98
- width: "1px",
99
- position: "absolute",
100
- overflow: "hidden",
101
- right: 0,
102
- top: 0
103
- });
104
- document.body.appendChild(swfContainer);
105
- }
106
-
107
- // create the object/embed
108
- var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace;
109
- // #ifdef debug
110
- flashVars += "&log=true";
111
- // #endif
112
- swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" +
113
- "<param name='allowScriptAccess' value='always'></param>" +
114
- "<param name='wmode' value='transparent'>" +
115
- "<param name='movie' value='" +
116
- url +
117
- "'></param>" +
118
- "<param name='flashvars' value='" +
119
- flashVars +
120
- "'></param>" +
121
- "<embed type='application/x-shockwave-flash' FlashVars='" +
122
- flashVars +
123
- "' allowScriptAccess='always' wmode='transparent' src='" +
124
- url +
125
- "' height='1' width='1'></embed>" +
126
- "</object>";
127
- }
128
-
129
- return (pub = {
130
- outgoing: function(message, domain, fn){
131
- swf.postMessage(config.channel, message.toString());
132
- if (fn) {
133
- fn();
134
- }
135
- },
136
- destroy: function(){
137
- // #ifdef debug
138
- trace("destroy");
139
- // #endif
140
- try {
141
- swf.destroyChannel(config.channel);
142
- }
143
- catch (e) {
144
- }
145
- swf = null;
146
- if (frame) {
147
- frame.parentNode.removeChild(frame);
148
- frame = null;
149
- }
150
- },
151
- onDOMReady: function(){
152
- // #ifdef debug
153
- trace("init");
154
- // #endif
155
-
156
- targetOrigin = config.remote;
157
-
158
- // Prepare the code that will be run after the swf has been intialized
159
- easyXDM.Fn.set("flash_" + config.channel + "_init", function(){
160
- setTimeout(function(){
161
- // #ifdef debug
162
- trace("firing onReady");
163
- // #endif
164
- pub.up.callback(true);
165
- });
166
- });
167
-
168
- // set up the omMessage handler
169
- easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage);
170
-
171
- config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths
172
- var swfdomain = getDomainName(config.swf);
173
- var fn = function(){
174
- // set init to true in case the fn was called was invoked from a separate instance
175
- easyXDM.stack.FlashTransport[swfdomain].init = true;
176
- swf = easyXDM.stack.FlashTransport[swfdomain].swf;
177
- // create the channel
178
- swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost);
179
-
180
- if (config.isHost) {
181
- // if Flash is going to be throttled and we want to avoid this
182
- if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) {
183
- apply(config.props, {
184
- position: "fixed",
185
- right: 0,
186
- top: 0,
187
- height: "20px",
188
- width: "20px"
189
- });
190
- }
191
- // set up the iframe
192
- apply(config.props, {
193
- src: appendQueryParameters(config.remote, {
194
- xdm_e: getLocation(location.href),
195
- xdm_c: config.channel,
196
- xdm_p: 6, // 6 = FlashTransport
197
- xdm_s: config.secret
198
- }),
199
- name: IFRAME_PREFIX + config.channel + "_provider"
200
- });
201
- frame = createFrame(config);
202
- }
203
- };
204
-
205
- if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) {
206
- // if the swf is in place and we are the consumer
207
- fn();
208
- }
209
- else {
210
- // if the swf does not yet exist
211
- if (!easyXDM.stack.FlashTransport[swfdomain]) {
212
- // add the queue to hold the init fn's
213
- easyXDM.stack.FlashTransport[swfdomain] = {
214
- queue: [fn]
215
- };
216
- addSwf(swfdomain);
217
- }
218
- else {
219
- easyXDM.stack.FlashTransport[swfdomain].queue.push(fn);
220
- }
221
- }
222
- },
223
- init: function(){
224
- whenReady(pub.onDOMReady, pub);
225
- }
226
- });
227
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/FrameElementTransport.js DELETED
@@ -1,103 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.FrameElementTransport
29
- * FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/>
30
- * Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running.
31
- * @namespace easyXDM.stack
32
- * @constructor
33
- * @param {Object} config The transports configuration.
34
- * @cfg {String} remote The remote document to communicate with.
35
- */
36
- easyXDM.stack.FrameElementTransport = function(config){
37
- // #ifdef debug
38
- var trace = debug.getTracer("easyXDM.stack.FrameElementTransport");
39
- trace("constructor");
40
- // #endif
41
- var pub, frame, send, targetOrigin;
42
-
43
- return (pub = {
44
- outgoing: function(message, domain, fn){
45
- send.call(this, message);
46
- if (fn) {
47
- fn();
48
- }
49
- },
50
- destroy: function(){
51
- // #ifdef debug
52
- trace("destroy");
53
- // #endif
54
- if (frame) {
55
- frame.parentNode.removeChild(frame);
56
- frame = null;
57
- }
58
- },
59
- onDOMReady: function(){
60
- // #ifdef debug
61
- trace("init");
62
- // #endif
63
- targetOrigin = getLocation(config.remote);
64
-
65
- if (config.isHost) {
66
- // set up the iframe
67
- apply(config.props, {
68
- src: appendQueryParameters(config.remote, {
69
- xdm_e: getLocation(location.href),
70
- xdm_c: config.channel,
71
- xdm_p: 5 // 5 = FrameElementTransport
72
- }),
73
- name: IFRAME_PREFIX + config.channel + "_provider"
74
- });
75
- frame = createFrame(config);
76
- frame.fn = function(sendFn){
77
- delete frame.fn;
78
- send = sendFn;
79
- setTimeout(function(){
80
- pub.up.callback(true);
81
- }, 0);
82
- // remove the function so that it cannot be used to overwrite the send function later on
83
- return function(msg){
84
- pub.up.incoming(msg, targetOrigin);
85
- };
86
- };
87
- }
88
- else {
89
- // This is to mitigate origin-spoofing
90
- if (document.referrer && getLocation(document.referrer) != query.xdm_e) {
91
- window.top.location = query.xdm_e;
92
- }
93
- send = window.frameElement.fn(function(msg){
94
- pub.up.incoming(msg, targetOrigin);
95
- });
96
- pub.up.callback(true);
97
- }
98
- },
99
- init: function(){
100
- whenReady(pub.onDOMReady, pub);
101
- }
102
- });
103
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/HashTransport.js DELETED
@@ -1,179 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.HashTransport
29
- * HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/>
30
- * <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/>
31
- * @namespace easyXDM.stack
32
- * @constructor
33
- * @param {Object} config The transports configuration.
34
- * @cfg {String/Window} local The url to the local file used for proxying messages, or the local window.
35
- * @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window.
36
- * @cfg {Number} interval The interval used when polling for messages.
37
- */
38
- easyXDM.stack.HashTransport = function(config){
39
- // #ifdef debug
40
- var trace = debug.getTracer("easyXDM.stack.HashTransport");
41
- trace("constructor");
42
- // #endif
43
- var pub;
44
- var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow;
45
- var useParent, _remoteOrigin;
46
-
47
- function _sendMessage(message){
48
- // #ifdef debug
49
- trace("sending message '" + (_msgNr + 1) + " " + message + "' to " + _remoteOrigin);
50
- // #endif
51
- if (!_callerWindow) {
52
- // #ifdef debug
53
- trace("no caller window");
54
- // #endif
55
- return;
56
- }
57
- var url = config.remote + "#" + (_msgNr++) + "_" + message;
58
- ((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url;
59
- }
60
-
61
- function _handleHash(hash){
62
- _lastMsg = hash;
63
- // #ifdef debug
64
- trace("received message '" + _lastMsg + "' from " + _remoteOrigin);
65
- // #endif
66
- pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin);
67
- }
68
-
69
- /**
70
- * Checks location.hash for a new message and relays this to the receiver.
71
- * @private
72
- */
73
- function _pollHash(){
74
- if (!_listenerWindow) {
75
- return;
76
- }
77
- var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
78
- if (indexOf != -1) {
79
- hash = href.substring(indexOf);
80
- }
81
- if (hash && hash != _lastMsg) {
82
- // #ifdef debug
83
- trace("poll: new message");
84
- // #endif
85
- _handleHash(hash);
86
- }
87
- }
88
-
89
- function _attachListeners(){
90
- // #ifdef debug
91
- trace("starting polling");
92
- // #endif
93
- _timer = setInterval(_pollHash, pollInterval);
94
- }
95
-
96
- return (pub = {
97
- outgoing: function(message, domain){
98
- _sendMessage(message);
99
- },
100
- destroy: function(){
101
- window.clearInterval(_timer);
102
- if (isHost || !useParent) {
103
- _callerWindow.parentNode.removeChild(_callerWindow);
104
- }
105
- _callerWindow = null;
106
- },
107
- onDOMReady: function(){
108
- isHost = config.isHost;
109
- pollInterval = config.interval;
110
- _lastMsg = "#" + config.channel;
111
- _msgNr = 0;
112
- useParent = config.useParent;
113
- _remoteOrigin = getLocation(config.remote);
114
- if (isHost) {
115
- apply(config.props, {
116
- src: config.remote,
117
- name: IFRAME_PREFIX + config.channel + "_provider"
118
- });
119
- if (useParent) {
120
- config.onLoad = function(){
121
- _listenerWindow = window;
122
- _attachListeners();
123
- pub.up.callback(true);
124
- };
125
- }
126
- else {
127
- var tries = 0, max = config.delay / 50;
128
- (function getRef(){
129
- if (++tries > max) {
130
- // #ifdef debug
131
- trace("unable to get reference to _listenerWindow, giving up");
132
- // #endif
133
- throw new Error("Unable to reference listenerwindow");
134
- }
135
- try {
136
- _listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"];
137
- }
138
- catch (ex) {
139
- }
140
- if (_listenerWindow) {
141
- _attachListeners();
142
- // #ifdef debug
143
- trace("got a reference to _listenerWindow");
144
- // #endif
145
- pub.up.callback(true);
146
- }
147
- else {
148
- setTimeout(getRef, 50);
149
- }
150
- }());
151
- }
152
- _callerWindow = createFrame(config);
153
- }
154
- else {
155
- _listenerWindow = window;
156
- _attachListeners();
157
- if (useParent) {
158
- _callerWindow = parent;
159
- pub.up.callback(true);
160
- }
161
- else {
162
- apply(config, {
163
- props: {
164
- src: config.remote + "#" + config.channel + new Date(),
165
- name: IFRAME_PREFIX + config.channel + "_consumer"
166
- },
167
- onLoad: function(){
168
- pub.up.callback(true);
169
- }
170
- });
171
- _callerWindow = createFrame(config);
172
- }
173
- }
174
- },
175
- init: function(){
176
- whenReady(pub.onDOMReady, pub);
177
- }
178
- });
179
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/NameTransport.js DELETED
@@ -1,171 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.NameTransport
29
- * NameTransport uses the window.name property to relay data.
30
- * The <code>local</code> parameter needs to be set on both the consumer and provider,<br/>
31
- * and the <code>remoteHelper</code> parameter needs to be set on the consumer.
32
- * @constructor
33
- * @param {Object} config The transports configuration.
34
- * @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host.
35
- * @namespace easyXDM.stack
36
- */
37
- easyXDM.stack.NameTransport = function(config){
38
- // #ifdef debug
39
- var trace = debug.getTracer("easyXDM.stack.NameTransport");
40
- trace("constructor");
41
- if (config.isHost && undef(config.remoteHelper)) {
42
- trace("missing remoteHelper");
43
- throw new Error("missing remoteHelper");
44
- }
45
- // #endif
46
-
47
- var pub; // the public interface
48
- var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl;
49
-
50
- function _sendMessage(message){
51
- var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel;
52
- // #ifdef debug
53
- trace("sending message " + message);
54
- trace("navigating to '" + url + "'");
55
- // #endif
56
- callerWindow.contentWindow.sendMessage(message, url);
57
- }
58
-
59
- function _onReady(){
60
- if (isHost) {
61
- if (++readyCount === 2 || !isHost) {
62
- pub.up.callback(true);
63
- }
64
- }
65
- else {
66
- _sendMessage("ready");
67
- // #ifdef debug
68
- trace("calling onReady");
69
- // #endif
70
- pub.up.callback(true);
71
- }
72
- }
73
-
74
- function _onMessage(message){
75
- // #ifdef debug
76
- trace("received message " + message);
77
- // #endif
78
- pub.up.incoming(message, remoteOrigin);
79
- }
80
-
81
- function _onLoad(){
82
- if (callback) {
83
- setTimeout(function(){
84
- callback(true);
85
- }, 0);
86
- }
87
- }
88
-
89
- return (pub = {
90
- outgoing: function(message, domain, fn){
91
- callback = fn;
92
- _sendMessage(message);
93
- },
94
- destroy: function(){
95
- // #ifdef debug
96
- trace("destroy");
97
- // #endif
98
- callerWindow.parentNode.removeChild(callerWindow);
99
- callerWindow = null;
100
- if (isHost) {
101
- remoteWindow.parentNode.removeChild(remoteWindow);
102
- remoteWindow = null;
103
- }
104
- },
105
- onDOMReady: function(){
106
- // #ifdef debug
107
- trace("init");
108
- // #endif
109
- isHost = config.isHost;
110
- readyCount = 0;
111
- remoteOrigin = getLocation(config.remote);
112
- config.local = resolveUrl(config.local);
113
-
114
- if (isHost) {
115
- // Register the callback
116
- easyXDM.Fn.set(config.channel, function(message){
117
- // #ifdef debug
118
- trace("received initial message " + message);
119
- // #endif
120
- if (isHost && message === "ready") {
121
- // Replace the handler
122
- easyXDM.Fn.set(config.channel, _onMessage);
123
- _onReady();
124
- }
125
- });
126
-
127
- // Set up the frame that points to the remote instance
128
- remoteUrl = appendQueryParameters(config.remote, {
129
- xdm_e: config.local,
130
- xdm_c: config.channel,
131
- xdm_p: 2
132
- });
133
- apply(config.props, {
134
- src: remoteUrl + '#' + config.channel,
135
- name: IFRAME_PREFIX + config.channel + "_provider"
136
- });
137
- remoteWindow = createFrame(config);
138
- }
139
- else {
140
- config.remoteHelper = config.remote;
141
- easyXDM.Fn.set(config.channel, _onMessage);
142
- }
143
-
144
- // Set up the iframe that will be used for the transport
145
- var onLoad = function(){
146
- // Remove the handler
147
- var w = callerWindow || this;
148
- un(w, "load", onLoad);
149
- easyXDM.Fn.set(config.channel + "_load", _onLoad);
150
- (function test(){
151
- if (typeof w.contentWindow.sendMessage == "function") {
152
- _onReady();
153
- }
154
- else {
155
- setTimeout(test, 50);
156
- }
157
- }());
158
- };
159
-
160
- callerWindow = createFrame({
161
- props: {
162
- src: config.local + "#_4" + config.channel
163
- },
164
- onLoad: onLoad
165
- });
166
- },
167
- init: function(){
168
- whenReady(pub.onDOMReady, pub);
169
- }
170
- });
171
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/PostMessageTransport.js DELETED
@@ -1,152 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.PostMessageTransport
29
- * PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/>
30
- * <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/>
31
- * <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a>
32
- * @namespace easyXDM.stack
33
- * @constructor
34
- * @param {Object} config The transports configuration.
35
- * @cfg {String} remote The remote domain to communicate with.
36
- */
37
- easyXDM.stack.PostMessageTransport = function(config){
38
- // #ifdef debug
39
- var trace = debug.getTracer("easyXDM.stack.PostMessageTransport");
40
- trace("constructor");
41
- // #endif
42
- var pub, // the public interface
43
- frame, // the remote frame, if any
44
- callerWindow, // the window that we will call with
45
- targetOrigin; // the domain to communicate with
46
- /**
47
- * Resolves the origin from the event object
48
- * @private
49
- * @param {Object} event The messageevent
50
- * @return {String} The scheme, host and port of the origin
51
- */
52
- function _getOrigin(event){
53
- if (event.origin) {
54
- // This is the HTML5 property
55
- return getLocation(event.origin);
56
- }
57
- if (event.uri) {
58
- // From earlier implementations
59
- return getLocation(event.uri);
60
- }
61
- if (event.domain) {
62
- // This is the last option and will fail if the
63
- // origin is not using the same schema as we are
64
- return location.protocol + "//" + event.domain;
65
- }
66
- throw "Unable to retrieve the origin of the event";
67
- }
68
-
69
- /**
70
- * This is the main implementation for the onMessage event.<br/>
71
- * It checks the validity of the origin and passes the message on if appropriate.
72
- * @private
73
- * @param {Object} event The messageevent
74
- */
75
- function _window_onMessage(event){
76
- var origin = _getOrigin(event);
77
- // #ifdef debug
78
- trace("received message '" + event.data + "' from " + origin);
79
- // #endif
80
- if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
81
- pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
82
- }
83
- }
84
-
85
- return (pub = {
86
- outgoing: function(message, domain, fn){
87
- callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin);
88
- if (fn) {
89
- fn();
90
- }
91
- },
92
- destroy: function(){
93
- // #ifdef debug
94
- trace("destroy");
95
- // #endif
96
- un(window, "message", _window_onMessage);
97
- if (frame) {
98
- callerWindow = null;
99
- frame.parentNode.removeChild(frame);
100
- frame = null;
101
- }
102
- },
103
- onDOMReady: function(){
104
- // #ifdef debug
105
- trace("init");
106
- // #endif
107
- targetOrigin = getLocation(config.remote);
108
- if (config.isHost) {
109
- // add the event handler for listening
110
- var waitForReady = function(event){
111
- if (event.data == config.channel + "-ready") {
112
- // #ifdef debug
113
- trace("firing onReady");
114
- // #endif
115
- // replace the eventlistener
116
- callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document;
117
- un(window, "message", waitForReady);
118
- on(window, "message", _window_onMessage);
119
- setTimeout(function(){
120
- pub.up.callback(true);
121
- }, 0);
122
- }
123
- };
124
- on(window, "message", waitForReady);
125
-
126
- // set up the iframe
127
- apply(config.props, {
128
- src: appendQueryParameters(config.remote, {
129
- xdm_e: getLocation(location.href),
130
- xdm_c: config.channel,
131
- xdm_p: 1 // 1 = PostMessage
132
- }),
133
- name: IFRAME_PREFIX + config.channel + "_provider"
134
- });
135
- frame = createFrame(config);
136
- }
137
- else {
138
- // add the event handler for listening
139
- on(window, "message", _window_onMessage);
140
- callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document;
141
- callerWindow.postMessage(config.channel + "-ready", targetOrigin);
142
-
143
- setTimeout(function(){
144
- pub.up.callback(true);
145
- }, 0);
146
- }
147
- },
148
- init: function(){
149
- whenReady(pub.onDOMReady, pub);
150
- }
151
- });
152
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/QueueBehavior.js DELETED
@@ -1,164 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.QueueBehavior
29
- * This is a behavior that enables queueing of messages. <br/>
30
- * It will buffer incoming messages and dispach these as fast as the underlying transport allows.
31
- * This will also fragment/defragment messages so that the outgoing message is never bigger than the
32
- * set length.
33
- * @namespace easyXDM.stack
34
- * @constructor
35
- * @param {Object} config The behaviors configuration. Optional.
36
- * @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation.
37
- */
38
- easyXDM.stack.QueueBehavior = function(config){
39
- // #ifdef debug
40
- var trace = debug.getTracer("easyXDM.stack.QueueBehavior");
41
- trace("constructor");
42
- // #endif
43
- var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false;
44
-
45
- function dispatch(){
46
- if (config.remove && queue.length === 0) {
47
- // #ifdef debug
48
- trace("removing myself from the stack");
49
- // #endif
50
- removeFromStack(pub);
51
- return;
52
- }
53
- if (waiting || queue.length === 0 || destroying) {
54
- return;
55
- }
56
- // #ifdef debug
57
- trace("dispatching from queue");
58
- // #endif
59
- waiting = true;
60
- var message = queue.shift();
61
-
62
- pub.down.outgoing(message.data, message.origin, function(success){
63
- waiting = false;
64
- if (message.callback) {
65
- setTimeout(function(){
66
- message.callback(success);
67
- }, 0);
68
- }
69
- dispatch();
70
- });
71
- }
72
- return (pub = {
73
- init: function(){
74
- if (undef(config)) {
75
- config = {};
76
- }
77
- if (config.maxLength) {
78
- maxLength = config.maxLength;
79
- doFragment = true;
80
- }
81
- if (config.lazy) {
82
- lazy = true;
83
- }
84
- else {
85
- pub.down.init();
86
- }
87
- },
88
- callback: function(success){
89
- waiting = false;
90
- var up = pub.up; // in case dispatch calls removeFromStack
91
- dispatch();
92
- up.callback(success);
93
- },
94
- incoming: function(message, origin){
95
- if (doFragment) {
96
- var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10);
97
- incoming += message.substring(indexOf + 1);
98
- if (seq === 0) {
99
- // #ifdef debug
100
- trace("received the last fragment");
101
- // #endif
102
- if (config.encode) {
103
- incoming = decodeURIComponent(incoming);
104
- }
105
- pub.up.incoming(incoming, origin);
106
- incoming = "";
107
- }
108
- // #ifdef debug
109
- else {
110
- trace("waiting for more fragments, seq=" + message);
111
- }
112
- // #endif
113
- }
114
- else {
115
- pub.up.incoming(message, origin);
116
- }
117
- },
118
- outgoing: function(message, origin, fn){
119
- if (config.encode) {
120
- message = encodeURIComponent(message);
121
- }
122
- var fragments = [], fragment;
123
- if (doFragment) {
124
- // fragment into chunks
125
- while (message.length !== 0) {
126
- fragment = message.substring(0, maxLength);
127
- message = message.substring(fragment.length);
128
- fragments.push(fragment);
129
- }
130
- // enqueue the chunks
131
- while ((fragment = fragments.shift())) {
132
- // #ifdef debug
133
- trace("enqueuing");
134
- // #endif
135
- queue.push({
136
- data: fragments.length + "_" + fragment,
137
- origin: origin,
138
- callback: fragments.length === 0 ? fn : null
139
- });
140
- }
141
- }
142
- else {
143
- queue.push({
144
- data: message,
145
- origin: origin,
146
- callback: fn
147
- });
148
- }
149
- if (lazy) {
150
- pub.down.init();
151
- }
152
- else {
153
- dispatch();
154
- }
155
- },
156
- destroy: function(){
157
- // #ifdef debug
158
- trace("destroy");
159
- // #endif
160
- destroying = true;
161
- pub.down.destroy();
162
- }
163
- });
164
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/ReliableBehavior.js DELETED
@@ -1,79 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, debug */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.ReliableBehavior
29
- * This is a behavior that tries to make the underlying transport reliable by using acknowledgements.
30
- * @namespace easyXDM.stack
31
- * @constructor
32
- * @param {Object} config The behaviors configuration.
33
- */
34
- easyXDM.stack.ReliableBehavior = function(config){
35
- // #ifdef debug
36
- var trace = debug.getTracer("easyXDM.stack.ReliableBehavior");
37
- trace("constructor");
38
- // #endif
39
- var pub, // the public interface
40
- callback; // the callback to execute when we have a confirmed success/failure
41
- var idOut = 0, idIn = 0, currentMessage = "";
42
-
43
- return (pub = {
44
- incoming: function(message, origin){
45
- // #ifdef debug
46
- trace("incoming: " + message);
47
- // #endif
48
- var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(",");
49
- message = message.substring(indexOf + 1);
50
-
51
- if (ack[0] == idOut) {
52
- // #ifdef debug
53
- trace("message delivered");
54
- // #endif
55
- currentMessage = "";
56
- if (callback) {
57
- callback(true);
58
- callback = null;
59
- }
60
- }
61
- if (message.length > 0) {
62
- // #ifdef debug
63
- trace("sending ack, and passing on " + message);
64
- // #endif
65
- pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin);
66
- if (idIn != ack[1]) {
67
- idIn = ack[1];
68
- pub.up.incoming(message, origin);
69
- }
70
- }
71
-
72
- },
73
- outgoing: function(message, origin, fn){
74
- currentMessage = message;
75
- callback = fn;
76
- pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin);
77
- }
78
- });
79
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/RpcBehavior.js DELETED
@@ -1,245 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.RpcBehavior
29
- * This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/>
30
- * Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything.
31
- * @namespace easyXDM.stack
32
- * @constructor
33
- * @param {Object} proxy The object to apply the methods to.
34
- * @param {Object} config The definition of the local and remote interface to implement.
35
- * @cfg {Object} local The local interface to expose.
36
- * @cfg {Object} remote The remote methods to expose through the proxy.
37
- * @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON.
38
- */
39
- easyXDM.stack.RpcBehavior = function(proxy, config){
40
- // #ifdef debug
41
- var trace = debug.getTracer("easyXDM.stack.RpcBehavior");
42
- // #endif
43
- var pub, serializer = config.serializer || getJSON();
44
- var _callbackCounter = 0, _callbacks = {};
45
-
46
- /**
47
- * Serializes and sends the message
48
- * @private
49
- * @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added.
50
- */
51
- function _send(data){
52
- data.jsonrpc = "2.0";
53
- pub.down.outgoing(serializer.stringify(data));
54
- }
55
-
56
- /**
57
- * Creates a method that implements the given definition
58
- * @private
59
- * @param {Object} The method configuration
60
- * @param {String} method The name of the method
61
- * @return {Function} A stub capable of proxying the requested method call
62
- */
63
- function _createMethod(definition, method){
64
- var slice = Array.prototype.slice;
65
-
66
- // #ifdef debug
67
- trace("creating method " + method);
68
- // #endif
69
- return function(){
70
- // #ifdef debug
71
- trace("executing method " + method);
72
- // #endif
73
- var l = arguments.length, callback, message = {
74
- method: method
75
- };
76
-
77
- if (l > 0 && typeof arguments[l - 1] === "function") {
78
- //with callback, procedure
79
- if (l > 1 && typeof arguments[l - 2] === "function") {
80
- // two callbacks, success and error
81
- callback = {
82
- success: arguments[l - 2],
83
- error: arguments[l - 1]
84
- };
85
- message.params = slice.call(arguments, 0, l - 2);
86
- }
87
- else {
88
- // single callback, success
89
- callback = {
90
- success: arguments[l - 1]
91
- };
92
- message.params = slice.call(arguments, 0, l - 1);
93
- }
94
- _callbacks["" + (++_callbackCounter)] = callback;
95
- message.id = _callbackCounter;
96
- }
97
- else {
98
- // no callbacks, a notification
99
- message.params = slice.call(arguments, 0);
100
- }
101
- if (definition.namedParams && message.params.length === 1) {
102
- message.params = message.params[0];
103
- }
104
- // Send the method request
105
- _send(message);
106
- };
107
- }
108
-
109
- /**
110
- * Executes the exposed method
111
- * @private
112
- * @param {String} method The name of the method
113
- * @param {Number} id The callback id to use
114
- * @param {Function} method The exposed implementation
115
- * @param {Array} params The parameters supplied by the remote end
116
- */
117
- function _executeMethod(method, id, fn, params){
118
- if (!fn) {
119
- // #ifdef debug
120
- trace("requested to execute non-existent procedure " + method);
121
- // #endif
122
- if (id) {
123
- _send({
124
- id: id,
125
- error: {
126
- code: -32601,
127
- message: "Procedure not found."
128
- }
129
- });
130
- }
131
- return;
132
- }
133
-
134
- // #ifdef debug
135
- trace("requested to execute procedure " + method);
136
- // #endif
137
- var success, error;
138
- if (id) {
139
- success = function(result){
140
- success = emptyFn;
141
- _send({
142
- id: id,
143
- result: result
144
- });
145
- };
146
- error = function(message, data){
147
- error = emptyFn;
148
- var msg = {
149
- id: id,
150
- error: {
151
- code: -32099,
152
- message: message
153
- }
154
- };
155
- if (data) {
156
- msg.error.data = data;
157
- }
158
- _send(msg);
159
- };
160
- }
161
- else {
162
- success = error = emptyFn;
163
- }
164
- // Call local method
165
- if (!isArray(params)) {
166
- params = [params];
167
- }
168
- try {
169
- var result = fn.method.apply(fn.scope, params.concat([success, error]));
170
- if (!undef(result)) {
171
- success(result);
172
- }
173
- }
174
- catch (ex1) {
175
- error(ex1.message);
176
- }
177
- }
178
-
179
- return (pub = {
180
- incoming: function(message, origin){
181
- var data = serializer.parse(message);
182
- if (data.method) {
183
- // #ifdef debug
184
- trace("received request to execute method " + data.method + (data.id ? (" using callback id " + data.id) : ""));
185
- // #endif
186
- // A method call from the remote end
187
- if (config.handle) {
188
- config.handle(data, _send);
189
- }
190
- else {
191
- _executeMethod(data.method, data.id, config.local[data.method], data.params);
192
- }
193
- }
194
- else {
195
- // #ifdef debug
196
- trace("received return value destined to callback with id " + data.id);
197
- // #endif
198
- // A method response from the other end
199
- var callback = _callbacks[data.id];
200
- if (data.error) {
201
- if (callback.error) {
202
- callback.error(data.error);
203
- }
204
- // #ifdef debug
205
- else {
206
- trace("unhandled error returned.");
207
- }
208
- // #endif
209
- }
210
- else if (callback.success) {
211
- callback.success(data.result);
212
- }
213
- delete _callbacks[data.id];
214
- }
215
- },
216
- init: function(){
217
- // #ifdef debug
218
- trace("init");
219
- // #endif
220
- if (config.remote) {
221
- // #ifdef debug
222
- trace("creating stubs");
223
- // #endif
224
- // Implement the remote sides exposed methods
225
- for (var method in config.remote) {
226
- if (config.remote.hasOwnProperty(method)) {
227
- proxy[method] = _createMethod(config.remote[method], method);
228
- }
229
- }
230
- }
231
- pub.down.init();
232
- },
233
- destroy: function(){
234
- // #ifdef debug
235
- trace("destroy");
236
- // #endif
237
- for (var method in config.remote) {
238
- if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) {
239
- delete proxy[method];
240
- }
241
- }
242
- pub.down.destroy();
243
- }
244
- });
245
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/SameOriginTransport.js DELETED
@@ -1,99 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.SameOriginTransport
29
- * SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/>
30
- * This can be useful for testing and for when the main application supports both internal and external sources.
31
- * @namespace easyXDM.stack
32
- * @constructor
33
- * @param {Object} config The transports configuration.
34
- * @cfg {String} remote The remote document to communicate with.
35
- */
36
- easyXDM.stack.SameOriginTransport = function(config){
37
- // #ifdef debug
38
- var trace = debug.getTracer("easyXDM.stack.SameOriginTransport");
39
- trace("constructor");
40
- // #endif
41
- var pub, frame, send, targetOrigin;
42
-
43
- return (pub = {
44
- outgoing: function(message, domain, fn){
45
- send(message);
46
- if (fn) {
47
- fn();
48
- }
49
- },
50
- destroy: function(){
51
- // #ifdef debug
52
- trace("destroy");
53
- // #endif
54
- if (frame) {
55
- frame.parentNode.removeChild(frame);
56
- frame = null;
57
- }
58
- },
59
- onDOMReady: function(){
60
- // #ifdef debug
61
- trace("init");
62
- // #endif
63
- targetOrigin = getLocation(config.remote);
64
-
65
- if (config.isHost) {
66
- // set up the iframe
67
- apply(config.props, {
68
- src: appendQueryParameters(config.remote, {
69
- xdm_e: location.protocol + "//" + location.host + location.pathname,
70
- xdm_c: config.channel,
71
- xdm_p: 4 // 4 = SameOriginTransport
72
- }),
73
- name: IFRAME_PREFIX + config.channel + "_provider"
74
- });
75
- frame = createFrame(config);
76
- easyXDM.Fn.set(config.channel, function(sendFn){
77
- send = sendFn;
78
- setTimeout(function(){
79
- pub.up.callback(true);
80
- }, 0);
81
- return function(msg){
82
- pub.up.incoming(msg, targetOrigin);
83
- };
84
- });
85
- }
86
- else {
87
- send = getParentObject().Fn.get(config.channel, true)(function(msg){
88
- pub.up.incoming(msg, targetOrigin);
89
- });
90
- setTimeout(function(){
91
- pub.up.callback(true);
92
- }, 0);
93
- }
94
- },
95
- init: function(){
96
- whenReady(pub.onDOMReady, pub);
97
- }
98
- });
99
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/stack/VerifyBehavior.js DELETED
@@ -1,90 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyXDM, window, escape, unescape, undef, debug */
3
- //
4
- // easyXDM
5
- // http://easyxdm.net/
6
- // Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
7
- //
8
- // Permission is hereby granted, free of charge, to any person obtaining a copy
9
- // of this software and associated documentation files (the "Software"), to deal
10
- // in the Software without restriction, including without limitation the rights
11
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- // copies of the Software, and to permit persons to whom the Software is
13
- // furnished to do so, subject to the following conditions:
14
- //
15
- // The above copyright notice and this permission notice shall be included in
16
- // all copies or substantial portions of the Software.
17
- //
18
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- // THE SOFTWARE.
25
- //
26
-
27
- /**
28
- * @class easyXDM.stack.VerifyBehavior
29
- * This behavior will verify that communication with the remote end is possible, and will also sign all outgoing,
30
- * and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages.
31
- * @namespace easyXDM.stack
32
- * @constructor
33
- * @param {Object} config The behaviors configuration.
34
- * @cfg {Boolean} initiate If the verification should be initiated from this end.
35
- */
36
- easyXDM.stack.VerifyBehavior = function(config){
37
- // #ifdef debug
38
- var trace = debug.getTracer("easyXDM.stack.VerifyBehavior");
39
- trace("constructor");
40
- if (undef(config.initiate)) {
41
- throw new Error("settings.initiate is not set");
42
- }
43
- // #endif
44
- var pub, mySecret, theirSecret, verified = false;
45
-
46
- function startVerification(){
47
- // #ifdef debug
48
- trace("requesting verification");
49
- // #endif
50
- mySecret = Math.random().toString(16).substring(2);
51
- pub.down.outgoing(mySecret);
52
- }
53
-
54
- return (pub = {
55
- incoming: function(message, origin){
56
- var indexOf = message.indexOf("_");
57
- if (indexOf === -1) {
58
- if (message === mySecret) {
59
- // #ifdef debug
60
- trace("verified, calling callback");
61
- // #endif
62
- pub.up.callback(true);
63
- }
64
- else if (!theirSecret) {
65
- // #ifdef debug
66
- trace("returning secret");
67
- // #endif
68
- theirSecret = message;
69
- if (!config.initiate) {
70
- startVerification();
71
- }
72
- pub.down.outgoing(message);
73
- }
74
- }
75
- else {
76
- if (message.substring(0, indexOf) === theirSecret) {
77
- pub.up.incoming(message.substring(indexOf + 1), origin);
78
- }
79
- }
80
- },
81
- outgoing: function(message, origin, fn){
82
- pub.down.outgoing(mySecret + "_" + message, origin, fn);
83
- },
84
- callback: function(success){
85
- if (config.initiate) {
86
- startVerification();
87
- }
88
- }
89
- });
90
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/.consumer.html.swp DELETED
Binary file
js/bluepay_echeck/easyXDM/src/tests/consumer.html DELETED
@@ -1,21 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM.Transport test</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js"></script>
6
- <script>
7
- var socket = new easyXDM.Socket({
8
- //remote: "http://localhost/easyXDM/src/tests/provider.html",
9
- remote: "http://localhost/test.html",
10
- onMessage: function(message, origin){
11
- alert("Received '" + message + "' from '" + origin + "'");
12
- },
13
- onReady: function() {
14
- socket.postMessage("Yay, it works!");
15
- }
16
- });
17
- </script>
18
- </head>
19
- <body>
20
- </body>
21
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/easyTest.css DELETED
@@ -1,14 +0,0 @@
1
- .easyTest_messages {
2
- }
3
-
4
- .easyTest_error {
5
- color: red;
6
- }
7
-
8
- .easyTest_success {
9
- color: green;
10
- }
11
-
12
- .easyTest_msg {
13
- color: black;
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/easyTest.js DELETED
@@ -1,262 +0,0 @@
1
- var easyTest = (function(){
2
- var _messages;
3
- var _start;
4
- var MessageType = {
5
- Error: 1,
6
- Success: 2,
7
- Info: 3
8
- };
9
-
10
- /**
11
- * Logs the message to the body
12
- * @param {String} msg The message to displey
13
- * @param {MessageType} type The messagetype
14
- */
15
- function _log(msg, type){
16
- var el = _messages.appendChild(document.createElement("div"));
17
- el.innerHTML = msg;
18
- _messages.scrollTop = _messages.scrollHeight;
19
- switch (type) {
20
- case MessageType.Error:
21
- el.className = "easyTest_error";
22
- break;
23
- case MessageType.Success:
24
- el.className = "easyTest_success";
25
- break;
26
- default:
27
- el.className = "easyTest_msg";
28
- break;
29
- }
30
- }
31
-
32
- var Assert = {
33
- // Type checks
34
- isTypeOf: function(type, obj){
35
- return typeof obj === type;
36
- },
37
- isInstanceOf: function(type, obj){
38
- return obj instanceof type;
39
- },
40
- isString: function(obj){
41
- return this.isTypeOf("string", obj);
42
- },
43
- isNumber: function(obj){
44
- return this.isTypeOf("number", obj);
45
- },
46
- isObject: function(obj){
47
- return this.isTypeOf("object", obj);
48
- },
49
- isBoolean: function(obj){
50
- return this.isTypeOf("boolean", obj);
51
- },
52
- isFunction: function(obj){
53
- return this.isTypeOf("function", obj);
54
- },
55
- // Equality
56
- areEqual: function(a, b){
57
- return a == b;
58
- },
59
- areNotEqual: function(a, b){
60
- return a != b;
61
- },
62
- // Identical
63
- areSame: function(a, b){
64
- return a === b;
65
- },
66
- areNotSame: function(a, b){
67
- return a !== b;
68
- }
69
-
70
- };
71
-
72
- function Test(test, fn){
73
- var _scope, _steps = test.steps, _step, _stepIndex = 0;
74
- var _timer, _runStep, _startedAt, _stepStartedAt;
75
-
76
- /**
77
- * Clean up and tear down the test.<br/>
78
- * Calls back to notify that the test is complete
79
- */
80
- function _endTest(){
81
- // Tear down the test
82
- if (test.tearDown) {
83
- try {
84
- test.tearDown.call(_scope);
85
- }
86
- catch (ex) {
87
- _log("Teardown '" + ex.message + "(" + ex.fileName + ", " + ex.lineNumber + ")" + "'", MessageType.Error);
88
- }
89
- }
90
- for (var key in _scope) {
91
- if (_scope.hasOwnProperty(key)) {
92
- delete _scope[key];
93
- }
94
- }
95
-
96
- // Call back
97
- fn();
98
- }
99
-
100
- /**
101
- * Used to notify the framework of the result of the test
102
- * @param {String} name The name of the test
103
- * @param {Boolean} result The result of the test
104
- * @param {String} reason An optional reason why the test returned the result
105
- */
106
- function _notifyResult(name, result, reason){
107
- var now = new Date().getTime();
108
- var testsetTime = now - _start.getTime();
109
- var testTime = now - _startedAt.getTime();
110
- var stepTime = now - _stepStartedAt.getTime();
111
-
112
- var times = testsetTime + "ms, " + testTime + "ms, " + stepTime + "ms - ";
113
- if (result) {
114
- _log(times + name + " succeeded! " + (reason || ""), MessageType.Success);
115
- }
116
- else {
117
- _log(times + name + " failed! " + (reason || ""), MessageType.Error);
118
- if (test.failedMessage) {
119
- _log(test.failedMessage, MessageType.Info);
120
- }
121
- }
122
- // Go to next step
123
- if (result) {
124
- _stepIndex++;
125
- window.setTimeout(function(){
126
- _runStep();
127
- }, 0);
128
- }
129
- else {
130
- _endTest();
131
- }
132
- }
133
-
134
-
135
- /**
136
- * Runs through the test step
137
- */
138
- _runStep = function(){
139
- if (_stepIndex < _steps.length) {
140
- // We still have steps to run
141
- _step = _steps[_stepIndex];
142
- _stepStartedAt = new Date();
143
- if (_step.timeout) {
144
- // This an asynchronous test
145
- _timer = window.setTimeout(function(){
146
- _notifyResult(_step.name, false, "Failed due to timeout.");
147
- }, _step.timeout);
148
- try {
149
- _step.run.call(_scope);
150
- }
151
- catch (ex) {
152
- //If it fails we cancel the timeout
153
- window.clearTimeout(_timer);
154
- _notifyResult(_step.name, false, "'" + ex.message + "(" + ex.fileName + ", " + ex.lineNumber + ")" + "'");
155
- }
156
- }
157
- else {
158
- // This is a synchronous test
159
- try {
160
- var result = _step.run.call(_scope);
161
- _notifyResult(_step.name, result);
162
- }
163
- catch (ex) {
164
- _notifyResult(_step.name, false, "'" + ex.message + "(" + ex.fileName + ", " + ex.lineNumber + ")" + "'");
165
- }
166
- }
167
- }
168
- else {
169
- _endTest();
170
- }
171
- };
172
-
173
- return {
174
- /**
175
- * Runs the test.
176
- * Will first try to execute the setup method before continuing the steps
177
- */
178
- run: function(){
179
- var excuse;
180
- if (test.runIf) {
181
- excuse = test.runIf();
182
- }
183
- if (excuse) {
184
- _log("Skipping test ' " + test.name + "'. " + excuse);
185
- fn();
186
- }
187
- else {
188
- _log("Running test '" + test.name + "'");
189
- _scope = {
190
- Assert: Assert,
191
- log: _log,
192
- notifyResult: function(result){
193
- window.clearTimeout(_timer);
194
- _notifyResult(_step.name, result);
195
- }
196
- };
197
- if (test.setUp) {
198
- // Setup the test
199
- try {
200
- test.setUp.call(_scope);
201
- _log("Setup succeeded", MessageType.Success);
202
- }
203
- catch (ex) {
204
- _log("Setup failed", MessageType.Error);
205
- }
206
- }
207
- _startedAt = new Date();
208
- _runStep();
209
- }
210
- }
211
- };
212
- }
213
-
214
- return {
215
- /**
216
- * Runs through all the tests
217
- * @param {Array} tests The tests to run
218
- */
219
- test: function(testset){
220
- var tests = [], testConfig, i = testset.length, test;
221
-
222
- // Prepare the messaging facilities
223
- if (!_messages) {
224
- _messages = document.createElement("div");
225
- _messages.className = "easyTest_messages";
226
- (document.getElementById("messages") || document.body).appendChild(_messages);
227
- }
228
- else {
229
- _messages.innerHTML = "";
230
- }
231
-
232
- // Convert the testset
233
- while (i--) {
234
- testConfig = testset[i];
235
- if (!testConfig.steps) {
236
- // Convert a single step test to a proper test
237
- testConfig = {
238
- steps: testConfig
239
- };
240
- }
241
-
242
- tests.push(new Test(testConfig, function(){
243
- // Get the next test to run
244
- test = tests.pop();
245
- if (test) {
246
- // This is needed to avoid a strange bug in Opera,
247
- window.setTimeout(function(){
248
- test.run();
249
- }, 0);
250
- }
251
- else {
252
- // No more tests to run
253
- _log("Test run complete", MessageType.Info);
254
- }
255
- }));
256
- }
257
- // Start the first test
258
- _start = new Date();
259
- tests.pop().run();
260
- }
261
- };
262
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/index.html DELETED
@@ -1,91 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=100">
6
- <title>easyTest results</title>
7
- <script type="text/javascript" src="../easyXDM.debug.js">
8
- // The first instance of easyXDM
9
- </script>
10
- <script type="text/javascript">
11
- easyXDM._test_global = true;
12
- </script>
13
- <script type="text/javascript" src="../easyXDM.debug.js">
14
- // The second instance of easyXDM (to test noConflict)
15
- </script>
16
- <script type="text/javascript">
17
- // Used in the noConflict test
18
- var modules = {
19
- easyXDM: easyXDM.noConflict("modules")
20
- };
21
- </script>
22
- <script type="text/javascript">
23
- if (location.href.indexOf("src") !== -1) {
24
- if (typeof JSON === "undefined") {
25
- document.write(unescape("%3Cscript src='../../tools/json2.js' type='text/javascript'%3E%3C/script%3E"));
26
- }
27
- }
28
- else {
29
- if (typeof JSON === "undefined") {
30
- document.write(unescape("%3Cscript src='../json2.js' type='text/javascript'%3E%3C/script%3E"));
31
- }
32
- }
33
- </script>
34
- <script type="text/javascript" src="easyTest.js">
35
- </script>
36
- <link type="text/css" rel="stylesheet" href="easyTest.css"/>
37
- <script type="text/javascript" src="tests.js">
38
- </script>
39
- <style type="text/css">
40
-
41
- #embedded {
42
- height: 100px;
43
- }
44
-
45
- #embedded iframe {
46
- height: 50px;
47
- }
48
-
49
- #log {
50
- height: 100px;
51
- border: 1px dotted black;
52
- overflow: auto
53
- }
54
-
55
- .easyTest_messages {
56
- height: 300px;
57
- border: 1px dotted black;
58
- overflow: auto;
59
- }
60
- </style>
61
- </head>
62
- <body onload="runTests();">
63
- <h1>easyXDM test suite</h1>
64
- <h4>easyTest messages</h4>
65
- <div id="messages">
66
- </div>
67
- <h4>easyXDM tracelog</h4>
68
- <!-- easyXDM.Debug.trace(msg) will output its messages to any element with the id "log" -->
69
- <div id="log">
70
- </div>
71
- <div id="embedded">
72
- </div>
73
- <script type="text/javascript">
74
- if (location.host.indexOf("easyxdm.net") !== -1) {
75
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
76
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
77
- }
78
- </script>
79
- <script type="text/javascript">
80
- if (location.host.indexOf("easyxdm.net") !== -1) {
81
- try {
82
- var pageTracker = _gat._getTracker("UA-9535591-3");
83
- pageTracker._setDomainName(".easyxdm.net");
84
- pageTracker._trackPageview();
85
- }
86
- catch (err) {
87
- }
88
- }
89
- </script>
90
- </body>
91
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/provider.html DELETED
@@ -1,17 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM.Transport test</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js"></script>
6
- <script>
7
- var socket = new easyXDM.Socket({
8
- onMessage: function(message, origin){
9
- alert("Received '" + message + "' from '" + origin + "'");
10
- socket.postMessage("Indeed it does!");
11
- }
12
- });
13
- </script>
14
- </head>
15
- <body>
16
- </body>
17
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/s.gif DELETED
Binary file
js/bluepay_echeck/easyXDM/src/tests/test.html DELETED
@@ -1,17 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM.Transport test</title>
5
- <script type="text/javascript" src="/easyxdm/easyXDM.debug.js"></script>
6
- <script>
7
- var socket = new easyXDM.Socket({
8
- onMessage: function(message, origin){
9
- alert("Received '" + message + "' from '" + origin + "'");
10
- socket.postMessage("Indeed it does!");
11
- }
12
- });
13
- </script>
14
- </head>
15
- <body>
16
- </body>
17
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/test_namespace.html DELETED
@@ -1,32 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var modules = {
9
- easyXDM: easyXDM.noConflict("modules")
10
- };
11
-
12
- var transport;
13
- window.onload = function(){
14
- transport = new modules.easyXDM.Socket({
15
- local: "../name.html",
16
- swf: "../easyxdm.swf",
17
- onMessage: function(message, origin){
18
- // Echo back the message
19
- transport.postMessage(message);
20
- }
21
- });
22
- };
23
- window.onunload = function(){
24
- if (transport) {
25
- transport.destroy();
26
- }
27
- };
28
- </script>
29
- </head>
30
- <body>
31
- </body>
32
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/test_rpc.html DELETED
@@ -1,65 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- if (location.href.indexOf("src") !== -1) {
9
- if (typeof JSON === "undefined") {
10
- document.write(unescape("%3Cscript src='../../tools/json2.js' type='text/javascript'%3E%3C/script%3E"));
11
- }
12
- }
13
- else {
14
- if (typeof JSON === "undefined") {
15
- document.write(unescape("%3Cscript src='../json2.js' type='text/javascript'%3E%3C/script%3E"));
16
- }
17
- }
18
- </script>
19
- <script type="text/javascript">
20
- easyXDM.DomHelper.requiresJSON("../json2.js");
21
- </script>
22
- <script type="text/javascript">
23
- var remote = new easyXDM.Rpc({
24
- local: "../name.html",
25
- swf: "../easyxdm.swf"
26
- }, {
27
- remote: {
28
- voidCallback: {}
29
- },
30
- local: {
31
- voidMethod: function(msg){
32
- // Echo back the message
33
- remote.voidCallback(msg);
34
- },
35
- asyncMethod: function(msg, fn){
36
- window.setTimeout(function(){
37
- // Echo back the msg
38
- fn(msg);
39
- }, 100);
40
- },
41
- // use the shorthand notation
42
- method: function(msg){
43
- // Echo back the msg
44
- return msg;
45
- },
46
- error: function(){
47
- var a, b = a.c;
48
- },
49
- namedParamsMethod: {
50
- method: function(params){
51
- return params.msg;
52
- }
53
- }
54
- }
55
- });
56
- window.onunload = function(){
57
- if (remote) {
58
- remote.destroy();
59
- }
60
- };
61
- </script>
62
- </head>
63
- <body>
64
- </body>
65
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/test_transport.html DELETED
@@ -1,28 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>easyXDM</title>
5
- <script type="text/javascript" src="../easyXDM.debug.js">
6
- </script>
7
- <script type="text/javascript">
8
- var transport;
9
- window.onload = function(){
10
- transport = new easyXDM.Socket({
11
- local: "../name.html",
12
- swf: "../easyxdm.swf",
13
- onMessage: function(message, origin){
14
- // Echo back the message
15
- transport.postMessage(message);
16
- }
17
- });
18
- };
19
- window.onunload = function(){
20
- if (transport) {
21
- transport.destroy();
22
- }
23
- };
24
- </script>
25
- </head>
26
- <body>
27
- </body>
28
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/bluepay_echeck/easyXDM/src/tests/tests.js DELETED
@@ -1,855 +0,0 @@
1
- /*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
2
- /*global easyTest, easyXDM, window, modules*/
3
- var REMOTE = (function(){
4
- var remote = location.href;
5
- switch (location.host) {
6
- case "provider.easyxdm.net":
7
- location.href = remote.replace("provider", "consumer");
8
- break;
9
- case "easyxdm.net":
10
- remote = remote.replace("easyxdm.net", "consumer.easyxdm.net");
11
- break;
12
- case "consumer.easyxdm.net":
13
- remote = remote.replace("consumer", "provider");
14
- break;
15
- case "xdm1":
16
- remote = remote.replace("xdm1", "xdm2");
17
- break;
18
- }
19
- return remote.substring(0, remote.lastIndexOf("/"));
20
- }());
21
-
22
- var LOCAL = location.protocol + "//" + location.host + location.pathname.substring(0, location.pathname.lastIndexOf("/"));
23
-
24
- function runTests(){
25
- var i = 0;
26
- easyTest.test([/**Tests for the presence of namespaces and classes*/{
27
- name: "Check that the library is complete",
28
- steps: [{
29
- name: "check for the presence of easyXDM",
30
- run: function(){
31
- if (this.Assert.isObject(easyXDM) && this.Assert.isString(easyXDM.version)) {
32
- this.log("found easyXDM, version=" + easyXDM.version);
33
- return true;
34
- }
35
- return false;
36
- }
37
- }, {
38
- name: "check for the presence of easyXDM.DomHelper",
39
- run: function(){
40
- return this.Assert.isObject(easyXDM.DomHelper);
41
- }
42
- }, {
43
- name: "check for the presence of easyXDM.Socket",
44
- run: function(){
45
- return this.Assert.isFunction(easyXDM.Socket);
46
- }
47
- }, {
48
- name: "check for the presence of easyXDM.Rpc",
49
- run: function(){
50
- return this.Assert.isFunction(easyXDM.Rpc);
51
- }
52
- }, {
53
- name: "check for the presence of easyXDM.stack",
54
- run: function(){
55
- return this.Assert.isObject(easyXDM.stack);
56
- }
57
- }, {
58
- name: "check for the presence of easyXDM.stack.SameOriginTransport",
59
- run: function(){
60
- return this.Assert.isFunction(easyXDM.stack.SameOriginTransport);
61
- }
62
- }, {
63
- name: "check for the presence of easyXDM.stack.PostMessageTransport",
64
- run: function(){
65
- return this.Assert.isFunction(easyXDM.stack.PostMessageTransport);
66
- }
67
- }, {
68
- name: "check for the presence of easyXDM.stack.FlashTransport",
69
- run: function(){
70
- return this.Assert.isFunction(easyXDM.stack.FlashTransport);
71
- }
72
- }, {
73
- name: "check for the presence of easyXDM.stack.NameTransport",
74
- run: function(){
75
- return this.Assert.isFunction(easyXDM.stack.NameTransport);
76
- }
77
- }, {
78
- name: "check for the presence of easyXDM.stack.HashTransport",
79
- run: function(){
80
- return this.Assert.isFunction(easyXDM.stack.HashTransport);
81
- }
82
- }, {
83
- name: "check for the presence of easyXDM.stack.ReliableBehavior",
84
- run: function(){
85
- return this.Assert.isFunction(easyXDM.stack.ReliableBehavior);
86
- }
87
- }, {
88
- name: "check for the presence of easyXDM.stack.QueueBehavior",
89
- run: function(){
90
- return this.Assert.isFunction(easyXDM.stack.QueueBehavior);
91
- }
92
- }, {
93
- name: "check for the presence of easyXDM.stack.VerifyBehavior",
94
- run: function(){
95
- return this.Assert.isFunction(easyXDM.stack.VerifyBehavior);
96
- }
97
- }, {
98
- name: "check for the presence of easyXDM.stack.RpcBehavior",
99
- run: function(){
100
- return this.Assert.isFunction(easyXDM.stack.RpcBehavior);
101
- }
102
- }]
103
- }, {
104
- name: "Check helper functions",
105
- runIf: function(){
106
- if (location.href.indexOf("/src/") == -1) {
107
- return "This can only be run in development.";
108
- }
109
- },
110
- setUp: function(){
111
- this.url1 = "http://foo.bar/a/b/c?d=e#f";
112
- this.url2 = "http://foo.bar:80/a/b/c?d=e#f";
113
- this.url3 = "http://foo.bar:88/a/b/c?d=e#f";
114
- this.url4 = "hTtp://Foo.Bar:88/a/b/c?d=e#f";
115
-
116
- },
117
- steps: [{
118
- name: "getDomainName",
119
- run: function(){
120
- return easyXDM.getDomainName(this.url1) === "foo.bar";
121
- }
122
- }, {
123
- name: "getLocation",
124
- run: function(){
125
- return easyXDM.getLocation(this.url1) === "http://foo.bar";
126
- }
127
- }, {
128
- name: "getLocation with standard port",
129
- run: function(){
130
- return easyXDM.getLocation(this.url2) === "http://foo.bar";
131
- }
132
- }, {
133
- name: "getLocation with non-standard port",
134
- run: function(){
135
- return easyXDM.getLocation(this.url3) === "http://foo.bar:88";
136
- }
137
- }, {
138
- name: "getLocation with capitals",
139
- run: function(){
140
- return easyXDM.getLocation(this.url4) === "http://foo.bar:88";
141
- }
142
- }, {
143
- name: "appendQueryParameters",
144
- run: function(){
145
- return easyXDM.appendQueryParameters(this.url2, {
146
- g: "h"
147
- }) ===
148
- "http://foo.bar:80/a/b/c?d=e&g=h#f";
149
- }
150
- }]
151
- }, {
152
- name: "Check the ACL feature",
153
- runIf: function(){
154
- if (location.href.indexOf("/src/") == -1) {
155
- return "This can only be run in development.";
156
- }
157
- },
158
- setUp: function(){
159
- this.acl = ["http://www.domain.invalid", "*.domaina.com", "http://dom?inb.com", "^http://domc{3}ain\\.com$"];
160
- },
161
- steps: [{
162
- name: "Match complete string",
163
- run: function(){
164
- return easyXDM.checkAcl(this.acl, "http://www.domain.invalid");
165
- }
166
- }, {
167
- name: "Match *",
168
- run: function(){
169
- return easyXDM.checkAcl(this.acl, "http://www.domaina.com");
170
- }
171
- }, {
172
- name: "Match ?",
173
- run: function(){
174
- return easyXDM.checkAcl(this.acl, "http://domainb.com");
175
- }
176
- }, {
177
- name: "Match RegExp",
178
- run: function(){
179
- return easyXDM.checkAcl(this.acl, "http://domcccain.com");
180
- }
181
- }, {
182
- name: "No match",
183
- run: function(){
184
- return !easyXDM.checkAcl(this.acl, "http://foo.com");
185
- }
186
- }]
187
- }, {
188
- name: "test easyXDM.Socket{SameOriginTransport}",
189
- setUp: function(){
190
- this.expectedMessage = ++i + "_abcd1234%@¤/";
191
- },
192
- steps: [{
193
- name: "onReady is fired",
194
- timeout: 5000,
195
- run: function(){
196
- var scope = this;
197
- var messages = 0;
198
- this.transport = new easyXDM.Socket({
199
- protocol: "4",
200
- remote: LOCAL + "/test_transport.html",
201
- onMessage: function(message, origin){
202
- if (scope.expectedMessage === message) {
203
- if (++messages === 2) {
204
- scope.notifyResult(true);
205
- }
206
- }
207
- },
208
- onReady: function(){
209
- scope.notifyResult(true);
210
- }
211
- });
212
- }
213
- }, {
214
- name: "message is echoed back",
215
- timeout: 5000,
216
- run: function(){
217
- this.transport.postMessage(this.expectedMessage);
218
- this.transport.postMessage(this.expectedMessage);
219
- }
220
- }, {
221
- name: "destroy",
222
- run: function(){
223
- this.transport.destroy();
224
- return ((document.getElementsByTagName("iframe").length === 0));
225
- }
226
- }]
227
- }, {
228
- name: "test easyXDM.Socket{PostMessageTransport}",
229
- runIf: function(){
230
- if (!("postMessage" in window || "postMessage" in document)) {
231
- return "This test requires the HTML5 postMessage interface.";
232
- }
233
- },
234
-
235
- setUp: function(){
236
- this.expectedMessage = ++i + "_abcd1234%@¤/";
237
- },
238
- steps: [{
239
- name: "onReady is fired",
240
- timeout: 5000,
241
- run: function(){
242
- var scope = this;
243
- var messages = 0;
244
- this.transport = new easyXDM.Socket({
245
- protocol: "1",
246
- local: "../name.html",
247
- remote: REMOTE + "/test_transport.html",
248
- onMessage: function(message, origin){
249
- if (scope.expectedMessage === message) {
250
- if (++messages === 2) {
251
- scope.notifyResult(true);
252
- }
253
- }
254
- },
255
- onReady: function(){
256
- scope.notifyResult(true);
257
- }
258
- });
259
- }
260
- }, {
261
- name: "message is echoed back",
262
- timeout: 5000,
263
- run: function(){
264
- this.transport.postMessage(this.expectedMessage);
265
- this.transport.postMessage(this.expectedMessage);
266
- }
267
- }, {
268
- name: "destroy",
269
- run: function(){
270
- this.transport.destroy();
271
- return ((document.getElementsByTagName("iframe").length === 0));
272
- }
273
- }]
274
- }, {
275
- name: "test easyXDM.Socket{FlashTransport}",
276
- setUp: function(){
277
- this.expectedMessage = ++i + "_abcd1234%@¤/";
278
- },
279
- steps: [{
280
- name: "onReady is fired",
281
- timeout: 5000,
282
- run: function(){
283
- var scope = this;
284
- var messages = 0;
285
- this.transport = new easyXDM.Socket({
286
- protocol: "6",
287
- remote: REMOTE + "/test_transport.html",
288
- swf: REMOTE + "/../easyxdm.swf",
289
- onMessage: function(message, origin){
290
- if (scope.expectedMessage === message) {
291
- if (++messages === 2) {
292
- scope.notifyResult(true);
293
- }
294
- }
295
- },
296
- container: "embedded",
297
- onReady: function(){
298
- scope.notifyResult(true);
299
- }
300
- });
301
- }
302
- }, {
303
- name: "message is echoed back",
304
- timeout: 5000,
305
- run: function(){
306
- this.transport.postMessage(this.expectedMessage);
307
- this.transport.postMessage(this.expectedMessage);
308
- }
309
- }, {
310
- name: "destroy",
311
- run: function(){
312
- this.transport.destroy();
313
- return ((document.getElementsByTagName("iframe").length === 0));
314
- }
315
- }]
316
- }, {
317
- name: "test easyXDM.Socket{FrameElementTransport}",
318
- runIf: function(){
319
- if (!(navigator.product === "Gecko" && "frameElement" in window && !("postMessage" in window) && navigator.userAgent.indexOf('WebKit') == -1)) {
320
- return "This test requires an older Gecko browser and the presence of the frameElement object";
321
- }
322
- },
323
- setUp: function(){
324
- this.expectedMessage = ++i + "_abcd1234%@¤/";
325
- },
326
- steps: [{
327
- name: "onReady is fired",
328
- timeout: 5000,
329
- run: function(){
330
- var scope = this;
331
- var messages = 0;
332
- this.transport = new easyXDM.Socket({
333
- protocol: "5",
334
- remote: REMOTE + "/test_transport.html",
335
- onMessage: function(message, origin){
336
- if (scope.expectedMessage === message) {
337
- if (++messages === 2) {
338
- scope.notifyResult(true);
339
- }
340
- }
341
- },
342
- onReady: function(){
343
- scope.notifyResult(true);
344
- }
345
- });
346
- }
347
- }, {
348
- name: "message is echoed back",
349
- timeout: 5000,
350
- run: function(){
351
- this.transport.postMessage(this.expectedMessage);
352
- this.transport.postMessage(this.expectedMessage);
353
- }
354
- }, {
355
- name: "destroy",
356
- run: function(){
357
- this.transport.destroy();
358
- return ((document.getElementsByTagName("iframe").length === 0));
359
- }
360
- }]
361
- }, {
362
- name: "test easyXDM.Socket{NameTransport}",
363
- failedMessage: "This might fail in modern browsers due to restrictions in referencing existing windows",
364
- setUp: function(){
365
- this.expectedMessage = ++i + "_abcd1234%@¤/";
366
- },
367
- tearDown: function(){
368
- this.transport.destroy();
369
- if (document.getElementsByTagName("iframe").length !== 0) {
370
- throw new Error("iframe still present");
371
- }
372
- },
373
- steps: [{
374
- name: "onReady is fired",
375
- timeout: 5000,
376
- run: function(){
377
- var scope = this;
378
- var messages = 0;
379
- this.transport = new easyXDM.Socket({
380
- protocol: "2", // This is just to override the automatic selection
381
- local: "../name.html",
382
- remote: REMOTE + "/test_transport.html",
383
- remoteHelper: REMOTE + "/../name.html",
384
- onMessage: function(message, origin){
385
- if (scope.expectedMessage === message) {
386
- if (++messages === 2) {
387
- scope.notifyResult(true);
388
- }
389
- }
390
- },
391
- container: document.getElementById("embedded"),
392
- onReady: function(){
393
- scope.notifyResult(true);
394
- }
395
- });
396
- }
397
- }, {
398
- name: "message is echoed back",
399
- timeout: 5000,
400
- run: function(){
401
- this.transport.postMessage(this.expectedMessage);
402
- this.transport.postMessage(this.expectedMessage);
403
- }
404
- }]
405
- }, {
406
- name: "test easyXDM.Socket{HashTransport} using window",
407
- setUp: function(){
408
- this.expectedMessage = ++i + "_abcd1234%@¤/";
409
- },
410
- tearDown: function(){
411
- this.transport.destroy();
412
- if (document.getElementsByTagName("iframe").length !== 0) {
413
- throw new Error("iframe still present");
414
- }
415
- },
416
- steps: [{
417
- name: "onReady is fired",
418
- timeout: 5000,
419
- run: function(){
420
- var scope = this;
421
- var messages = 0;
422
- this.transport = new easyXDM.Socket({
423
- protocol: "0", // This is just to override the automatic selection
424
- local: window,
425
- remote: REMOTE + "/test_transport.html",
426
- onMessage: function(message, origin){
427
- if (scope.expectedMessage === message) {
428
- if (++messages === 2) {
429
- scope.notifyResult(true);
430
- }
431
- }
432
- },
433
- container: document.getElementById("embedded"),
434
- onReady: function(){
435
- scope.notifyResult(true);
436
- }
437
- });
438
- }
439
- }, {
440
- name: "message is echoed back",
441
- timeout: 5000,
442
- run: function(){
443
- this.transport.postMessage(this.expectedMessage);
444
- this.transport.postMessage(this.expectedMessage);
445
- }
446
- }]
447
- }, {
448
- name: "test easyXDM.Socket{HashTransport} with no blank local, available image and resize",
449
- failedMessage: "This might fail in modern browsers due to restrictions in referencing existing windows",
450
- setUp: function(){
451
- this.expectedMessage = ++i + "_abcd1234%@¤/";
452
- this.img = document.createElement("img");
453
- this.img.src = "s.gif";
454
- document.body.appendChild(this.img);
455
- },
456
- tearDown: function(){
457
- document.body.removeChild(this.img);
458
- this.transport.destroy();
459
- if (document.getElementsByTagName("iframe").length !== 0) {
460
- throw new Error("iframe still present");
461
- }
462
- },
463
- steps: [{
464
- name: "onReady is fired",
465
- timeout: 5000,
466
- run: function(){
467
- var scope = this;
468
- var messages = 0;
469
- this.transport = new easyXDM.Socket({
470
- protocol: "0", // This is just to override the automatic selection
471
- remote: REMOTE + "/test_transport.html",
472
- onMessage: function(message, origin){
473
- if (++messages === 2) {
474
- scope.notifyResult(true);
475
- }
476
- },
477
- onReady: function(){
478
- scope.notifyResult(true);
479
- }
480
- });
481
- }
482
- }, {
483
- name: "message is echoed back",
484
- timeout: 5000,
485
- run: function(){
486
- this.transport.postMessage(this.expectedMessage);
487
- this.transport.postMessage(this.expectedMessage);
488
- }
489
- }]
490
- }, {
491
- name: "test easyXDM.Socket{HashTransport} with s.gif and polling",
492
- failedMessage: "This might fail in modern browsers due to restrictions in referencing existing windows",
493
- setUp: function(){
494
- this.expectedMessage = ++i + "_abcd1234%@¤/";
495
- },
496
- tearDown: function(){
497
- this.transport.destroy();
498
- if (document.getElementsByTagName("iframe").length !== 0) {
499
- throw new Error("iframe still present");
500
- }
501
- },
502
- steps: [{
503
- name: "onReady is fired",
504
- timeout: 5000,
505
- run: function(){
506
- var scope = this;
507
- var messages = 0;
508
- this.transport = new easyXDM.Socket({
509
- protocol: "0", // This is just to override the automatic selection
510
- local: "s.gif",
511
- remote: REMOTE + "/test_transport.html",
512
- onMessage: function(message, origin){
513
- if (++messages === 2) {
514
- scope.notifyResult(true);
515
- }
516
- },
517
- container: document.getElementById("embedded"),
518
- onReady: function(){
519
- scope.notifyResult(true);
520
- }
521
- });
522
- }
523
- }, {
524
- name: "message is echoed back",
525
- timeout: 5000,
526
- run: function(){
527
- this.transport.postMessage(this.expectedMessage);
528
- this.transport.postMessage(this.expectedMessage);
529
- }
530
- }]
531
- }, {
532
- name: "test easyXDM.Socket{HashTransport} with fragmentation (8192)",
533
- failedMessage: "This might fail in modern browsers due to restrictions in referencing existing windows",
534
- setUp: function(){
535
- var i = 11;
536
- this.expectedMessage = "aaaa";
537
- while (i--) {
538
- this.expectedMessage += this.expectedMessage;
539
- }
540
- },
541
- tearDown: function(){
542
- this.transport.destroy();
543
- if (document.getElementsByTagName("iframe").length !== 0) {
544
- throw new Error("iframe still present");
545
- }
546
- },
547
- steps: [{
548
- name: "onReady is fired",
549
- timeout: 5000,
550
- run: function(){
551
- var scope = this;
552
- this.transport = new easyXDM.Socket({
553
- protocol: "0", // This is just to override the automatic selection
554
- local: "../name.html",
555
- remote: REMOTE + "/test_transport.html",
556
- onMessage: function(message, origin){
557
- scope.notifyResult(scope.expectedMessage === message);
558
- },
559
- container: document.getElementById("embedded"),
560
- onReady: function(){
561
- scope.notifyResult(true);
562
- }
563
- });
564
- }
565
- }, {
566
- name: "message is echoed back",
567
- timeout: 5000,
568
- run: function(){
569
- this.transport.postMessage(this.expectedMessage);
570
- }
571
- }]
572
- }, {
573
- name: "test easyXDM.noConflict {SameOriginTransport}",
574
- setUp: function(){
575
- this.expectedMessage = ++i + "_abcd1234%@¤/";
576
- },
577
- steps: [{
578
- name: "window.easyXDM is released {namespace}",
579
- timeout: 5000,
580
- run: function(){
581
- this.notifyResult(window.easyXDM._test_global && !modules.easyXDM._test_global);
582
- }
583
- }, {
584
- name: "onReady is fired {namespace}",
585
- timeout: 5000,
586
- run: function(){
587
- var scope = this;
588
- var messages = 0;
589
- this.transport = new modules.easyXDM.Socket({
590
- protocol: "4",
591
- remote: LOCAL + "/test_namespace.html",
592
- onMessage: function(message, origin){
593
- if (scope.expectedMessage === message) {
594
- if (++messages === 2) {
595
- scope.notifyResult(true);
596
- }
597
- }
598
- },
599
- onReady: function(){
600
- scope.notifyResult(true);
601
- }
602
- });
603
- }
604
- }, {
605
- name: "message is echoed back {namespace}",
606
- timeout: 5000,
607
- run: function(){
608
- this.transport.postMessage(this.expectedMessage);
609
- this.transport.postMessage(this.expectedMessage);
610
- }
611
- }, {
612
- name: "destroy {namespace}",
613
- run: function(){
614
- this.transport.destroy();
615
- return ((document.getElementsByTagName("iframe").length === 0));
616
- }
617
- }]
618
- }, {
619
- name: "test easyXDM.Socket{}",
620
- setUp: function(){
621
- this.expectedMessage = ++i + "_abcd1234%@¤/";
622
- },
623
- tearDown: function(){
624
- this.transport.destroy();
625
- if (document.getElementsByTagName("iframe").length !== 0) {
626
- throw new Error("iframe still present");
627
- }
628
- },
629
- steps: [{
630
- name: "onReady is fired",
631
- timeout: 5000,
632
- run: function(){
633
- var scope = this;
634
- this.transport = new easyXDM.Socket({
635
- local: "../name.html",
636
- swf: REMOTE + "/../easyxdm.swf",
637
- remote: REMOTE + "/test_transport.html",
638
- onMessage: function(message, origin){
639
- scope.notifyResult((scope.expectedMessage === message));
640
- },
641
- onReady: function(){
642
- scope.notifyResult(true);
643
- }
644
- });
645
- }
646
- }, {
647
- name: "message is echoed back",
648
- timeout: 5000,
649
- run: function(){
650
- this.transport.postMessage(this.expectedMessage);
651
- }
652
- }]
653
- }, {
654
- name: "test easyXDM.Socket{} using hash for passing data",
655
- setUp: function(){
656
- this.expectedMessage = ++i + "_abcd1234%@¤/";
657
- },
658
- tearDown: function(){
659
- this.transport.destroy();
660
- if (document.getElementsByTagName("iframe").length !== 0) {
661
- throw new Error("iframe still present");
662
- }
663
- },
664
- steps: [{
665
- name: "onReady is fired",
666
- timeout: 5000,
667
- run: function(){
668
- var scope = this;
669
- this.transport = new easyXDM.Socket({
670
- local: "../name.html",
671
- swf: REMOTE + "/../easyxdm.swf",
672
- remote: REMOTE + "/test_transport.html?foo=bar",
673
- hash: true,
674
- onMessage: function(message, origin){
675
- scope.notifyResult((scope.expectedMessage === message));
676
- },
677
- onReady: function(){
678
- scope.notifyResult(true);
679
- }
680
- });
681
- }
682
- }, {
683
- name: "message is echoed back",
684
- timeout: 5000,
685
- run: function(){
686
- this.transport.postMessage(this.expectedMessage);
687
- }
688
- }]
689
- }, {
690
- name: "test easyXDM.Socket{} with buffering",
691
- setUp: function(){
692
- this.expectedMessage = ++i + "_abcd1234%@¤/";
693
- },
694
- tearDown: function(){
695
- this.transport.destroy();
696
- if (document.getElementsByTagName("iframe").length !== 0) {
697
- throw new Error("iframe still present");
698
- }
699
- },
700
- steps: [{
701
- name: "Buffered messages are sent",
702
- timeout: 5000,
703
- run: function(){
704
- var scope = this;
705
- this.transport = new easyXDM.Socket({
706
- local: "../name.html",
707
- swf: REMOTE + "/../easyxdm.swf",
708
- remote: REMOTE + "/test_transport.html",
709
- onMessage: function(message, origin){
710
- scope.notifyResult((scope.expectedMessage === message));
711
- }
712
- });
713
- this.transport.postMessage(this.expectedMessage);
714
- }
715
- }]
716
- }, {
717
- name: "test easyXDM.Socket{} with query parameters",
718
- setUp: function(){
719
- this.expectedMessage = ++i + "_abcd1234%@¤/";
720
- },
721
- tearDown: function(){
722
- this.transport.destroy();
723
- if (document.getElementsByTagName("iframe").length !== 0) {
724
- throw new Error("iframe still present");
725
- }
726
- },
727
- steps: [{
728
- name: "onReady is fired",
729
- timeout: 5000,
730
- run: function(){
731
- var scope = this;
732
- this.transport = new easyXDM.Socket({
733
- local: "../name.html",
734
- swf: REMOTE + "/../easyxdm.swf",
735
- remote: REMOTE + "/test_transport.html?a=b&c=d#foo,faa",
736
- onMessage: function(message, origin){
737
- scope.notifyResult((scope.expectedMessage === message));
738
- },
739
- onReady: function(){
740
- scope.notifyResult(true);
741
- }
742
- });
743
- }
744
- }, {
745
- name: "message is echoed back",
746
- timeout: 5000,
747
- run: function(){
748
- this.transport.postMessage(this.expectedMessage);
749
- }
750
- }]
751
- }, {
752
- name: "test easyXDM.Rpc",
753
- setUp: function(){
754
- this.expectedMessage = ++i + "_abcd1234%@¤/";
755
- },
756
- tearDown: function(){
757
- this.remote.destroy();
758
- if (document.getElementsByTagName("iframe").length !== 0) {
759
- throw new Error("iframe still present");
760
- }
761
- },
762
- steps: [{
763
- name: "onReady is fired",
764
- timeout: 5000,
765
- run: function(){
766
- var scope = this;
767
- this.remote = new easyXDM.Rpc({
768
- local: "../name.html",
769
- swf: REMOTE + "/../easyxdm.swf",
770
- remote: REMOTE + "/test_rpc.html",
771
- remoteHelper: REMOTE + "/../name.html",
772
- container: document.getElementById("embedded"),
773
- onReady: function(){
774
- scope.notifyResult(true);
775
- }
776
- }, {
777
- remote: {
778
- voidMethod: {},
779
- asyncMethod: {},
780
- method: {},
781
- error: {},
782
- nonexistent: {},
783
- namedParamsMethod: {
784
- namedParams: true
785
- }
786
- },
787
- local: {
788
- voidCallback: {
789
- method: function(message){
790
- scope.notifyResult((scope.expectedMessage === message));
791
- }
792
- }
793
- }
794
- });
795
- }
796
- }, {
797
- name: "void method",
798
- timeout: 5000,
799
- run: function(){
800
- this.remote.voidMethod(this.expectedMessage);
801
- }
802
- }, {
803
- name: "async method",
804
- timeout: 5000,
805
- run: function(){
806
- var scope = this;
807
- this.remote.asyncMethod(this.expectedMessage, function(message){
808
- scope.notifyResult((scope.expectedMessage === message));
809
- });
810
- }
811
- }, {
812
- name: "regular method",
813
- timeout: 5000,
814
- run: function(){
815
- var scope = this;
816
- this.remote.method(this.expectedMessage, function(message){
817
- scope.notifyResult((scope.expectedMessage === message));
818
- });
819
- }
820
- }, {
821
- name: "with error",
822
- timeout: 5000,
823
- run: function(){
824
- var scope = this;
825
- this.remote.error(this.expectedMessage, function(){
826
- this.notifyResult(false, "success handler called");
827
- }, function(message){
828
- scope.notifyResult(true);
829
- });
830
- }
831
- }, {
832
- name: "calling nonexistent method",
833
- timeout: 5000,
834
- run: function(){
835
- var scope = this;
836
- this.remote.nonexistent(this.expectedMessage, function(){
837
- this.notifyResult(false, "success handler called");
838
- }, function(message){
839
- scope.notifyResult(true);
840
- });
841
- }
842
- }, {
843
- name: "using named parameters",
844
- timeout: 5000,
845
- run: function(){
846
- var scope = this;
847
- this.remote.namedParamsMethod({
848
- msg: this.expectedMessage
849
- }, function(message){
850
- scope.notifyResult((scope.expectedMessage === message));
851
- });
852
- }
853
- }]
854
- }]);
855
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BluePay_Echeck</name>
4
- <version>1.5.0.5</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>E-check payment module for the BluePay gateway.</summary>
10
  <description>E-check payment module for the BluePay gateway.</description>
11
- <notes>Fixed missing file error.</notes>
12
- <authors><author><name>Justin Slingerland</name><user>auto-converted</user><email>jslingerland@bluepay.com</email></author></authors>
13
- <date>2013-07-15</date>
14
- <time>14:51:02</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="BluePay_Echeck.xml" hash="252f244ae4f8cba53f883559a23273c7"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluepay_echeck.xml" hash="e23ad07177a15b46dd550ebfe39e4d79"/></dir><dir name="template"><dir name="bluepay"><file name="echeck_form.phtml" hash="00d42bc0b3e09b9a2a287a2ee8305b65"/><file name="echeckiframe.phtml" hash="59436bef6158dbd19d81daf8dcdfd157"/><file name="echeck.phtml" hash="9fafb7aedbd119d560e46924ee051616"/><file name="buttonach.phtml" hash="b2442203bae192765c52c354a4207161"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="bluepay_echeck"><dir name="easyXDM"><dir name="src"><dir name="cors"><file name="index.html" hash="434ef438945549c0d7c409af673d2a1a"/></dir><dir name="example"><file name="blank.html" hash="22792ddd07b8c6bd8abd76b44ecc6b7c"/><file name="bookmark.html" hash="8d48a961c6950b0f7a02f9397facbe04"/><file name="bookmark.js" hash="4242dc70ceb11dead9a8f8b613ef52a7"/><file name="bridge.html" hash="88e734e12128a479d110fb3196701c7a"/><file name="data.html" hash="da3b47722ad28ddc40c97ee42537674f"/><file name="glossary.aspx" hash="51c2e94b820904ba7700439956e535bf"/><file name="index.html" hash="fa3c8ee571f4c508831215f46b739dad"/><file name="methods.html" hash="ba54a5968d1bbc0dae298f324bf503fc"/><file name="remote.html" hash="38ae904efc45e110779603f94644e538"/><file name="remoteapp.html" hash="083dfb1db046e2692af935cac910e17b"/><file name="remotedata.html" hash="31719cee4f7c05ace7d86084d21832fe"/><file name="remotemethods.html" hash="d16fb44407e2ef5bd4605347577bdbf1"/><file name="remoterpcbackend.html" hash="9f6fb71bcc84ebf93d13dbd33a9d01e4"/><file name="remotetransport.html" hash="ca9118fd111a06b25ee286f61a149e95"/><file name="resize_iframe.html" hash="6bf28e01739129d543070ec2a8f9d2b4"/><file name="resize_intermediate.html" hash="8feba05256c7c7274d74b6bddcbdccdc"/><file name="resized_iframe_1.html" hash="8bfca68983150720a3f1b4739b7e5d16"/><file name="resized_iframe_2.html" hash="af9eeb7bede59b1f3486a10709fc8ad1"/><file name="transport.html" hash="96cf3a46b5d7418419372f71c96fd1db"/><file name="upload.html" hash="bf723158563f1262e06886287b3ef20c"/><file name="upload_handler.aspx" hash="30e7428e70ea9174bae8ac02a55d63fe"/><file name="upload_rpc.html" hash="910ac3dc719d984b7fb61d8b459a7211"/><file name="widget.html" hash="e92651ada293e2adc01c5548afdbcc8c"/><file name="widgets.html" hash="f7e6027d67cc801e3855ec666f2fbb13"/><file name="xhr.html" hash="d72b93336f6e7a3e7d653ecc8101c184"/></dir><dir name="flash"><dir name="net.easyxdm.flash"><file name="Main.as" hash="382737566aa46ce745885ad84142ffab"/><file name="net.easyxdm.flash.as2proj" hash="c9aae8499e391430e2317de43d9353aa"/></dir><dir name="test"><file name="doma.html" hash="2fbe3de760c4e793375277883e7b674e"/><file name="domb.html" hash="ee598b668f8df3868a9d54bf1b5b053e"/></dir></dir><dir name="stack"><file name="FlashTransport.js" hash="7234e8f51a4a286cb642cec34c27b47a"/><file name="FrameElementTransport.js" hash="0d193a2c5bfdf905a42314cb4a86b3e3"/><file name="HashTransport.js" hash="3cffc3aff15b7ec8b54a32d1426a92a5"/><file name="NameTransport.js" hash="9c6c817bda6e314684d4a1560d452be9"/><file name="PostMessageTransport.js" hash="9333ea86295a69116bade2d4722509ac"/><file name="QueueBehavior.js" hash="3875fb211096525006141873ab461634"/><file name="ReliableBehavior.js" hash="2dc443ed907cef84462be24f30e8867a"/><file name="RpcBehavior.js" hash="5ded6a538029b5277f42940dc0949c6e"/><file name="SameOriginTransport.js" hash="1b45b42dc9f7cafcfe1380d7c7b4019e"/><file name="VerifyBehavior.js" hash="1d7415efd7db41782da1c5acee99d301"/></dir><dir name="tests"><file name="consumer.html" hash="617bb4ae138d54d79ffcc4dffce87d43"/><file name="easyTest.css" hash="077cc3e4e56a3c485593174d05d7eb34"/><file name="easyTest.js" hash="d5e74d1fc4b2cf88e475e2c8b6180529"/><file name="index.html" hash="2f17bbd8ebb45ec25cb366ccb08339d6"/><file name="provider.html" hash="800ddf493ab4ee6a063a018f261d0929"/><file name="s.gif" hash="fc94fb0c3ed8a8f909dbc7630a0987ff"/><file name="test.html" hash="7ce7fc1ded35157c6eeb1a9e4dcd782c"/><file name="test_namespace.html" hash="3f0abb81891337b8a3e94e45cc4cc2fa"/><file name="test_rpc.html" hash="be5782eed1e18e10481a8fbe9c684da9"/><file name="test_transport.html" hash="0e5fa3a864eeaa28eaa5de10b120c3ac"/><file name="tests.js" hash="e97f62c885cc0d37c4ca0a4ad5fd6a8a"/><file name=".consumer.html.swp" hash="1ffb98a07b5acc51df056e10ec61c6c9"/></dir><dir name="widgets"><file name="Widgets.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/></dir><file name="Core.js" hash="a2717be4a3038bbc3bf5b98b4434d219"/><file name="Debug.js" hash="ed8cfdba34e819db2c5124bd4e865c03"/><file name="DomHelper.js" hash="c22833c76b83d3ce0bc07575fdbd9836"/><file name="Fn.js" hash="a97b2ceda8ff15321a2b004cf1e465b0"/><file name="Rpc.js" hash="828344392f5b4bf9276bcabccab91282"/><file name="Socket.js" hash="606ebf311308d3c58fde259757ef392b"/><file name="begin_scope.txt" hash="1d8245fc72b96929717a5d31ef22a84f"/><file name="changes.html" hash="cb82cd0fa76f4135fb99bb13e4f1dd90"/><file name="easyXDM.debug.js" hash="a4288de0ebec63e9f7e2197068514b9c"/><file name="easyxdm.swf" hash="6bf187bfdab8cf9d8f09dd48b64c2b85"/><file name="end_scope.txt" hash="6d2bfb32aba44210e9ab43a5a972b99b"/><file name="header.html" hash="a8a6ddf415f540d26ded7441cfd8194d"/><file name="header.js" hash="230ebaaf245cf95dbbd953eba9702d13"/><file name="name.html" hash="990620350432f6c7e28f1e111ce598c8"/><file name="resources.txt" hash="3e891c0540a0ab241243e6e6514d3bd9"/></dir><file name=".gitignore" hash="f256c78995e7e95eb33afc3cee8ff195"/></dir><file name="bluepay.js" hash="4ea4ad2ea996eb112568770504d7a2b9"/></dir></dir></target><target name="magelocal"><dir name="BluePay"><dir name="Echeck"><dir name="Block"><dir name="Form"><file name="Echeck.php" hash="8923468466074253526500bd4fabe2e2"/></dir><dir name="Info"><file name="Echeck.php" hash="76a035e618edbcd0463db55f26ce3cb1"/></dir><file name="Form.php" hash="e3de4548b513596b1a218ce261c2328f"/><file name="Info.php" hash="de65c278c010d85d67e5b1ae031a1c28"/></dir><dir name="Helper"><file name="Data.php" hash="8f64e111734ce162a0d0b28ebad1db90"/></dir><dir name="Model"><dir name="EcheckPayment"><dir name="Source"><file name="Accounttypes.php" hash="3c8b8034d6c96b0280db4e7e595ab73c"/><file name="PaymentAction.php" hash="9da2c6580cfd6d611c207e5be3b2aea5"/></dir><file name="Debug.php" hash="76d8cb6c86a595b2b78d43664c6dd6e8"/><file name="Request.php" hash="0a65c3aae69eb0c196231cbf6f007cec"/><file name="Result.php" hash="6935ba845811c005b9c501a03891e33a"/></dir><dir name="Mysql4"><dir name="ECheckPayment"><dir name="Debug"><file name="Collection.php" hash="aa8222f78f17b4c35050c9d06dc085bc"/></dir><file name="Debug.php" hash="829e050092ffb527e08a6a9d9959374a"/></dir></dir><file name="Config.php" hash="94567f95c4463897ba822ca1c61dca7a"/><file name="EcheckPayment.php" hash="219af9bb2d3c725df9d61a6e4770bb97"/></dir><dir name="etc"><file name="config.xml" hash="bf862e0ba158cebf78b785c98cfdca3e"/><file name="system.xml" hash="b68b53fb8a301bc3f21b0cd0bd788ba1"/></dir><dir name="sql"><dir name="echeck_setup"><file name="mysql4-install-0.7.0.php" hash="8a9c16edd149e1e41c4015aeebb35892"/></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="TestmodeACH.php" hash="371db79c030d69b3b19fc4caac4e7ba0"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>BluePay_Echeck</name>
4
+ <version>1.5.0.6</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>E-check payment module for the BluePay gateway.</summary>
10
  <description>E-check payment module for the BluePay gateway.</description>
11
+ <notes>Fixed JS errors on checkout</notes>
12
+ <authors><author><name>Justin Slingerland</name><user>jslingerland</user><email>jslingerland@bluepay.com</email></author></authors>
13
+ <date>2014-09-04</date>
14
+ <time>16:56:26</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="BluePay_Echeck.xml" hash="252f244ae4f8cba53f883559a23273c7"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluepay_echeck.xml" hash="3cee814a8fe7c11cb7fe031896d4b9eb"/></dir><dir name="template"><dir name="bluepay"><file name="echeck_form.phtml" hash=""/><file name="echeckiframe.phtml" hash=""/><file name="echeck.phtml" hash=""/><file name="buttonach.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="bluepay_echeck"><file name="bluepay.js" hash="ec4e109ea21e525a890d219ff33e5820"/><dir name="easyXDM"><file name="easyXDM.Widgets.debug.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.js" hash="26b23561d39a64b926fe8dafea2f0a7b"/><file name="easyXDM.Widgets.min.js" hash="790f5fa04af75a8013d0ff5fd6dc770d"/><file name="easyXDM.debug.js" hash="2f74fa97b0aacdfb5e8570e381465905"/><file name="easyXDM.js" hash="499464a0c3d89679c11df6ee5d188df5"/><file name="easyXDM.min.js" hash="e3fd912457d7213fe5ccae7bf0fd0c82"/><file name="name.html" hash="990620350432f6c7e28f1e111ce598c8"/><file name=".gitignore" hash="f256c78995e7e95eb33afc3cee8ff195"/></dir></dir></dir></target><target name="magelocal"><dir name="BluePay"><dir name="Echeck"><dir name="Block"><dir name="Form"><file name="Echeck.php" hash="8923468466074253526500bd4fabe2e2"/></dir><file name="Form.php" hash="e3de4548b513596b1a218ce261c2328f"/><dir name="Info"><file name="Echeck.php" hash="76a035e618edbcd0463db55f26ce3cb1"/></dir><file name="Info.php" hash="de65c278c010d85d67e5b1ae031a1c28"/></dir><dir name="Helper"><file name="Data.php" hash="8f64e111734ce162a0d0b28ebad1db90"/></dir><dir name="Model"><file name="Config.php" hash="94567f95c4463897ba822ca1c61dca7a"/><dir name="EcheckPayment"><file name="Debug.php" hash="76d8cb6c86a595b2b78d43664c6dd6e8"/><file name="Request.php" hash="0a65c3aae69eb0c196231cbf6f007cec"/><file name="Result.php" hash="6935ba845811c005b9c501a03891e33a"/><dir name="Source"><file name="Accounttypes.php" hash="3c8b8034d6c96b0280db4e7e595ab73c"/><file name="PaymentAction.php" hash="9da2c6580cfd6d611c207e5be3b2aea5"/></dir></dir><file name="EcheckPayment.php" hash="219af9bb2d3c725df9d61a6e4770bb97"/><dir name="Mysql4"><dir name="ECheckPayment"><dir name="Debug"><file name="Collection.php" hash="aa8222f78f17b4c35050c9d06dc085bc"/></dir><file name="Debug.php" hash="829e050092ffb527e08a6a9d9959374a"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="bf862e0ba158cebf78b785c98cfdca3e"/><file name="system.xml" hash="b68b53fb8a301bc3f21b0cd0bd788ba1"/></dir><dir name="sql"><dir name="echeck_setup"><file name="mysql4-install-0.7.0.php" hash="8a9c16edd149e1e41c4015aeebb35892"/></dir></dir></dir></dir></target><target name="magecore"><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="TestmodeACH.php" hash="371db79c030d69b3b19fc4caac4e7ba0"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>5.4.15</max></php></required></dependencies>
18
  </package>