Altima_BetterCreditCardForm - Version 1.0.0

Version Notes

First preview release

Download this release

Release Info

Developer Alexander
Extension Altima_BetterCreditCardForm
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Altima/BetterCreditCardForm/Block/Bettercreditcardformjs.php ADDED
@@ -0,0 +1,80 @@
1
+ <?php
2
+
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ class Altima_BetterCreditCardForm_Block_BetterCreditCardFormjs extends Mage_Core_Block_Template {
22
+
23
+ public function _toHtml() {
24
+ $helper = Mage::helper('altima_bettercreditcardform');
25
+ $message = false;
26
+
27
+ $output = '
28
+ <script type="text/javascript">
29
+
30
+ jQuery("#checkout-payment-method-load").bind("DOMNodeInserted DOMNodeRemoved", function() {
31
+ if (!jQuery("div").is(".card-wrapper")) {
32
+ jQuery( "#payment_form_ccsave" ).prepend( "<div class=\'card-wrapper\'></div>" );
33
+ jQuery( "#payment_form_ccsave" ).append( "<input id=\'card-expiry\' name=\'card-expiry\' type=\'hidden\' />" );
34
+ var card_img = jQuery("#co-payment-form");
35
+ var card = new Card({
36
+ form: "#co-payment-form",
37
+ container: ".card-wrapper",
38
+ formSelectors: {
39
+ numberInput: "input#ccsave_cc_number",
40
+ expiryInput: "input#card-expiry",
41
+ cvcInput: "input#ccsave_cc_cid",
42
+ nameInput: "input#ccsave_cc_owner"
43
+ },
44
+ width: 200,
45
+ formatting: true,
46
+ debug: false
47
+ });
48
+ var exp_m = "**";
49
+ var exp_y = "**";
50
+ jQuery("#ccsave_expiration").change(function () {
51
+ jQuery( "select#ccsave_expiration option:selected" ).each(function() {
52
+ exp_m = jQuery( this ).val();
53
+ });
54
+
55
+ jQuery("input[name=\'card-expiry\']").val(exp_m+"/"+exp_y).change();
56
+ jQuery(".jp-card-expiry").html(exp_m+"/"+exp_y);
57
+ jQuery(".jp-card-expiry").addClass("jp-card-focused");
58
+ });
59
+
60
+ jQuery("#ccsave_expiration_yr").change(function () {
61
+ jQuery( "select#ccsave_expiration_yr option:selected" ).each(function() {
62
+ exp_y = jQuery( this ).val();
63
+ });
64
+
65
+ jQuery("input[name=\'card-expiry\']").val(exp_m+"/"+exp_y).change();
66
+ jQuery(".jp-card-expiry").html(exp_m+"/"+exp_y);
67
+ jQuery(".jp-card-expiry").addClass("jp-card-focused");
68
+ });
69
+
70
+ }
71
+ });
72
+
73
+ </script>
74
+ <script src="/js/altima/bettercreditcardform/jquery.card.js"></script>
75
+ ';
76
+
77
+ return $output;
78
+ }
79
+
80
+ }
app/code/local/Altima/BetterCreditCardForm/Helper/Data.php ADDED
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ class Altima_BetterCreditCardForm_Helper_Data extends Mage_Core_Helper_Abstract {
22
+
23
+ public function getEnabled() {
24
+ return Mage::getStoreConfig('altima_bettercreditcardform/general/enabled');
25
+ }
26
+
27
+ }
app/code/local/Altima/BetterCreditCardForm/Model/Layout/Generate/Observer.php ADDED
@@ -0,0 +1,48 @@
1
+ <?php
2
+
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ class Altima_BetterCreditCardForm_Model_Layout_Generate_Observer {
22
+
23
+ public function __construct() {
24
+
25
+ }
26
+
27
+ public function includeJavascripts($observer) {
28
+
29
+ $helper = Mage::helper('altima_bettercreditcardform');
30
+ if ($helper->getEnabled()) {
31
+
32
+
33
+ $layout = Mage::app()->getLayout();
34
+ $content = $layout->getBlock('footer');
35
+
36
+ $_head = $layout->getBlock('head');
37
+ if ($_head) {
38
+ $_head->addJs('altima/bettercreditcardform/check_jquery.js');
39
+ $_head->addJs('altima/bettercreditcardform/jquery.noconflict.js');
40
+ }
41
+ if ($content = $layout->getBlock('footer')) {
42
+ $block = $layout->createBlock('altima_bettercreditcardform/bettercreditcardformjs');
43
+ $content->insert($block);
44
+ }
45
+ }
46
+ }
47
+
48
+ }
app/code/local/Altima/BetterCreditCardForm/controllers/Adminhtml/BettercreditcartformController.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+
3
+ /**
4
+ * Altima BetterCreditCardForm Conversion Optimisation Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ class Altima_BetterCreditCardForm_Adminhtml_BetterCreditCardFormController extends Mage_Adminhtml_Controller_Action {
22
+
23
+ protected function _construct() {
24
+ $this->setUsedModuleName('Altima_BetterCreditCardForm');
25
+ }
26
+
27
+ public function indexAction() {
28
+ $this->loadLayout()->renderLayout();
29
+ }
30
+
31
+ protected function _isAllowed() {
32
+ return Mage::getSingleton('admin/session')->isAllowed('altima_bettercreditcardform/bettercreditcardform');
33
+ }
34
+
35
+ }
app/code/local/Altima/BetterCreditCardForm/etc/config.xml ADDED
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Altima_BetterCreditCardForm>
25
+ <version>1.0.0</version>
26
+ </Altima_BetterCreditCardForm>
27
+ </modules>
28
+ <global>
29
+ <models>
30
+ <altima_bettercreditcardform>
31
+ <class>Altima_BetterCreditCardForm_Model</class>
32
+ </altima_bettercreditcardform>
33
+ </models>
34
+ <extraconfig />
35
+ <blocks>
36
+ <altima_bettercreditcardform>
37
+ <class>Altima_BetterCreditCardForm_Block</class>
38
+ </altima_bettercreditcardform>
39
+ </blocks>
40
+ <resources>
41
+ <altima_bettercreditcardform_setup>
42
+ <setup>
43
+ <module>Altima_BetterCreditCardForm</module>
44
+ </setup>
45
+ <connection>
46
+ <use>core_setup</use>
47
+ </connection>
48
+ </altima_bettercreditcardform_setup>
49
+ <altima_bettercreditcardform_write>
50
+ <connection>
51
+ <use>core_write</use>
52
+ </connection>
53
+ </altima_bettercreditcardform_write>
54
+ <altima_bettercreditcardform_read>
55
+ <connection>
56
+ <use>core_read</use>
57
+ </connection>
58
+ </altima_bettercreditcardform_read>
59
+ </resources>
60
+ <helpers>
61
+ <altima_bettercreditcardform>
62
+ <class>Altima_BetterCreditCardForm_Helper</class>
63
+ </altima_bettercreditcardform>
64
+ </helpers>
65
+ <events>
66
+ <controller_action_layout_render_before_checkout_onepage_index>
67
+ <observers>
68
+ <bettercreditcardform_layout_generate_observer>
69
+ <type>singleton</type>
70
+ <class>altima_bettercreditcardform/layout_generate_observer</class>
71
+ <method>includeJavascripts</method>
72
+ </bettercreditcardform_layout_generate_observer>
73
+ </observers>
74
+ </controller_action_layout_render_before_checkout_onepage_index>
75
+ </events>
76
+ </global>
77
+ <adminhtml>
78
+ <acl>
79
+ <resources>
80
+ <admin>
81
+ <children>
82
+ <system>
83
+ <children>
84
+ <config>
85
+ <children>
86
+ <altima_bettercreditcardform>
87
+ <title>BetterCreditCartForm section</title>
88
+ </altima_bettercreditcardform>
89
+ </children>
90
+ </config>
91
+ </children>
92
+ </system>
93
+ </children>
94
+ </admin>
95
+ </resources>
96
+ </acl>
97
+ </adminhtml>
98
+ <admin>
99
+ <routers>
100
+ <adminhtml>
101
+ <args>
102
+ <modules>
103
+ <Altima_BetterCreditCardForm before="Mage_Adminhtml">Altima_BetterCreditCartForm_Adminhtml</Altima_BetterCreditCardForm>
104
+ </modules>
105
+ </args>
106
+ </adminhtml>
107
+ </routers>
108
+ </admin>
109
+ </config>
app/code/local/Altima/BetterCreditCardForm/etc/system.xml ADDED
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <tabs>
24
+ <altima translate="label comment" module="altima_bettercreditcardform">
25
+ <label>Altima</label>
26
+ <sort_order>500</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </altima>
31
+ </tabs>
32
+ <sections>
33
+ <altima_bettercreditcardform translate="label comment" module="altima_bettercreditcardform">
34
+ <tab>altima</tab>
35
+ <label>Better Credit Card Form</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>600</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ <groups>
42
+ <general translate="label comment" module="altima_bettercreditcardform">
43
+ <label>General Settings</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>10</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <fields>
50
+ <enabled translate="label">
51
+ <label>Enabled</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>adminhtml/system_config_source_yesno</source_model>
54
+ <sort_order>10</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </enabled>
59
+ </fields>
60
+ </general>
61
+ </groups>
62
+ </altima_bettercreditcardform>
63
+ </sections>
64
+ </config>
app/code/local/Altima/BetterCreditCardForm/sql/altima_bettercreditcardform_setup/install-1.0.0.php ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ $this->startSetup();
22
+ $this->endSetup();
app/etc/modules/Altima_BetterCreditCardForm.xml ADDED
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Altima Better Credit Card Form Extension
5
+ *
6
+ * Altima web systems.
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the EULA
11
+ * that is available through the world-wide-web at this URL:
12
+ * http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
13
+ *
14
+ * @category Altima
15
+ * @package Altima_BetterCreditCardForm
16
+ * @author Altima Web Systems http://altimawebsystems.com/
17
+ * @license http://blog.altima.net.au/lookbook-magento-extension/lookbook-professional-licence/
18
+ * @email support@altima.net.au
19
+ * @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Altima_BetterCreditCardForm>
25
+ <active>true</active>
26
+ <codePool>local</codePool>
27
+ <depends>
28
+ <Mage_Catalog />
29
+ </depends>
30
+ </Altima_BetterCreditCardForm>
31
+ </modules>
32
+ </config>
app/locale/en_US/Altima_BetterCreditCardForm.csv ADDED
@@ -0,0 +1,43 @@
1
+ "",""
2
+ "Action","Action"
3
+ "An error occurred while updating the Better credit cart form.","An error occurred while updating the Better credit cart form."
4
+ "Are you sure?","Are you sure?"
5
+ "Change status","Change status"
6
+ "Could not find Extension to delete.","Could not find Extension to delete."
7
+ "Created at","Created at"
8
+ "Declare attribute value saving scope","Declare attribute value saving scope"
9
+ "Default Values","Default Values"
10
+ "Delete File","Delete File"
11
+ "Delete Extension","Delete Extension"
12
+ "Delete","Delete"
13
+ "Disabled","Disabled"
14
+ "Edit","Edit"
15
+ "Enable WYSIWYG","Enable WYSIWYG"
16
+ "Enabled","Enabled"
17
+ "Error saving","Error saving"
18
+ "File","File"
19
+ "Frontend Properties","Frontend Properties"
20
+ "Global","Global"
21
+ "Home","Home"
22
+ "Id","Id"
23
+ "Image","Image"
24
+ "No","No"
25
+ "None","None"
26
+ "Note","Note"
27
+ "Better Credit Card Form","Better Credit Card Form"
28
+ "Position in the admin form","Position in the admin form"
29
+ "Position","Position"
30
+ "Properties","Properties"
31
+ "Reset","Reset"
32
+ "Save And Continue Edit","Save And Continue Edit"
33
+ "Scope","Scope"
34
+ "Status","Status"
35
+ "Store View","Store View"
36
+ "Store views","Store views"
37
+ "Text to appear below the input.","Text to appear below the input."
38
+ "Updated at","Updated at"
39
+ "Website","Website"
40
+ "Yes","Yes"
41
+ "[GLOBAL]","[GLOBAL]"
42
+ "[STORE VIEW]","[STORE VIEW]"
43
+ "[WEBSITE]","[WEBSITE]"
js/altima/bettercreditcardform/card.js ADDED
@@ -0,0 +1,1980 @@
1
+ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.card=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
2
+ module.exports = _dereq_('./lib/extend');
3
+
4
+
5
+ },{"./lib/extend":2}],2:[function(_dereq_,module,exports){
6
+ /*!
7
+ * node.extend
8
+ * Copyright 2011, John Resig
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ * http://jquery.org/license
11
+ *
12
+ * @fileoverview
13
+ * Port of jQuery.extend that actually works on node.js
14
+ */
15
+ var is = _dereq_('is');
16
+
17
+ function extend() {
18
+ var target = arguments[0] || {};
19
+ var i = 1;
20
+ var length = arguments.length;
21
+ var deep = false;
22
+ var options, name, src, copy, copy_is_array, clone;
23
+
24
+ // Handle a deep copy situation
25
+ if (typeof target === 'boolean') {
26
+ deep = target;
27
+ target = arguments[1] || {};
28
+ // skip the boolean and the target
29
+ i = 2;
30
+ }
31
+
32
+ // Handle case when target is a string or something (possible in deep copy)
33
+ if (typeof target !== 'object' && !is.fn(target)) {
34
+ target = {};
35
+ }
36
+
37
+ for (; i < length; i++) {
38
+ // Only deal with non-null/undefined values
39
+ options = arguments[i]
40
+ if (options != null) {
41
+ if (typeof options === 'string') {
42
+ options = options.split('');
43
+ }
44
+ // Extend the base object
45
+ for (name in options) {
46
+ src = target[name];
47
+ copy = options[name];
48
+
49
+ // Prevent never-ending loop
50
+ if (target === copy) {
51
+ continue;
52
+ }
53
+
54
+ // Recurse if we're merging plain objects or arrays
55
+ if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
56
+ if (copy_is_array) {
57
+ copy_is_array = false;
58
+ clone = src && is.array(src) ? src : [];
59
+ } else {
60
+ clone = src && is.hash(src) ? src : {};
61
+ }
62
+
63
+ // Never move original objects, clone them
64
+ target[name] = extend(deep, clone, copy);
65
+
66
+ // Don't bring in undefined values
67
+ } else if (typeof copy !== 'undefined') {
68
+ target[name] = copy;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // Return the modified object
75
+ return target;
76
+ };
77
+
78
+ /**
79
+ * @public
80
+ */
81
+ extend.version = '1.0.8';
82
+
83
+ /**
84
+ * Exports module.
85
+ */
86
+ module.exports = extend;
87
+
88
+
89
+ },{"is":3}],3:[function(_dereq_,module,exports){
90
+
91
+ /**!
92
+ * is
93
+ * the definitive JavaScript type testing library
94
+ *
95
+ * @copyright 2013-2014 Enrico Marino / Jordan Harband
96
+ * @license MIT
97
+ */
98
+
99
+ var objProto = Object.prototype;
100
+ var owns = objProto.hasOwnProperty;
101
+ var toString = objProto.toString;
102
+ var isActualNaN = function (value) {
103
+ return value !== value;
104
+ };
105
+ var NON_HOST_TYPES = {
106
+ boolean: 1,
107
+ number: 1,
108
+ string: 1,
109
+ undefined: 1
110
+ };
111
+
112
+ var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)#x2F;;
113
+ var hexRegex = /^[A-Fa-f0-9]+#x2F;;
114
+
115
+ /**
116
+ * Expose `is`
117
+ */
118
+
119
+ var is = module.exports = {};
120
+
121
+ /**
122
+ * Test general.
123
+ */
124
+
125
+ /**
126
+ * is.type
127
+ * Test if `value` is a type of `type`.
128
+ *
129
+ * @param {Mixed} value value to test
130
+ * @param {String} type type
131
+ * @return {Boolean} true if `value` is a type of `type`, false otherwise
132
+ * @api public
133
+ */
134
+
135
+ is.a = is.type = function (value, type) {
136
+ return typeof value === type;
137
+ };
138
+
139
+ /**
140
+ * is.defined
141
+ * Test if `value` is defined.
142
+ *
143
+ * @param {Mixed} value value to test
144
+ * @return {Boolean} true if 'value' is defined, false otherwise
145
+ * @api public
146
+ */
147
+
148
+ is.defined = function (value) {
149
+ return typeof value !== 'undefined';
150
+ };
151
+
152
+ /**
153
+ * is.empty
154
+ * Test if `value` is empty.
155
+ *
156
+ * @param {Mixed} value value to test
157
+ * @return {Boolean} true if `value` is empty, false otherwise
158
+ * @api public
159
+ */
160
+
161
+ is.empty = function (value) {
162
+ var type = toString.call(value);
163
+ var key;
164
+
165
+ if ('[object Array]' === type || '[object Arguments]' === type || '[object String]' === type) {
166
+ return value.length === 0;
167
+ }
168
+
169
+ if ('[object Object]' === type) {
170
+ for (key in value) {
171
+ if (owns.call(value, key)) { return false; }
172
+ }
173
+ return true;
174
+ }
175
+
176
+ return false;
177
+ };
178
+
179
+ /**
180
+ * is.equal
181
+ * Test if `value` is equal to `other`.
182
+ *
183
+ * @param {Mixed} value value to test
184
+ * @param {Mixed} other value to compare with
185
+ * @return {Boolean} true if `value` is equal to `other`, false otherwise
186
+ */
187
+
188
+ is.equal = function (value, other) {
189
+ var strictlyEqual = value === other;
190
+ if (strictlyEqual) {
191
+ return true;
192
+ }
193
+
194
+ var type = toString.call(value);
195
+ var key;
196
+
197
+ if (type !== toString.call(other)) {
198
+ return false;
199
+ }
200
+
201
+ if ('[object Object]' === type) {
202
+ for (key in value) {
203
+ if (!is.equal(value[key], other[key]) || !(key in other)) {
204
+ return false;
205
+ }
206
+ }
207
+ for (key in other) {
208
+ if (!is.equal(value[key], other[key]) || !(key in value)) {
209
+ return false;
210
+ }
211
+ }
212
+ return true;
213
+ }
214
+
215
+ if ('[object Array]' === type) {
216
+ key = value.length;
217
+ if (key !== other.length) {
218
+ return false;
219
+ }
220
+ while (--key) {
221
+ if (!is.equal(value[key], other[key])) {
222
+ return false;
223
+ }
224
+ }
225
+ return true;
226
+ }
227
+
228
+ if ('[object Function]' === type) {
229
+ return value.prototype === other.prototype;
230
+ }
231
+
232
+ if ('[object Date]' === type) {
233
+ return value.getTime() === other.getTime();
234
+ }
235
+
236
+ return strictlyEqual;
237
+ };
238
+
239
+ /**
240
+ * is.hosted
241
+ * Test if `value` is hosted by `host`.
242
+ *
243
+ * @param {Mixed} value to test
244
+ * @param {Mixed} host host to test with
245
+ * @return {Boolean} true if `value` is hosted by `host`, false otherwise
246
+ * @api public
247
+ */
248
+
249
+ is.hosted = function (value, host) {
250
+ var type = typeof host[value];
251
+ return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
252
+ };
253
+
254
+ /**
255
+ * is.instance
256
+ * Test if `value` is an instance of `constructor`.
257
+ *
258
+ * @param {Mixed} value value to test
259
+ * @return {Boolean} true if `value` is an instance of `constructor`
260
+ * @api public
261
+ */
262
+
263
+ is.instance = is['instanceof'] = function (value, constructor) {
264
+ return value instanceof constructor;
265
+ };
266
+
267
+ /**
268
+ * is.nil / is.null
269
+ * Test if `value` is null.
270
+ *
271
+ * @param {Mixed} value value to test
272
+ * @return {Boolean} true if `value` is null, false otherwise
273
+ * @api public
274
+ */
275
+
276
+ is.nil = is['null'] = function (value) {
277
+ return value === null;
278
+ };
279
+
280
+ /**
281
+ * is.undef / is.undefined
282
+ * Test if `value` is undefined.
283
+ *
284
+ * @param {Mixed} value value to test
285
+ * @return {Boolean} true if `value` is undefined, false otherwise
286
+ * @api public
287
+ */
288
+
289
+ is.undef = is['undefined'] = function (value) {
290
+ return typeof value === 'undefined';
291
+ };
292
+
293
+ /**
294
+ * Test arguments.
295
+ */
296
+
297
+ /**
298
+ * is.args
299
+ * Test if `value` is an arguments object.
300
+ *
301
+ * @param {Mixed} value value to test
302
+ * @return {Boolean} true if `value` is an arguments object, false otherwise
303
+ * @api public
304
+ */
305
+
306
+ is.args = is['arguments'] = function (value) {
307
+ var isStandardArguments = '[object Arguments]' === toString.call(value);
308
+ var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
309
+ return isStandardArguments || isOldArguments;
310
+ };
311
+
312
+ /**
313
+ * Test array.
314
+ */
315
+
316
+ /**
317
+ * is.array
318
+ * Test if 'value' is an array.
319
+ *
320
+ * @param {Mixed} value value to test
321
+ * @return {Boolean} true if `value` is an array, false otherwise
322
+ * @api public
323
+ */
324
+
325
+ is.array = function (value) {
326
+ return '[object Array]' === toString.call(value);
327
+ };
328
+
329
+ /**
330
+ * is.arguments.empty
331
+ * Test if `value` is an empty arguments object.
332
+ *
333
+ * @param {Mixed} value value to test
334
+ * @return {Boolean} true if `value` is an empty arguments object, false otherwise
335
+ * @api public
336
+ */
337
+ is.args.empty = function (value) {
338
+ return is.args(value) && value.length === 0;
339
+ };
340
+
341
+ /**
342
+ * is.array.empty
343
+ * Test if `value` is an empty array.
344
+ *
345
+ * @param {Mixed} value value to test
346
+ * @return {Boolean} true if `value` is an empty array, false otherwise
347
+ * @api public
348
+ */
349
+ is.array.empty = function (value) {
350
+ return is.array(value) && value.length === 0;
351
+ };
352
+
353
+ /**
354
+ * is.arraylike
355
+ * Test if `value` is an arraylike object.
356
+ *
357
+ * @param {Mixed} value value to test
358
+ * @return {Boolean} true if `value` is an arguments object, false otherwise
359
+ * @api public
360
+ */
361
+
362
+ is.arraylike = function (value) {
363
+ return !!value && !is.boolean(value)
364
+ && owns.call(value, 'length')
365
+ && isFinite(value.length)
366
+ && is.number(value.length)
367
+ && value.length >= 0;
368
+ };
369
+
370
+ /**
371
+ * Test boolean.
372
+ */
373
+
374
+ /**
375
+ * is.boolean
376
+ * Test if `value` is a boolean.
377
+ *
378
+ * @param {Mixed} value value to test
379
+ * @return {Boolean} true if `value` is a boolean, false otherwise
380
+ * @api public
381
+ */
382
+
383
+ is.boolean = function (value) {
384
+ return '[object Boolean]' === toString.call(value);
385
+ };
386
+
387
+ /**
388
+ * is.false
389
+ * Test if `value` is false.
390
+ *
391
+ * @param {Mixed} value value to test
392
+ * @return {Boolean} true if `value` is false, false otherwise
393
+ * @api public
394
+ */
395
+
396
+ is['false'] = function (value) {
397
+ return is.boolean(value) && Boolean(Number(value)) === false;
398
+ };
399
+
400
+ /**
401
+ * is.true
402
+ * Test if `value` is true.
403
+ *
404
+ * @param {Mixed} value value to test
405
+ * @return {Boolean} true if `value` is true, false otherwise
406
+ * @api public
407
+ */
408
+
409
+ is['true'] = function (value) {
410
+ return is.boolean(value) && Boolean(Number(value)) === true;
411
+ };
412
+
413
+ /**
414
+ * Test date.
415
+ */
416
+
417
+ /**
418
+ * is.date
419
+ * Test if `value` is a date.
420
+ *
421
+ * @param {Mixed} value value to test
422
+ * @return {Boolean} true if `value` is a date, false otherwise
423
+ * @api public
424
+ */
425
+
426
+ is.date = function (value) {
427
+ return '[object Date]' === toString.call(value);
428
+ };
429
+
430
+ /**
431
+ * Test element.
432
+ */
433
+
434
+ /**
435
+ * is.element
436
+ * Test if `value` is an html element.
437
+ *
438
+ * @param {Mixed} value value to test
439
+ * @return {Boolean} true if `value` is an HTML Element, false otherwise
440
+ * @api public
441
+ */
442
+
443
+ is.element = function (value) {
444
+ return value !== undefined
445
+ && typeof HTMLElement !== 'undefined'
446
+ && value instanceof HTMLElement
447
+ && value.nodeType === 1;
448
+ };
449
+
450
+ /**
451
+ * Test error.
452
+ */
453
+
454
+ /**
455
+ * is.error
456
+ * Test if `value` is an error object.
457
+ *
458
+ * @param {Mixed} value value to test
459
+ * @return {Boolean} true if `value` is an error object, false otherwise
460
+ * @api public
461
+ */
462
+
463
+ is.error = function (value) {
464
+ return '[object Error]' === toString.call(value);
465
+ };
466
+
467
+ /**
468
+ * Test function.
469
+ */
470
+
471
+ /**
472
+ * is.fn / is.function (deprecated)
473
+ * Test if `value` is a function.
474
+ *
475
+ * @param {Mixed} value value to test
476
+ * @return {Boolean} true if `value` is a function, false otherwise
477
+ * @api public
478
+ */
479
+
480
+ is.fn = is['function'] = function (value) {
481
+ var isAlert = typeof window !== 'undefined' && value === window.alert;
482
+ return isAlert || '[object Function]' === toString.call(value);
483
+ };
484
+
485
+ /**
486
+ * Test number.
487
+ */
488
+
489
+ /**
490
+ * is.number
491
+ * Test if `value` is a number.
492
+ *
493
+ * @param {Mixed} value value to test
494
+ * @return {Boolean} true if `value` is a number, false otherwise
495
+ * @api public
496
+ */
497
+
498
+ is.number = function (value) {
499
+ return '[object Number]' === toString.call(value);
500
+ };
501
+
502
+ /**
503
+ * is.infinite
504
+ * Test if `value` is positive or negative infinity.
505
+ *
506
+ * @param {Mixed} value value to test
507
+ * @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
508
+ * @api public
509
+ */
510
+ is.infinite = function (value) {
511
+ return value === Infinity || value === -Infinity;
512
+ };
513
+
514
+ /**
515
+ * is.decimal
516
+ * Test if `value` is a decimal number.
517
+ *
518
+ * @param {Mixed} value value to test
519
+ * @return {Boolean} true if `value` is a decimal number, false otherwise
520
+ * @api public
521
+ */
522
+
523
+ is.decimal = function (value) {
524
+ return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
525
+ };
526
+
527
+ /**
528
+ * is.divisibleBy
529
+ * Test if `value` is divisible by `n`.
530
+ *
531
+ * @param {Number} value value to test
532
+ * @param {Number} n dividend
533
+ * @return {Boolean} true if `value` is divisible by `n`, false otherwise
534
+ * @api public
535
+ */
536
+
537
+ is.divisibleBy = function (value, n) {
538
+ var isDividendInfinite = is.infinite(value);
539
+ var isDivisorInfinite = is.infinite(n);
540
+ var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
541
+ return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
542
+ };
543
+
544
+ /**
545
+ * is.int
546
+ * Test if `value` is an integer.
547
+ *
548
+ * @param value to test
549
+ * @return {Boolean} true if `value` is an integer, false otherwise
550
+ * @api public
551
+ */
552
+
553
+ is.int = function (value) {
554
+ return is.number(value) && !isActualNaN(value) && value % 1 === 0;
555
+ };
556
+
557
+ /**
558
+ * is.maximum
559
+ * Test if `value` is greater than 'others' values.
560
+ *
561
+ * @param {Number} value value to test
562
+ * @param {Array} others values to compare with
563
+ * @return {Boolean} true if `value` is greater than `others` values
564
+ * @api public
565
+ */
566
+
567
+ is.maximum = function (value, others) {
568
+ if (isActualNaN(value)) {
569
+ throw new TypeError('NaN is not a valid value');
570
+ } else if (!is.arraylike(others)) {
571
+ throw new TypeError('second argument must be array-like');
572
+ }
573
+ var len = others.length;
574
+
575
+ while (--len >= 0) {
576
+ if (value < others[len]) {
577
+ return false;
578
+ }
579
+ }
580
+
581
+ return true;
582
+ };
583
+
584
+ /**
585
+ * is.minimum
586
+ * Test if `value` is less than `others` values.
587
+ *
588
+ * @param {Number} value value to test
589
+ * @param {Array} others values to compare with
590
+ * @return {Boolean} true if `value` is less than `others` values
591
+ * @api public
592
+ */
593
+
594
+ is.minimum = function (value, others) {
595
+ if (isActualNaN(value)) {
596
+ throw new TypeError('NaN is not a valid value');
597
+ } else if (!is.arraylike(others)) {
598
+ throw new TypeError('second argument must be array-like');
599
+ }
600
+ var len = others.length;
601
+
602
+ while (--len >= 0) {
603
+ if (value > others[len]) {
604
+ return false;
605
+ }
606
+ }
607
+
608
+ return true;
609
+ };
610
+
611
+ /**
612
+ * is.nan
613
+ * Test if `value` is not a number.
614
+ *
615
+ * @param {Mixed} value value to test
616
+ * @return {Boolean} true if `value` is not a number, false otherwise
617
+ * @api public
618
+ */
619
+
620
+ is.nan = function (value) {
621
+ return !is.number(value) || value !== value;
622
+ };
623
+
624
+ /**
625
+ * is.even
626
+ * Test if `value` is an even number.
627
+ *
628
+ * @param {Number} value value to test
629
+ * @return {Boolean} true if `value` is an even number, false otherwise
630
+ * @api public
631
+ */
632
+
633
+ is.even = function (value) {
634
+ return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
635
+ };
636
+
637
+ /**
638
+ * is.odd
639
+ * Test if `value` is an odd number.
640
+ *
641
+ * @param {Number} value value to test
642
+ * @return {Boolean} true if `value` is an odd number, false otherwise
643
+ * @api public
644
+ */
645
+
646
+ is.odd = function (value) {
647
+ return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
648
+ };
649
+
650
+ /**
651
+ * is.ge
652
+ * Test if `value` is greater than or equal to `other`.
653
+ *
654
+ * @param {Number} value value to test
655
+ * @param {Number} other value to compare with
656
+ * @return {Boolean}
657
+ * @api public
658
+ */
659
+
660
+ is.ge = function (value, other) {
661
+ if (isActualNaN(value) || isActualNaN(other)) {
662
+ throw new TypeError('NaN is not a valid value');
663
+ }
664
+ return !is.infinite(value) && !is.infinite(other) && value >= other;
665
+ };
666
+
667
+ /**
668
+ * is.gt
669
+ * Test if `value` is greater than `other`.
670
+ *
671
+ * @param {Number} value value to test
672
+ * @param {Number} other value to compare with
673
+ * @return {Boolean}
674
+ * @api public
675
+ */
676
+
677
+ is.gt = function (value, other) {
678
+ if (isActualNaN(value) || isActualNaN(other)) {
679
+ throw new TypeError('NaN is not a valid value');
680
+ }
681
+ return !is.infinite(value) && !is.infinite(other) && value > other;
682
+ };
683
+
684
+ /**
685
+ * is.le
686
+ * Test if `value` is less than or equal to `other`.
687
+ *
688
+ * @param {Number} value value to test
689
+ * @param {Number} other value to compare with
690
+ * @return {Boolean} if 'value' is less than or equal to 'other'
691
+ * @api public
692
+ */
693
+
694
+ is.le = function (value, other) {
695
+ if (isActualNaN(value) || isActualNaN(other)) {
696
+ throw new TypeError('NaN is not a valid value');
697
+ }
698
+ return !is.infinite(value) && !is.infinite(other) && value <= other;
699
+ };
700
+
701
+ /**
702
+ * is.lt
703
+ * Test if `value` is less than `other`.
704
+ *
705
+ * @param {Number} value value to test
706
+ * @param {Number} other value to compare with
707
+ * @return {Boolean} if `value` is less than `other`
708
+ * @api public
709
+ */
710
+
711
+ is.lt = function (value, other) {
712
+ if (isActualNaN(value) || isActualNaN(other)) {
713
+ throw new TypeError('NaN is not a valid value');
714
+ }
715
+ return !is.infinite(value) && !is.infinite(other) && value < other;
716
+ };
717
+
718
+ /**
719
+ * is.within
720
+ * Test if `value` is within `start` and `finish`.
721
+ *
722
+ * @param {Number} value value to test
723
+ * @param {Number} start lower bound
724
+ * @param {Number} finish upper bound
725
+ * @return {Boolean} true if 'value' is is within 'start' and 'finish'
726
+ * @api public
727
+ */
728
+ is.within = function (value, start, finish) {
729
+ if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
730
+ throw new TypeError('NaN is not a valid value');
731
+ } else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
732
+ throw new TypeError('all arguments must be numbers');
733
+ }
734
+ var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
735
+ return isAnyInfinite || (value >= start && value <= finish);
736
+ };
737
+
738
+ /**
739
+ * Test object.
740
+ */
741
+
742
+ /**
743
+ * is.object
744
+ * Test if `value` is an object.
745
+ *
746
+ * @param {Mixed} value value to test
747
+ * @return {Boolean} true if `value` is an object, false otherwise
748
+ * @api public
749
+ */
750
+
751
+ is.object = function (value) {
752
+ return '[object Object]' === toString.call(value);
753
+ };
754
+
755
+ /**
756
+ * is.hash
757
+ * Test if `value` is a hash - a plain object literal.
758
+ *
759
+ * @param {Mixed} value value to test
760
+ * @return {Boolean} true if `value` is a hash, false otherwise
761
+ * @api public
762
+ */
763
+
764
+ is.hash = function (value) {
765
+ return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
766
+ };
767
+
768
+ /**
769
+ * Test regexp.
770
+ */
771
+
772
+ /**
773
+ * is.regexp
774
+ * Test if `value` is a regular expression.
775
+ *
776
+ * @param {Mixed} value value to test
777
+ * @return {Boolean} true if `value` is a regexp, false otherwise
778
+ * @api public
779
+ */
780
+
781
+ is.regexp = function (value) {
782
+ return '[object RegExp]' === toString.call(value);
783
+ };
784
+
785
+ /**
786
+ * Test string.
787
+ */
788
+
789
+ /**
790
+ * is.string
791
+ * Test if `value` is a string.
792
+ *
793
+ * @param {Mixed} value value to test
794
+ * @return {Boolean} true if 'value' is a string, false otherwise
795
+ * @api public
796
+ */
797
+
798
+ is.string = function (value) {
799
+ return '[object String]' === toString.call(value);
800
+ };
801
+
802
+ /**
803
+ * Test base64 string.
804
+ */
805
+
806
+ /**
807
+ * is.base64
808
+ * Test if `value` is a valid base64 encoded string.
809
+ *
810
+ * @param {Mixed} value value to test
811
+ * @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
812
+ * @api public
813
+ */
814
+
815
+ is.base64 = function (value) {
816
+ return is.string(value) && (!value.length || base64Regex.test(value));
817
+ };
818
+
819
+ /**
820
+ * Test base64 string.
821
+ */
822
+
823
+ /**
824
+ * is.hex
825
+ * Test if `value` is a valid hex encoded string.
826
+ *
827
+ * @param {Mixed} value value to test
828
+ * @return {Boolean} true if 'value' is a hex encoded string, false otherwise
829
+ * @api public
830
+ */
831
+
832
+ is.hex = function (value) {
833
+ return is.string(value) && (!value.length || hexRegex.test(value));
834
+ };
835
+
836
+ },{}],4:[function(_dereq_,module,exports){
837
+ (function (global){
838
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),(f.qj||(f.qj={})).js=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
839
+ var QJ, rreturn, rtrim;
840
+
841
+ QJ = function(selector) {
842
+ if (QJ.isDOMElement(selector)) {
843
+ return selector;
844
+ }
845
+ return document.querySelectorAll(selector);
846
+ };
847
+
848
+ QJ.isDOMElement = function(el) {
849
+ return el && (el.nodeName != null);
850
+ };
851
+
852
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+#x2F;g;
853
+
854
+ QJ.trim = function(text) {
855
+ if (text === null) {
856
+ return "";
857
+ } else {
858
+ return (text + "").replace(rtrim, "");
859
+ }
860
+ };
861
+
862
+ rreturn = /\r/g;
863
+
864
+ QJ.val = function(el, val) {
865
+ var ret;
866
+ if (arguments.length > 1) {
867
+ return el.value = val;
868
+ } else {
869
+ ret = el.value;
870
+ if (typeof ret === "string") {
871
+ return ret.replace(rreturn, "");
872
+ } else {
873
+ if (ret === null) {
874
+ return "";
875
+ } else {
876
+ return ret;
877
+ }
878
+ }
879
+ }
880
+ };
881
+
882
+ QJ.preventDefault = function(eventObject) {
883
+ if (typeof eventObject.preventDefault === "function") {
884
+ eventObject.preventDefault();
885
+ return;
886
+ }
887
+ eventObject.returnValue = false;
888
+ return false;
889
+ };
890
+
891
+ QJ.normalizeEvent = function(e) {
892
+ var original;
893
+ original = e;
894
+ e = {
895
+ which: original.which != null ? original.which : void 0,
896
+ target: original.target || original.srcElement,
897
+ preventDefault: function() {
898
+ return QJ.preventDefault(original);
899
+ },
900
+ originalEvent: original,
901
+ data: original.data || original.detail
902
+ };
903
+ if (e.which == null) {
904
+ e.which = original.charCode != null ? original.charCode : original.keyCode;
905
+ }
906
+ return e;
907
+ };
908
+
909
+ QJ.on = function(element, eventName, callback) {
910
+ var el, multEventName, originalCallback, _i, _j, _len, _len1, _ref;
911
+ if (element.length) {
912
+ for (_i = 0, _len = element.length; _i < _len; _i++) {
913
+ el = element[_i];
914
+ QJ.on(el, eventName, callback);
915
+ }
916
+ return;
917
+ }
918
+ if (eventName.match(" ")) {
919
+ _ref = eventName.split(" ");
920
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
921
+ multEventName = _ref[_j];
922
+ QJ.on(element, multEventName, callback);
923
+ }
924
+ return;
925
+ }
926
+ originalCallback = callback;
927
+ callback = function(e) {
928
+ e = QJ.normalizeEvent(e);
929
+ return originalCallback(e);
930
+ };
931
+ if (element.addEventListener) {
932
+ return element.addEventListener(eventName, callback, false);
933
+ }
934
+ if (element.attachEvent) {
935
+ eventName = "on" + eventName;
936
+ return element.attachEvent(eventName, callback);
937
+ }
938
+ element['on' + eventName] = callback;
939
+ };
940
+
941
+ QJ.addClass = function(el, className) {
942
+ var e;
943
+ if (el.length) {
944
+ return (function() {
945
+ var _i, _len, _results;
946
+ _results = [];
947
+ for (_i = 0, _len = el.length; _i < _len; _i++) {
948
+ e = el[_i];
949
+ _results.push(QJ.addClass(e, className));
950
+ }
951
+ return _results;
952
+ })();
953
+ }
954
+ if (el.classList) {
955
+ return el.classList.add(className);
956
+ } else {
957
+ return el.className += ' ' + className;
958
+ }
959
+ };
960
+
961
+ QJ.hasClass = function(el, className) {
962
+ var e, hasClass, _i, _len;
963
+ if (el.length) {
964
+ hasClass = true;
965
+ for (_i = 0, _len = el.length; _i < _len; _i++) {
966
+ e = el[_i];
967
+ hasClass = hasClass && QJ.hasClass(e, className);
968
+ }
969
+ return hasClass;
970
+ }
971
+ if (el.classList) {
972
+ return el.classList.contains(className);
973
+ } else {
974
+ return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
975
+ }
976
+ };
977
+
978
+ QJ.removeClass = function(el, className) {
979
+ var cls, e, _i, _len, _ref, _results;
980
+ if (el.length) {
981
+ return (function() {
982
+ var _i, _len, _results;
983
+ _results = [];
984
+ for (_i = 0, _len = el.length; _i < _len; _i++) {
985
+ e = el[_i];
986
+ _results.push(QJ.removeClass(e, className));
987
+ }
988
+ return _results;
989
+ })();
990
+ }
991
+ if (el.classList) {
992
+ _ref = className.split(' ');
993
+ _results = [];
994
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
995
+ cls = _ref[_i];
996
+ _results.push(el.classList.remove(cls));
997
+ }
998
+ return _results;
999
+ } else {
1000
+ return el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
1001
+ }
1002
+ };
1003
+
1004
+ QJ.toggleClass = function(el, className, bool) {
1005
+ var e;
1006
+ if (el.length) {
1007
+ return (function() {
1008
+ var _i, _len, _results;
1009
+ _results = [];
1010
+ for (_i = 0, _len = el.length; _i < _len; _i++) {
1011
+ e = el[_i];
1012
+ _results.push(QJ.toggleClass(e, className, bool));
1013
+ }
1014
+ return _results;
1015
+ })();
1016
+ }
1017
+ if (bool) {
1018
+ if (!QJ.hasClass(el, className)) {
1019
+ return QJ.addClass(el, className);
1020
+ }
1021
+ } else {
1022
+ return QJ.removeClass(el, className);
1023
+ }
1024
+ };
1025
+
1026
+ QJ.append = function(el, toAppend) {
1027
+ var e;
1028
+ if (el.length) {
1029
+ return (function() {
1030
+ var _i, _len, _results;
1031
+ _results = [];
1032
+ for (_i = 0, _len = el.length; _i < _len; _i++) {
1033
+ e = el[_i];
1034
+ _results.push(QJ.append(e, toAppend));
1035
+ }
1036
+ return _results;
1037
+ })();
1038
+ }
1039
+ return el.insertAdjacentHTML('beforeend', toAppend);
1040
+ };
1041
+
1042
+ QJ.find = function(el, selector) {
1043
+ if (el instanceof NodeList || el instanceof Array) {
1044
+ el = el[0];
1045
+ }
1046
+ return el.querySelectorAll(selector);
1047
+ };
1048
+
1049
+ QJ.trigger = function(el, name, data) {
1050
+ var e, ev;
1051
+ try {
1052
+ ev = new CustomEvent(name, {
1053
+ detail: data
1054
+ });
1055
+ } catch (_error) {
1056
+ e = _error;
1057
+ ev = document.createEvent('CustomEvent');
1058
+ if (ev.initCustomEvent) {
1059
+ ev.initCustomEvent(name, true, true, data);
1060
+ } else {
1061
+ ev.initEvent(name, true, true, data);
1062
+ }
1063
+ }
1064
+ return el.dispatchEvent(ev);
1065
+ };
1066
+
1067
+ module.exports = QJ;
1068
+
1069
+
1070
+ },{}]},{},[1])
1071
+ (1)
1072
+ });
1073
+ }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1074
+ },{}],5:[function(_dereq_,module,exports){
1075
+ module.exports = _dereq_('cssify');
1076
+ },{"cssify":6}],6:[function(_dereq_,module,exports){
1077
+ module.exports = function (css, customDocument) {
1078
+ var doc = customDocument || document;
1079
+ if (doc.createStyleSheet) {
1080
+ doc.createStyleSheet().cssText = css;
1081
+ } else {
1082
+ var head = doc.getElementsByTagName('head')[0],
1083
+ style = doc.createElement('style');
1084
+
1085
+ style.type = 'text/css';
1086
+
1087
+ if (style.styleSheet) {
1088
+ style.styleSheet.cssText = css;
1089
+ } else {
1090
+ style.appendChild(doc.createTextNode(css));
1091
+ }
1092
+
1093
+ head.appendChild(style);
1094
+ }
1095
+ };
1096
+
1097
+ module.exports.byUrl = function(url) {
1098
+ if (document.createStyleSheet) {
1099
+ document.createStyleSheet(url);
1100
+ } else {
1101
+ var head = document.getElementsByTagName('head')[0],
1102
+ link = document.createElement('link');
1103
+
1104
+ link.rel = 'stylesheet';
1105
+ link.href = url;
1106
+
1107
+ head.appendChild(link);
1108
+ }
1109
+ };
1110
+
1111
+ },{}],7:[function(_dereq_,module,exports){
1112
+ (function (global){
1113
+ var Card, QJ, extend, payment;
1114
+
1115
+ _dereq_('../scss/card.scss');
1116
+
1117
+ QJ = _dereq_('qj');
1118
+
1119
+ payment = _dereq_('./payment/src/payment.coffee');
1120
+
1121
+ extend = _dereq_('node.extend');
1122
+
1123
+ Card = (function() {
1124
+ var bindVal;
1125
+
1126
+ Card.prototype.cardTemplate = '' + '<div class="jp-card-container">' + '<div class="jp-card">' + '<div class="jp-card-front">' + '<div class="jp-card-logo jp-card-visa">visa</div>' + '<div class="jp-card-logo jp-card-mastercard">MasterCard</div>' + '<div class="jp-card-logo jp-card-maestro">Maestro</div>' + '<div class="jp-card-logo jp-card-amex"></div>' + '<div class="jp-card-logo jp-card-discover">discover</div>' + '<div class="jp-card-logo jp-card-dankort"><div class="dk"><div class="d"></div><div class="k"></div></div></div>' + '<div class="jp-card-lower">' + '<div class="jp-card-shiny"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-number jp-card-display">{{number}}</div>' + '<div class="jp-card-name jp-card-display">{{name}}</div>' + '<div class="jp-card-expiry jp-card-display" data-before="{{monthYear}}" data-after="{{validDate}}">{{expiry}}</div>' + '</div>' + '</div>' + '<div class="jp-card-back">' + '<div class="jp-card-bar"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-shiny"></div>' + '</div>' + '</div>' + '</div>';
1127
+
1128
+ Card.prototype.template = function(tpl, data) {
1129
+ return tpl.replace(/\{\{(.*?)\}\}/g, function(match, key, str) {
1130
+ return data[key];
1131
+ });
1132
+ };
1133
+
1134
+ Card.prototype.cardTypes = ['jp-card-amex', 'jp-card-dankort', 'jp-card-dinersclub', 'jp-card-discover', 'jp-card-jcb', 'jp-card-laser', 'jp-card-maestro', 'jp-card-mastercard', 'jp-card-unionpay', 'jp-card-visa', 'jp-card-visaelectron'];
1135
+
1136
+ Card.prototype.defaults = {
1137
+ formatting: true,
1138
+ formSelectors: {
1139
+ numberInput: 'input[name="number"]',
1140
+ expiryInput: 'input[name="expiry"]',
1141
+ cvcInput: 'input[name="cvc"]',
1142
+ nameInput: 'input[name="name"]'
1143
+ },
1144
+ cardSelectors: {
1145
+ cardContainer: '.jp-card-container',
1146
+ card: '.jp-card',
1147
+ numberDisplay: '.jp-card-number',
1148
+ expiryDisplay: '.jp-card-expiry',
1149
+ cvcDisplay: '.jp-card-cvc',
1150
+ nameDisplay: '.jp-card-name'
1151
+ },
1152
+ messages: {
1153
+ validDate: 'valid\nthru',
1154
+ monthYear: 'month/year'
1155
+ },
1156
+ values: {
1157
+ number: '&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull;',
1158
+ cvc: '&bull;&bull;&bull;',
1159
+ expiry: '&bull;&bull;/&bull;&bull;',
1160
+ name: 'Full Name'
1161
+ },
1162
+ classes: {
1163
+ valid: 'jp-card-valid',
1164
+ invalid: 'jp-card-invalid'
1165
+ },
1166
+ debug: false
1167
+ };
1168
+
1169
+ function Card(opts) {
1170
+ this.options = extend(true, this.defaults, opts);
1171
+ if (!this.options.form) {
1172
+ console.log("Please provide a form");
1173
+ return;
1174
+ }
1175
+ this.$el = QJ(this.options.form);
1176
+ if (!this.options.container) {
1177
+ console.log("Please provide a container");
1178
+ return;
1179
+ }
1180
+ this.$container = QJ(this.options.container);
1181
+ this.render();
1182
+ this.attachHandlers();
1183
+ this.handleInitialValues();
1184
+ }
1185
+
1186
+ Card.prototype.render = function() {
1187
+ var $cardContainer, baseWidth, name, obj, selector, ua, _ref, _ref1;
1188
+ QJ.append(this.$container, this.template(this.cardTemplate, extend({}, this.options.messages, this.options.values)));
1189
+ _ref = this.options.cardSelectors;
1190
+ for (name in _ref) {
1191
+ selector = _ref[name];
1192
+ this["quot; + name] = QJ.find(this.$container, selector);
1193
+ }
1194
+ _ref1 = this.options.formSelectors;
1195
+ for (name in _ref1) {
1196
+ selector = _ref1[name];
1197
+ selector = this.options[name] ? this.options[name] : selector;
1198
+ obj = QJ.find(this.$el, selector);
1199
+ if (!obj.length && this.options.debug) {
1200
+ console.error("Card can't find a " + name + " in your form.");
1201
+ }
1202
+ this["quot; + name] = obj;
1203
+ }
1204
+ if (this.options.formatting) {
1205
+ Payment.formatCardNumber(this.$numberInput);
1206
+ Payment.formatCardCVC(this.$cvcInput);
1207
+ if (this.$expiryInput.length === 1) {
1208
+ Payment.formatCardExpiry(this.$expiryInput);
1209
+ }
1210
+ }
1211
+ if (this.options.width) {
1212
+ $cardContainer = QJ(this.options.cardSelectors.cardContainer)[0];
1213
+ baseWidth = parseInt($cardContainer.clientWidth);
1214
+ $cardContainer.style.transform = "scale(" + (this.options.width / baseWidth) + ")";
1215
+ }
1216
+ if (typeof navigator !== "undefined" && navigator !== null ? navigator.userAgent : void 0) {
1217
+ ua = navigator.userAgent.toLowerCase();
1218
+ if (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1) {
1219
+ QJ.addClass(this.$card, 'jp-card-safari');
1220
+ }
1221
+ }
1222
+ if (/MSIE 10\./i.test(navigator.userAgent)) {
1223
+ QJ.addClass(this.$card, 'jp-card-ie-10');
1224
+ }
1225
+ if (/rv:11.0/i.test(navigator.userAgent)) {
1226
+ return QJ.addClass(this.$card, 'jp-card-ie-11');
1227
+ }
1228
+ };
1229
+
1230
+ Card.prototype.attachHandlers = function() {
1231
+ var expiryFilters;
1232
+ bindVal(this.$numberInput, this.$numberDisplay, {
1233
+ fill: false,
1234
+ filters: this.validToggler('cardNumber')
1235
+ });
1236
+ QJ.on(this.$numberInput, 'payment.cardType', this.handle('setCardType'));
1237
+ expiryFilters = [
1238
+ function(val) {
1239
+ return val.replace(/(\s+)/g, '');
1240
+ }
1241
+ ];
1242
+ if (this.$expiryInput.length === 1) {
1243
+ expiryFilters.push(this.validToggler('cardExpiry'));
1244
+ }
1245
+ bindVal(this.$expiryInput, this.$expiryDisplay, {
1246
+ join: function(text) {
1247
+ if (text[0].length === 2 || text[1]) {
1248
+ return "/";
1249
+ } else {
1250
+ return "";
1251
+ }
1252
+ },
1253
+ filters: expiryFilters
1254
+ });
1255
+ bindVal(this.$cvcInput, this.$cvcDisplay, {
1256
+ filters: this.validToggler('cardCVC')
1257
+ });
1258
+ QJ.on(this.$cvcInput, 'focus', this.handle('flipCard'));
1259
+ QJ.on(this.$cvcInput, 'blur', this.handle('unflipCard'));
1260
+ return bindVal(this.$nameInput, this.$nameDisplay, {
1261
+ fill: false,
1262
+ filters: this.validToggler('cardHolderName'),
1263
+ join: ' '
1264
+ });
1265
+ };
1266
+
1267
+ Card.prototype.handleInitialValues = function() {
1268
+ var el, name, selector, _ref, _results;
1269
+ _ref = this.options.formSelectors;
1270
+ _results = [];
1271
+ for (name in _ref) {
1272
+ selector = _ref[name];
1273
+ el = this["quot; + name];
1274
+ if (QJ.val(el)) {
1275
+ QJ.trigger(el, 'paste');
1276
+ _results.push(setTimeout(function() {
1277
+ return QJ.trigger(el, 'keyup');
1278
+ }));