caboose-cms 0.8.43 → 0.8.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/admin_page_edit_content.js +83 -70
- data/app/assets/javascripts/caboose/card.js +2432 -0
- data/app/assets/javascripts/caboose/clipboard.js +7 -0
- data/app/assets/javascripts/caboose/modal_controllers/modal_block_controller.js +174 -252
- data/app/assets/javascripts/caboose/modal_controllers/modal_controller.js +160 -12
- data/app/assets/javascripts/caboose/modal_controllers/modal_media_controller.js +419 -0
- data/app/assets/javascripts/caboose/modal_integration.js +21 -1
- data/app/assets/javascripts/caboose/model/bound_checkbox.js +13 -6
- data/app/assets/javascripts/caboose/model/bound_select.js +16 -7
- data/app/assets/javascripts/caboose/model/bound_text.js +15 -2
- data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +16 -1
- data/app/assets/stylesheets/caboose/admin_new_block.css +9 -0
- data/app/assets/stylesheets/caboose/application.css +2 -1
- data/app/assets/stylesheets/caboose/modal_inline.css +8 -15
- data/app/assets/stylesheets/caboose/my_account.scss +178 -0
- data/app/controllers/caboose/block_types_controller.rb +20 -0
- data/app/controllers/caboose/blocks_controller.rb +70 -8
- data/app/controllers/caboose/media_controller.rb +39 -3
- data/app/models/caboose/block.rb +17 -1
- data/app/models/caboose/media.rb +9 -8
- data/app/models/caboose/schema.rb +1 -0
- data/app/views/caboose/block_types/admin_edit.html.erb +5 -2
- data/app/views/caboose/block_types/admin_index.html.erb +2 -1
- data/app/views/caboose/my_account/index.html.erb +124 -63
- data/app/views/caboose/my_account/index_old.html.erb +191 -0
- data/app/views/caboose/pages/admin_edit_content.html.erb +16 -1
- data/lib/caboose/version.rb +1 -1
- metadata +8 -3
- data/app/assets/stylesheets/caboose/my_account.css +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c7db5fd2f83983190e31cad9070c3f0e1303a82
|
4
|
+
data.tar.gz: a7957d2e142835db616a46b9e2131937685a4092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8ea193f4e83786726457a54efb7ca49a1ba6f218bc8dd70d6be555e178f9f03f940dc101ce7608e0b429681ed73667b6cba34162d583e639898cedc6e38af27
|
7
|
+
data.tar.gz: 84b430310d349b61930a8632d9e91b414fd257bb8a6abc234ea886a4af2f695c58715ab8d424dc9879f461f08b61856ebcac82c9260d1240eedd73e647a0e573
|
@@ -1,63 +1,36 @@
|
|
1
1
|
|
2
|
-
var PageContentController = function(
|
2
|
+
var PageContentController = function(params) { this.init(params); };
|
3
3
|
|
4
4
|
PageContentController.prototype = {
|
5
5
|
|
6
6
|
page_id: false,
|
7
7
|
new_block_type_id: false,
|
8
8
|
selected_block_ids: [],
|
9
|
+
blocks: false,
|
10
|
+
assets_path: false,
|
11
|
+
included_assets: false,
|
9
12
|
|
10
|
-
init: function(
|
13
|
+
init: function(params)
|
11
14
|
{
|
12
|
-
this.page_id = page_id;
|
13
15
|
var that = this;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
for (var i in params)
|
17
|
+
that[i] = params[i];
|
18
|
+
that.refresh_blocks(function() {
|
19
|
+
that.set_clickable();
|
20
|
+
});
|
18
21
|
},
|
19
22
|
|
20
|
-
|
21
|
-
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
// update: function(e, ui) {
|
32
|
-
// if (that.new_block_type_id)
|
33
|
-
// {
|
34
|
-
// $.ajax({
|
35
|
-
// url: '/admin/pages/' + that.page_id + '/blocks',
|
36
|
-
// type: 'post',
|
37
|
-
// data: { block_type_id: that.new_block_type_id, index: ui.item.index() },
|
38
|
-
// success: function(resp) { that.render_blocks(function() { that.edit_block(resp.block.id); }); }
|
39
|
-
// });
|
40
|
-
// that.new_block_type_id = false;
|
41
|
-
// }
|
42
|
-
// else
|
43
|
-
// {
|
44
|
-
// var ids = [];
|
45
|
-
// $.each($(e.target).children(), function(i, el) {
|
46
|
-
// var id = $(el).attr('id');
|
47
|
-
// if (id && id.substr(0, 6) == 'block_') ids.push(id.substr(6));
|
48
|
-
// });
|
49
|
-
//
|
50
|
-
// $.ajax({
|
51
|
-
// url: '/admin/pages/' + that.page_id + '/block-order',
|
52
|
-
// type: 'put',
|
53
|
-
// data: {
|
54
|
-
// block_ids: ids,
|
55
|
-
// },
|
56
|
-
// success: function(resp) {}
|
57
|
-
// });
|
58
|
-
// }
|
59
|
-
// }
|
60
|
-
//});
|
23
|
+
refresh_blocks: function(callback)
|
24
|
+
{
|
25
|
+
var that = this;
|
26
|
+
$.ajax({
|
27
|
+
url: '/admin/pages/' + that.page_id + '/blocks/tree',
|
28
|
+
type: 'get',
|
29
|
+
success: function(resp) {
|
30
|
+
that.blocks = resp;
|
31
|
+
if (callback) callback();
|
32
|
+
}
|
33
|
+
});
|
61
34
|
},
|
62
35
|
|
63
36
|
draggable_blocks: function()
|
@@ -71,13 +44,35 @@ PageContentController.prototype = {
|
|
71
44
|
},
|
72
45
|
|
73
46
|
edit_block: function(block_id)
|
74
|
-
{
|
75
|
-
|
47
|
+
{
|
48
|
+
var that = this;
|
49
|
+
var b = that.block_with_id(block_id);
|
50
|
+
var modal_controller = '';
|
51
|
+
if (b.use_js_for_modal == true) { $.each(b.name.split('_'), function(j, word) { modal_controller += word.charAt(0).toUpperCase() + word.toLowerCase().slice(1); }); }
|
52
|
+
else if (b.field_type == 'image') { modal_controller = 'Media'; }
|
53
|
+
else { modal_controller = 'Block'; }
|
54
|
+
that.modal = eval("new Modal" + modal_controller + "Controller({ " +
|
55
|
+
" page_id: " + that.page_id + ", " +
|
56
|
+
" block_id: " + block_id + ", " +
|
57
|
+
" authenticity_token: '" + that.authenticity_token + "', " +
|
58
|
+
" parent_controller: this, " +
|
59
|
+
" assets_path: '" + that.assets_path + "'" +
|
60
|
+
"})"
|
61
|
+
);
|
76
62
|
},
|
77
63
|
|
78
|
-
new_block: function(
|
64
|
+
new_block: function(parent_id, before_block_id, after_block_id)
|
79
65
|
{
|
80
|
-
|
66
|
+
var that = this;
|
67
|
+
//caboose_modal_url('/admin/pages/' + this.page_id + '/blocks/' + parent_id + '/new');
|
68
|
+
that.modal = new ModalController({
|
69
|
+
page_id: that.page_id,
|
70
|
+
block_id: parent_id,
|
71
|
+
authenticity_token: that.authenticity_token,
|
72
|
+
parent_controller: this,
|
73
|
+
assets_path: that.assets_path,
|
74
|
+
new_block_on_init: true
|
75
|
+
})
|
81
76
|
},
|
82
77
|
|
83
78
|
select_block: function(block_id)
|
@@ -185,35 +180,31 @@ PageContentController.prototype = {
|
|
185
180
|
Block Rendering
|
186
181
|
*****************************************************************************/
|
187
182
|
|
188
|
-
render_blocks: function(before_render)
|
183
|
+
render_blocks: function(before_render)
|
184
|
+
{
|
185
|
+
var that = this;
|
189
186
|
$('.sortable').sortable('destroy');
|
190
187
|
var that = this;
|
191
188
|
$.ajax({
|
192
189
|
url: '/admin/pages/' + this.page_id + '/blocks/render-second-level',
|
193
|
-
success: function(blocks) {
|
190
|
+
success: function(blocks) {
|
194
191
|
if (before_render) before_render();
|
195
192
|
$(blocks).each(function(i, b) {
|
196
193
|
$('#block_' + b.id).replaceWith(b.html);
|
197
194
|
});
|
198
|
-
that.set_clickable();
|
199
|
-
that.sortable_blocks();
|
195
|
+
that.refresh_blocks(function() { that.set_clickable(); });
|
200
196
|
that.selected_block_ids = [];
|
201
197
|
}
|
202
198
|
});
|
203
199
|
},
|
204
200
|
|
205
201
|
set_clickable: function()
|
206
|
-
{
|
207
|
-
var that = this;
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
$(blocks).each(function(i,b) {
|
213
|
-
that.set_clickable_helper(b, false, false, (i == count-1));
|
214
|
-
});
|
215
|
-
}
|
216
|
-
});
|
202
|
+
{
|
203
|
+
var that = this;
|
204
|
+
var count = that.blocks.length;
|
205
|
+
$(that.blocks).each(function(i,b) {
|
206
|
+
that.set_clickable_helper(b, false, false, (i == count-1));
|
207
|
+
});
|
217
208
|
},
|
218
209
|
|
219
210
|
set_clickable_helper: function(b, parent_id, parent_allows_child_blocks, is_last_child)
|
@@ -236,7 +227,8 @@ PageContentController.prototype = {
|
|
236
227
|
.html("New Block")
|
237
228
|
.click(function(e) {
|
238
229
|
e.preventDefault(); e.stopPropagation();
|
239
|
-
caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?before_id=' + b.id);
|
230
|
+
//caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?before_id=' + b.id);
|
231
|
+
that.new_block({ before_id: b.id });
|
240
232
|
})
|
241
233
|
)
|
242
234
|
.mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
@@ -252,7 +244,8 @@ PageContentController.prototype = {
|
|
252
244
|
.html("New Block")
|
253
245
|
.click(function(e) {
|
254
246
|
e.preventDefault(); e.stopPropagation();
|
255
|
-
caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?after_id=' + b.id);
|
247
|
+
//caboose_modal_url('/admin/pages/' + that.page_id + '/blocks/' + parent_id + '/new?after_id=' + b.id);
|
248
|
+
that.new_block({ after_id: b.id });
|
256
249
|
})
|
257
250
|
)
|
258
251
|
.mouseover(function(e) { $(this).removeClass('new_block_link').addClass('new_block_link_over'); e.stopPropagation(); })
|
@@ -300,8 +293,28 @@ PageContentController.prototype = {
|
|
300
293
|
$('#block_' + b.id).mouseover(function(el) { $('#block_' + b.id).addClass( 'block_over'); });
|
301
294
|
$('#block_' + b.id).mouseout(function(el) { $('#block_' + b.id).removeClass('block_over'); });
|
302
295
|
}
|
303
|
-
}
|
296
|
+
},
|
297
|
+
|
298
|
+
/*****************************************************************************
|
299
|
+
Helper methods
|
300
|
+
*****************************************************************************/
|
304
301
|
|
302
|
+
block_with_id: function(block_id, b)
|
303
|
+
{
|
304
|
+
var that = this;
|
305
|
+
if (b && b.id == block_id)
|
306
|
+
return b;
|
307
|
+
var the_block = false;
|
308
|
+
if ((!b && that.blocks) || (b && b.children))
|
309
|
+
{
|
310
|
+
$.each(b ? b.children : that.blocks, function(i, b2) {
|
311
|
+
the_block = that.block_with_id(block_id, b2);
|
312
|
+
if (the_block)
|
313
|
+
return false;
|
314
|
+
});
|
315
|
+
}
|
316
|
+
return the_block;
|
317
|
+
}
|
305
318
|
};
|
306
319
|
|
307
320
|
function toggle_blocks()
|
@@ -0,0 +1,2432 @@
|
|
1
|
+
var card =
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
3
|
+
/******/ // The module cache
|
4
|
+
/******/ var installedModules = {};
|
5
|
+
|
6
|
+
/******/ // The require function
|
7
|
+
/******/ function __webpack_require__(moduleId) {
|
8
|
+
|
9
|
+
/******/ // Check if module is in cache
|
10
|
+
/******/ if(installedModules[moduleId])
|
11
|
+
/******/ return installedModules[moduleId].exports;
|
12
|
+
|
13
|
+
/******/ // Create a new module (and put it into the cache)
|
14
|
+
/******/ var module = installedModules[moduleId] = {
|
15
|
+
/******/ exports: {},
|
16
|
+
/******/ id: moduleId,
|
17
|
+
/******/ loaded: false
|
18
|
+
/******/ };
|
19
|
+
|
20
|
+
/******/ // Execute the module function
|
21
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22
|
+
|
23
|
+
/******/ // Flag the module as loaded
|
24
|
+
/******/ module.loaded = true;
|
25
|
+
|
26
|
+
/******/ // Return the exports of the module
|
27
|
+
/******/ return module.exports;
|
28
|
+
/******/ }
|
29
|
+
|
30
|
+
|
31
|
+
/******/ // expose the modules object (__webpack_modules__)
|
32
|
+
/******/ __webpack_require__.m = modules;
|
33
|
+
|
34
|
+
/******/ // expose the module cache
|
35
|
+
/******/ __webpack_require__.c = installedModules;
|
36
|
+
|
37
|
+
/******/ // __webpack_public_path__
|
38
|
+
/******/ __webpack_require__.p = "";
|
39
|
+
|
40
|
+
/******/ // Load entry module and return exports
|
41
|
+
/******/ return __webpack_require__(0);
|
42
|
+
/******/ })
|
43
|
+
/************************************************************************/
|
44
|
+
/******/ ([
|
45
|
+
/* 0 */
|
46
|
+
/***/ function(module, exports, __webpack_require__) {
|
47
|
+
|
48
|
+
/* WEBPACK VAR INJECTION */(function(global) {var Card, QJ, extend, payment;
|
49
|
+
|
50
|
+
__webpack_require__(1);
|
51
|
+
|
52
|
+
QJ = __webpack_require__(5);
|
53
|
+
|
54
|
+
payment = __webpack_require__(6);
|
55
|
+
|
56
|
+
extend = __webpack_require__(7);
|
57
|
+
|
58
|
+
Card = (function() {
|
59
|
+
var bindVal;
|
60
|
+
|
61
|
+
Card.prototype.initializedDataAttr = "data-jp-card-initialized";
|
62
|
+
|
63
|
+
Card.prototype.cardTemplate = '' + '<div class="jp-card-container">' + '<div class="jp-card">' + '<div class="jp-card-front">' + '<div class="jp-card-logo jp-card-elo">' + '<div class="e">e</div>' + '<div class="l">l</div>' + '<div class="o">o</div>' + '</div>' + '<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>';
|
64
|
+
|
65
|
+
Card.prototype.template = function(tpl, data) {
|
66
|
+
return tpl.replace(/\{\{(.*?)\}\}/g, function(match, key, str) {
|
67
|
+
return data[key];
|
68
|
+
});
|
69
|
+
};
|
70
|
+
|
71
|
+
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', 'jp-card-elo'];
|
72
|
+
|
73
|
+
Card.prototype.defaults = {
|
74
|
+
formatting: true,
|
75
|
+
formSelectors: {
|
76
|
+
numberInput: 'input[name="number"]',
|
77
|
+
expiryInput: 'input[name="expiry"]',
|
78
|
+
cvcInput: 'input[name="cvc"]',
|
79
|
+
nameInput: 'input[name="name"]'
|
80
|
+
},
|
81
|
+
cardSelectors: {
|
82
|
+
cardContainer: '.jp-card-container',
|
83
|
+
card: '.jp-card',
|
84
|
+
numberDisplay: '.jp-card-number',
|
85
|
+
expiryDisplay: '.jp-card-expiry',
|
86
|
+
cvcDisplay: '.jp-card-cvc',
|
87
|
+
nameDisplay: '.jp-card-name'
|
88
|
+
},
|
89
|
+
messages: {
|
90
|
+
validDate: 'valid\nthru',
|
91
|
+
monthYear: 'month/year'
|
92
|
+
},
|
93
|
+
placeholders: {
|
94
|
+
number: '•••• •••• •••• ••••',
|
95
|
+
cvc: '•••',
|
96
|
+
expiry: '••/••',
|
97
|
+
name: 'Full Name'
|
98
|
+
},
|
99
|
+
classes: {
|
100
|
+
valid: 'jp-card-valid',
|
101
|
+
invalid: 'jp-card-invalid'
|
102
|
+
},
|
103
|
+
debug: false
|
104
|
+
};
|
105
|
+
|
106
|
+
function Card(opts) {
|
107
|
+
var toInitialize;
|
108
|
+
this.options = extend(true, this.defaults, opts);
|
109
|
+
if (!this.options.form) {
|
110
|
+
console.log("Please provide a form");
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
this.$el = QJ(this.options.form);
|
114
|
+
if (!this.options.container) {
|
115
|
+
console.log("Please provide a container");
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
this.$container = QJ(this.options.container);
|
119
|
+
toInitialize = QJ.isDOMElement(this.$container) ? this.$container : this.$container[0];
|
120
|
+
if (toInitialize.getAttribute(this.initializedDataAttr)) {
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
toInitialize.setAttribute(this.initializedDataAttr, true);
|
124
|
+
this.render();
|
125
|
+
this.attachHandlers();
|
126
|
+
this.handleInitialPlaceholders();
|
127
|
+
}
|
128
|
+
|
129
|
+
Card.prototype.render = function() {
|
130
|
+
var $cardContainer, baseWidth, name, obj, ref, ref1, selector, ua;
|
131
|
+
QJ.append(this.$container, this.template(this.cardTemplate, extend({}, this.options.messages, this.options.placeholders)));
|
132
|
+
ref = this.options.cardSelectors;
|
133
|
+
for (name in ref) {
|
134
|
+
selector = ref[name];
|
135
|
+
this["$" + name] = QJ.find(this.$container, selector);
|
136
|
+
}
|
137
|
+
ref1 = this.options.formSelectors;
|
138
|
+
for (name in ref1) {
|
139
|
+
selector = ref1[name];
|
140
|
+
selector = this.options[name] ? this.options[name] : selector;
|
141
|
+
obj = QJ.find(this.$el, selector);
|
142
|
+
if (!obj.length && this.options.debug) {
|
143
|
+
console.error("Card can't find a " + name + " in your form.");
|
144
|
+
}
|
145
|
+
this["$" + name] = obj;
|
146
|
+
}
|
147
|
+
if (this.options.formatting) {
|
148
|
+
Payment.formatCardNumber(this.$numberInput);
|
149
|
+
Payment.formatCardCVC(this.$cvcInput);
|
150
|
+
Payment.formatCardExpiry(this.$expiryInput);
|
151
|
+
}
|
152
|
+
if (this.options.width) {
|
153
|
+
$cardContainer = QJ(this.options.cardSelectors.cardContainer)[0];
|
154
|
+
baseWidth = parseInt($cardContainer.clientWidth);
|
155
|
+
$cardContainer.style.transform = "scale(" + (this.options.width / baseWidth) + ")";
|
156
|
+
}
|
157
|
+
if (typeof navigator !== "undefined" && navigator !== null ? navigator.userAgent : void 0) {
|
158
|
+
ua = navigator.userAgent.toLowerCase();
|
159
|
+
if (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1) {
|
160
|
+
QJ.addClass(this.$card, 'jp-card-safari');
|
161
|
+
}
|
162
|
+
}
|
163
|
+
if (/MSIE 10\./i.test(navigator.userAgent)) {
|
164
|
+
QJ.addClass(this.$card, 'jp-card-ie-10');
|
165
|
+
}
|
166
|
+
if (/rv:11.0/i.test(navigator.userAgent)) {
|
167
|
+
return QJ.addClass(this.$card, 'jp-card-ie-11');
|
168
|
+
}
|
169
|
+
};
|
170
|
+
|
171
|
+
Card.prototype.attachHandlers = function() {
|
172
|
+
var expiryFilters;
|
173
|
+
bindVal(this.$numberInput, this.$numberDisplay, {
|
174
|
+
fill: false,
|
175
|
+
filters: this.validToggler('cardNumber')
|
176
|
+
});
|
177
|
+
QJ.on(this.$numberInput, 'payment.cardType', this.handle('setCardType'));
|
178
|
+
expiryFilters = [
|
179
|
+
function(val) {
|
180
|
+
return val.replace(/(\s+)/g, '');
|
181
|
+
}
|
182
|
+
];
|
183
|
+
expiryFilters.push(this.validToggler('cardExpiry'));
|
184
|
+
bindVal(this.$expiryInput, this.$expiryDisplay, {
|
185
|
+
join: function(text) {
|
186
|
+
if (text[0].length === 2 || text[1]) {
|
187
|
+
return "/";
|
188
|
+
} else {
|
189
|
+
return "";
|
190
|
+
}
|
191
|
+
},
|
192
|
+
filters: expiryFilters
|
193
|
+
});
|
194
|
+
bindVal(this.$cvcInput, this.$cvcDisplay, {
|
195
|
+
filters: this.validToggler('cardCVC')
|
196
|
+
});
|
197
|
+
QJ.on(this.$cvcInput, 'focus', this.handle('flipCard'));
|
198
|
+
QJ.on(this.$cvcInput, 'blur', this.handle('unflipCard'));
|
199
|
+
return bindVal(this.$nameInput, this.$nameDisplay, {
|
200
|
+
fill: false,
|
201
|
+
filters: this.validToggler('cardHolderName'),
|
202
|
+
join: ' '
|
203
|
+
});
|
204
|
+
};
|
205
|
+
|
206
|
+
Card.prototype.handleInitialPlaceholders = function() {
|
207
|
+
var el, name, ref, results, selector;
|
208
|
+
ref = this.options.formSelectors;
|
209
|
+
results = [];
|
210
|
+
for (name in ref) {
|
211
|
+
selector = ref[name];
|
212
|
+
el = this["$" + name];
|
213
|
+
if (QJ.val(el)) {
|
214
|
+
QJ.trigger(el, 'paste');
|
215
|
+
results.push(setTimeout(function() {
|
216
|
+
return QJ.trigger(el, 'keyup');
|
217
|
+
}));
|
218
|
+
} else {
|
219
|
+
results.push(void 0);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
return results;
|
223
|
+
};
|
224
|
+
|
225
|
+
Card.prototype.handle = function(fn) {
|
226
|
+
return (function(_this) {
|
227
|
+
return function(e) {
|
228
|
+
var args;
|
229
|
+
args = Array.prototype.slice.call(arguments);
|
230
|
+
args.unshift(e.target);
|
231
|
+
return _this.handlers[fn].apply(_this, args);
|
232
|
+
};
|
233
|
+
})(this);
|
234
|
+
};
|
235
|
+
|
236
|
+
Card.prototype.validToggler = function(validatorName) {
|
237
|
+
var isValid;
|
238
|
+
if (validatorName === "cardExpiry") {
|
239
|
+
isValid = function(val) {
|
240
|
+
var objVal;
|
241
|
+
objVal = Payment.fns.cardExpiryVal(val);
|
242
|
+
return Payment.fns.validateCardExpiry(objVal.month, objVal.year);
|
243
|
+
};
|
244
|
+
} else if (validatorName === "cardCVC") {
|
245
|
+
isValid = (function(_this) {
|
246
|
+
return function(val) {
|
247
|
+
return Payment.fns.validateCardCVC(val, _this.cardType);
|
248
|
+
};
|
249
|
+
})(this);
|
250
|
+
} else if (validatorName === "cardNumber") {
|
251
|
+
isValid = function(val) {
|
252
|
+
return Payment.fns.validateCardNumber(val);
|
253
|
+
};
|
254
|
+
} else if (validatorName === "cardHolderName") {
|
255
|
+
isValid = function(val) {
|
256
|
+
return val !== "";
|
257
|
+
};
|
258
|
+
}
|
259
|
+
return (function(_this) {
|
260
|
+
return function(val, $in, $out) {
|
261
|
+
var result;
|
262
|
+
result = isValid(val);
|
263
|
+
_this.toggleValidClass($in, result);
|
264
|
+
_this.toggleValidClass($out, result);
|
265
|
+
return val;
|
266
|
+
};
|
267
|
+
})(this);
|
268
|
+
};
|
269
|
+
|
270
|
+
Card.prototype.toggleValidClass = function(el, test) {
|
271
|
+
QJ.toggleClass(el, this.options.classes.valid, test);
|
272
|
+
return QJ.toggleClass(el, this.options.classes.invalid, !test);
|
273
|
+
};
|
274
|
+
|
275
|
+
Card.prototype.handlers = {
|
276
|
+
setCardType: function($el, e) {
|
277
|
+
var cardType;
|
278
|
+
cardType = e.data;
|
279
|
+
if (!QJ.hasClass(this.$card, cardType)) {
|
280
|
+
QJ.removeClass(this.$card, 'jp-card-unknown');
|
281
|
+
QJ.removeClass(this.$card, this.cardTypes.join(' '));
|
282
|
+
QJ.addClass(this.$card, "jp-card-" + cardType);
|
283
|
+
QJ.toggleClass(this.$card, 'jp-card-identified', cardType !== 'unknown');
|
284
|
+
return this.cardType = cardType;
|
285
|
+
}
|
286
|
+
},
|
287
|
+
flipCard: function() {
|
288
|
+
return QJ.addClass(this.$card, 'jp-card-flipped');
|
289
|
+
},
|
290
|
+
unflipCard: function() {
|
291
|
+
return QJ.removeClass(this.$card, 'jp-card-flipped');
|
292
|
+
}
|
293
|
+
};
|
294
|
+
|
295
|
+
bindVal = function(el, out, opts) {
|
296
|
+
var joiner, o, outDefaults;
|
297
|
+
if (opts == null) {
|
298
|
+
opts = {};
|
299
|
+
}
|
300
|
+
opts.fill = opts.fill || false;
|
301
|
+
opts.filters = opts.filters || [];
|
302
|
+
if (!(opts.filters instanceof Array)) {
|
303
|
+
opts.filters = [opts.filters];
|
304
|
+
}
|
305
|
+
opts.join = opts.join || "";
|
306
|
+
if (!(typeof opts.join === "function")) {
|
307
|
+
joiner = opts.join;
|
308
|
+
opts.join = function() {
|
309
|
+
return joiner;
|
310
|
+
};
|
311
|
+
}
|
312
|
+
outDefaults = (function() {
|
313
|
+
var j, len, results;
|
314
|
+
results = [];
|
315
|
+
for (j = 0, len = out.length; j < len; j++) {
|
316
|
+
o = out[j];
|
317
|
+
results.push(o.textContent);
|
318
|
+
}
|
319
|
+
return results;
|
320
|
+
})();
|
321
|
+
QJ.on(el, 'focus', function() {
|
322
|
+
return QJ.addClass(out, 'jp-card-focused');
|
323
|
+
});
|
324
|
+
QJ.on(el, 'blur', function() {
|
325
|
+
return QJ.removeClass(out, 'jp-card-focused');
|
326
|
+
});
|
327
|
+
QJ.on(el, 'keyup change paste', function(e) {
|
328
|
+
var elem, filter, i, j, join, k, len, len1, outEl, outVal, ref, results, val;
|
329
|
+
val = (function() {
|
330
|
+
var j, len, results;
|
331
|
+
results = [];
|
332
|
+
for (j = 0, len = el.length; j < len; j++) {
|
333
|
+
elem = el[j];
|
334
|
+
results.push(QJ.val(elem));
|
335
|
+
}
|
336
|
+
return results;
|
337
|
+
})();
|
338
|
+
join = opts.join(val);
|
339
|
+
val = val.join(join);
|
340
|
+
if (val === join) {
|
341
|
+
val = "";
|
342
|
+
}
|
343
|
+
ref = opts.filters;
|
344
|
+
for (j = 0, len = ref.length; j < len; j++) {
|
345
|
+
filter = ref[j];
|
346
|
+
val = filter(val, el, out);
|
347
|
+
}
|
348
|
+
results = [];
|
349
|
+
for (i = k = 0, len1 = out.length; k < len1; i = ++k) {
|
350
|
+
outEl = out[i];
|
351
|
+
if (opts.fill) {
|
352
|
+
outVal = val + outDefaults[i].substring(val.length);
|
353
|
+
} else {
|
354
|
+
outVal = val || outDefaults[i];
|
355
|
+
}
|
356
|
+
results.push(outEl.textContent = outVal);
|
357
|
+
}
|
358
|
+
return results;
|
359
|
+
});
|
360
|
+
return el;
|
361
|
+
};
|
362
|
+
|
363
|
+
return Card;
|
364
|
+
|
365
|
+
})();
|
366
|
+
|
367
|
+
module.exports = Card;
|
368
|
+
|
369
|
+
global.Card = Card;
|
370
|
+
|
371
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
372
|
+
|
373
|
+
/***/ },
|
374
|
+
/* 1 */
|
375
|
+
/***/ function(module, exports, __webpack_require__) {
|
376
|
+
|
377
|
+
// style-loader: Adds some css to the DOM by adding a <style> tag
|
378
|
+
|
379
|
+
// load the styles
|
380
|
+
var content = __webpack_require__(2);
|
381
|
+
if(typeof content === 'string') content = [[module.id, content, '']];
|
382
|
+
// add the styles to the DOM
|
383
|
+
var update = __webpack_require__(4)(content, {});
|
384
|
+
if(content.locals) module.exports = content.locals;
|
385
|
+
// Hot Module Replacement
|
386
|
+
if(false) {
|
387
|
+
// When the styles change, update the <style> tags
|
388
|
+
if(!content.locals) {
|
389
|
+
module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/sass-loader/index.js!./card.scss", function() {
|
390
|
+
var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/sass-loader/index.js!./card.scss");
|
391
|
+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
|
392
|
+
update(newContent);
|
393
|
+
});
|
394
|
+
}
|
395
|
+
// When the module is disposed, remove the <style> tags
|
396
|
+
module.hot.dispose(function() { update(); });
|
397
|
+
}
|
398
|
+
|
399
|
+
/***/ },
|
400
|
+
/* 2 */
|
401
|
+
/***/ function(module, exports, __webpack_require__) {
|
402
|
+
|
403
|
+
exports = module.exports = __webpack_require__(3)();
|
404
|
+
// imports
|
405
|
+
|
406
|
+
|
407
|
+
// module
|
408
|
+
exports.push([module.id, ".jp-card.jp-card-safari.jp-card-identified .jp-card-front:before, .jp-card.jp-card-safari.jp-card-identified .jp-card-back:before {\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n\n.jp-card.jp-card-ie-10.jp-card-flipped, .jp-card.jp-card-ie-11.jp-card-flipped {\n -webkit-transform: 0deg;\n -moz-transform: 0deg;\n -ms-transform: 0deg;\n -o-transform: 0deg;\n transform: 0deg; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-front, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-front {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back:after {\n left: 18%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-cvc, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-cvc {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg);\n left: 5%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny {\n left: 84%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny:after {\n left: -480%;\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n\n.jp-card.jp-card-ie-10.jp-card-amex .jp-card-back, .jp-card.jp-card-ie-11.jp-card-amex .jp-card-back {\n display: none; }\n\n.jp-card-logo {\n height: 36px;\n width: 60px;\n font-style: italic; }\n .jp-card-logo, .jp-card-logo:before, .jp-card-logo:after {\n box-sizing: border-box; }\n\n.jp-card-logo.jp-card-amex {\n text-transform: uppercase;\n font-size: 4px;\n font-weight: bold;\n color: white;\n background-image: repeating-radial-gradient(circle at center, #FFF 1px, #999 2px);\n background-image: repeating-radial-gradient(circle at center, #FFF 1px, #999 2px);\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-amex:before, .jp-card-logo.jp-card-amex:after {\n width: 28px;\n display: block;\n position: absolute;\n left: 16px; }\n .jp-card-logo.jp-card-amex:before {\n height: 28px;\n content: \"american\";\n top: 3px;\n text-align: left;\n padding-left: 2px;\n padding-top: 11px;\n background: #267AC3; }\n .jp-card-logo.jp-card-amex:after {\n content: \"express\";\n bottom: 11px;\n text-align: right;\n padding-right: 2px; }\n\n.jp-card.jp-card-amex.jp-card-flipped {\n -webkit-transform: none;\n -moz-transform: none;\n -ms-transform: none;\n -o-transform: none;\n transform: none; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:before, .jp-card.jp-card-amex.jp-card-identified .jp-card-back:before {\n background-color: #108168; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-logo.jp-card-amex {\n opacity: 1; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-cvc {\n visibility: visible; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:after {\n opacity: 1; }\n\n.jp-card-logo.jp-card-discover {\n background: #FF6600;\n color: #111;\n text-transform: uppercase;\n font-style: normal;\n font-weight: bold;\n font-size: 10px;\n text-align: center;\n overflow: hidden;\n z-index: 1;\n padding-top: 9px;\n letter-spacing: .03em;\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-discover:before, .jp-card-logo.jp-card-discover:after {\n content: \" \";\n display: block;\n position: absolute; }\n .jp-card-logo.jp-card-discover:before {\n background: white;\n width: 200px;\n height: 200px;\n border-radius: 200px;\n bottom: -5%;\n right: -80%;\n z-index: -1; }\n .jp-card-logo.jp-card-discover:after {\n width: 8px;\n height: 8px;\n border-radius: 4px;\n top: 10px;\n left: 27px;\n background-color: #FF6600;\n background-image: -webkit-radial-gradient(#FF6600, #fff);\n background-image: radial-gradient( #FF6600, #fff);\n content: \"network\";\n font-size: 4px;\n line-height: 24px;\n text-indent: -7px; }\n\n.jp-card .jp-card-front .jp-card-logo.jp-card-discover {\n right: 12%;\n top: 18%; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:before, .jp-card.jp-card-discover.jp-card-identified .jp-card-back:before {\n background-color: #86B8CF; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-logo.jp-card-discover {\n opacity: 1; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:after {\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms;\n content: \" \";\n display: block;\n background-color: #FF6600;\n background-image: -webkit-linear-gradient(#FF6600, #ffa366, #FF6600);\n background-image: linear-gradient(#FF6600, #ffa366, #FF6600);\n height: 50px;\n width: 50px;\n border-radius: 25px;\n position: absolute;\n left: 100%;\n top: 15%;\n margin-left: -25px;\n box-shadow: inset 1px 1px 3px 1px rgba(0, 0, 0, 0.5); }\n\n.jp-card-logo.jp-card-visa {\n background: white;\n text-transform: uppercase;\n color: #1A1876;\n text-align: center;\n font-weight: bold;\n font-size: 15px;\n line-height: 18px; }\n .jp-card-logo.jp-card-visa:before, .jp-card-logo.jp-card-visa:after {\n content: \" \";\n display: block;\n width: 100%;\n height: 25%; }\n .jp-card-logo.jp-card-visa:before {\n background: #1A1876; }\n .jp-card-logo.jp-card-visa:after {\n background: #E79800; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-front:before, .jp-card.jp-card-visa.jp-card-identified .jp-card-back:before {\n background-color: #191278; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-logo.jp-card-visa {\n opacity: 1; }\n\n.jp-card-logo.jp-card-mastercard {\n color: white;\n font-weight: bold;\n text-align: center;\n font-size: 9px;\n line-height: 36px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-mastercard:before, .jp-card-logo.jp-card-mastercard:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-mastercard:before {\n left: 0;\n background: #FF0000;\n z-index: -1; }\n .jp-card-logo.jp-card-mastercard:after {\n right: 0;\n background: #FFAB00;\n z-index: -2; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front .jp-card-logo.jp-card-mastercard, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back .jp-card-logo.jp-card-mastercard {\n box-shadow: none; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front:before, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back:before {\n background-color: #0061A8; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-logo.jp-card-mastercard {\n opacity: 1; }\n\n.jp-card-logo.jp-card-maestro {\n color: white;\n font-weight: bold;\n text-align: center;\n font-size: 14px;\n line-height: 36px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-maestro:before, .jp-card-logo.jp-card-maestro:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-maestro:before {\n left: 0;\n background: #0064CB;\n z-index: -1; }\n .jp-card-logo.jp-card-maestro:after {\n right: 0;\n background: #CC0000;\n z-index: -2; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front .jp-card-logo.jp-card-maestro, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back .jp-card-logo.jp-card-maestro {\n box-shadow: none; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front:before, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back:before {\n background-color: #0B2C5F; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-logo.jp-card-maestro {\n opacity: 1; }\n\n.jp-card-logo.jp-card-dankort {\n width: 60px;\n height: 36px;\n padding: 3px;\n border-radius: 8px;\n border: #000000 1px solid;\n background-color: #FFFFFF; }\n .jp-card-logo.jp-card-dankort .dk {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden; }\n .jp-card-logo.jp-card-dankort .dk:before {\n background-color: #ED1C24;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n display: block;\n border-radius: 6px; }\n .jp-card-logo.jp-card-dankort .dk:after {\n content: '';\n position: absolute;\n top: 50%;\n margin-top: -7.7px;\n right: 0;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 7px 7px 10px 0;\n border-color: transparent #ED1C24 transparent transparent;\n z-index: 1; }\n .jp-card-logo.jp-card-dankort .d, .jp-card-logo.jp-card-dankort .k {\n position: absolute;\n top: 50%;\n width: 50%;\n display: block;\n height: 15.4px;\n margin-top: -7.7px;\n background: white; }\n .jp-card-logo.jp-card-dankort .d {\n left: 0;\n border-radius: 0 8px 10px 0; }\n .jp-card-logo.jp-card-dankort .d:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n display: block;\n background: #ED1C24;\n border-radius: 2px 4px 6px 0px;\n height: 5px;\n width: 7px;\n margin: -3px 0 0 -4px; }\n .jp-card-logo.jp-card-dankort .k {\n right: 0; }\n .jp-card-logo.jp-card-dankort .k:before, .jp-card-logo.jp-card-dankort .k:after {\n content: '';\n position: absolute;\n right: 50%;\n width: 0;\n height: 0;\n border-style: solid;\n margin-right: -1px; }\n .jp-card-logo.jp-card-dankort .k:before {\n top: 0;\n border-width: 8px 5px 0 0;\n border-color: #ED1C24 transparent transparent transparent; }\n .jp-card-logo.jp-card-dankort .k:after {\n bottom: 0;\n border-width: 0 5px 8px 0;\n border-color: transparent transparent #ED1C24 transparent; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-front:before, .jp-card.jp-card-dankort.jp-card-identified .jp-card-back:before {\n background-color: #0055C7; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-logo.jp-card-dankort {\n opacity: 1; }\n\n.jp-card-logo.jp-card-elo {\n height: 50px;\n width: 50px;\n border-radius: 100%;\n background: black;\n color: white;\n text-align: center;\n text-transform: lowercase;\n font-size: 21px;\n font-style: normal;\n letter-spacing: 1px;\n font-weight: bold;\n padding-top: 13px; }\n .jp-card-logo.jp-card-elo .e, .jp-card-logo.jp-card-elo .l, .jp-card-logo.jp-card-elo .o {\n display: inline-block;\n position: relative; }\n .jp-card-logo.jp-card-elo .e {\n -webkit-transform: rotate(-15deg);\n -moz-transform: rotate(-15deg);\n -ms-transform: rotate(-15deg);\n -o-transform: rotate(-15deg);\n transform: rotate(-15deg); }\n .jp-card-logo.jp-card-elo .o {\n position: relative;\n display: inline-block;\n width: 12px;\n height: 12px;\n right: 0;\n top: 7px;\n border-radius: 100%;\n background-image: -webkit-linear-gradient( yellow 50%, red 50%);\n background-image: linear-gradient( yellow 50%, red 50%);\n -webkit-transform: rotate(40deg);\n -moz-transform: rotate(40deg);\n -ms-transform: rotate(40deg);\n -o-transform: rotate(40deg);\n transform: rotate(40deg);\n text-indent: -9999px; }\n .jp-card-logo.jp-card-elo .o:before {\n content: \"\";\n position: absolute;\n width: 49%;\n height: 49%;\n background: black;\n border-radius: 100%;\n text-indent: -99999px;\n top: 25%;\n left: 25%; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-front:before, .jp-card.jp-card-elo.jp-card-identified .jp-card-back:before {\n background-color: #6F6969; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-logo.jp-card-elo {\n opacity: 1; }\n\n.jp-card-container {\n -webkit-perspective: 1000px;\n -moz-perspective: 1000px;\n perspective: 1000px;\n width: 350px;\n max-width: 100%;\n height: 200px;\n margin: auto;\n z-index: 1;\n position: relative; }\n\n.jp-card {\n font-family: \"Helvetica Neue\";\n line-height: 1;\n position: relative;\n width: 100%;\n height: 100%;\n min-width: 315px;\n border-radius: 10px;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear; }\n .jp-card > *, .jp-card > *:before, .jp-card > *:after {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-family: inherit; }\n .jp-card.jp-card-flipped {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-front, .jp-card .jp-card-back {\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n border-radius: 10px;\n background: #DDD; }\n .jp-card .jp-card-front:before, .jp-card .jp-card-back:before {\n content: \" \";\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n opacity: 0;\n border-radius: 10px;\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease; }\n .jp-card .jp-card-front:after, .jp-card .jp-card-back:after {\n content: \" \";\n display: block; }\n .jp-card .jp-card-front .jp-card-display, .jp-card .jp-card-back .jp-card-display {\n color: white;\n font-weight: normal;\n opacity: 0.5;\n -webkit-transition: opacity 400ms linear;\n -moz-transition: opacity 400ms linear;\n transition: opacity 400ms linear; }\n .jp-card .jp-card-front .jp-card-display.jp-card-focused, .jp-card .jp-card-back .jp-card-display.jp-card-focused {\n opacity: 1;\n font-weight: 700; }\n .jp-card .jp-card-front .jp-card-cvc, .jp-card .jp-card-back .jp-card-cvc {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 14px; }\n .jp-card .jp-card-front .jp-card-shiny, .jp-card .jp-card-back .jp-card-shiny {\n width: 50px;\n height: 35px;\n border-radius: 5px;\n background: #CCC;\n position: relative; }\n .jp-card .jp-card-front .jp-card-shiny:before, .jp-card .jp-card-back .jp-card-shiny:before {\n content: \" \";\n display: block;\n width: 70%;\n height: 60%;\n border-top-right-radius: 5px;\n border-bottom-right-radius: 5px;\n background: #d9d9d9;\n position: absolute;\n top: 20%; }\n .jp-card .jp-card-front .jp-card-logo {\n position: absolute;\n opacity: 0;\n right: 5%;\n top: 8%;\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms; }\n .jp-card .jp-card-front .jp-card-lower {\n width: 80%;\n position: absolute;\n left: 10%;\n bottom: 30px; }\n @media only screen and (max-width: 480px) {\n .jp-card .jp-card-front .jp-card-lower {\n width: 90%;\n left: 5%; } }\n .jp-card .jp-card-front .jp-card-lower .jp-card-cvc {\n visibility: hidden;\n float: right;\n position: relative;\n bottom: 5px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-number {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 24px;\n clear: both;\n margin-bottom: 30px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n letter-spacing: 0em;\n position: relative;\n float: right;\n width: 25%; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before, .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n font-family: \"Helvetica Neue\";\n font-weight: bold;\n font-size: 7px;\n white-space: pre;\n display: block;\n opacity: .5; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before {\n content: attr(data-before);\n margin-bottom: 2px;\n font-size: 7px;\n text-transform: uppercase; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n position: absolute;\n content: attr(data-after);\n text-align: right;\n right: 100%;\n margin-right: 5px;\n margin-top: 2px;\n bottom: 0; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-name {\n text-transform: uppercase;\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 20px;\n max-height: 45px;\n position: absolute;\n bottom: 0;\n width: 190px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: horizontal;\n overflow: hidden;\n text-overflow: ellipsis; }\n .jp-card .jp-card-back {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-back .jp-card-bar {\n background-color: #444;\n background-image: -webkit-linear-gradient(#444, #333);\n background-image: linear-gradient(#444, #333);\n width: 100%;\n height: 20%;\n position: absolute;\n top: 10%; }\n .jp-card .jp-card-back:after {\n content: \" \";\n display: block;\n background-color: #FFF;\n background-image: -webkit-linear-gradient(#FFF, #FFF);\n background-image: linear-gradient(#FFF, #FFF);\n width: 80%;\n height: 16%;\n position: absolute;\n top: 40%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-cvc {\n position: absolute;\n top: 40%;\n left: 85%;\n -webkit-transition-delay: 600ms;\n -moz-transition-delay: 600ms;\n transition-delay: 600ms; }\n .jp-card .jp-card-back .jp-card-shiny {\n position: absolute;\n top: 66%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-shiny:after {\n content: \"This card has been issued by Jesse Pollak and is licensed for anyone to use anywhere for free.AIt comes with no warranty.A For support issues, please visit: github.com/jessepollak/card.\";\n position: absolute;\n left: 120%;\n top: 5%;\n color: white;\n font-size: 7px;\n width: 230px;\n opacity: .5; }\n .jp-card.jp-card-identified {\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); }\n .jp-card.jp-card-identified .jp-card-front, .jp-card.jp-card-identified .jp-card-back {\n background-color: #000;\n background-color: rgba(0, 0, 0, 0.5); }\n .jp-card.jp-card-identified .jp-card-front:before, .jp-card.jp-card-identified .jp-card-back:before {\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease;\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 15% 80%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 15% 80%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n opacity: 1; }\n .jp-card.jp-card-identified .jp-card-front .jp-card-logo, .jp-card.jp-card-identified .jp-card-back .jp-card-logo {\n box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); }\n .jp-card.jp-card-identified.no-radial-gradient .jp-card-front:before, .jp-card.jp-card-identified.no-radial-gradient .jp-card-back:before {\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n", ""]);
|
409
|
+
|
410
|
+
// exports
|
411
|
+
|
412
|
+
|
413
|
+
/***/ },
|
414
|
+
/* 3 */
|
415
|
+
/***/ function(module, exports) {
|
416
|
+
|
417
|
+
/*
|
418
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
419
|
+
Author Tobias Koppers @sokra
|
420
|
+
*/
|
421
|
+
// css base code, injected by the css-loader
|
422
|
+
module.exports = function() {
|
423
|
+
var list = [];
|
424
|
+
|
425
|
+
// return the list of modules as css string
|
426
|
+
list.toString = function toString() {
|
427
|
+
var result = [];
|
428
|
+
for(var i = 0; i < this.length; i++) {
|
429
|
+
var item = this[i];
|
430
|
+
if(item[2]) {
|
431
|
+
result.push("@media " + item[2] + "{" + item[1] + "}");
|
432
|
+
} else {
|
433
|
+
result.push(item[1]);
|
434
|
+
}
|
435
|
+
}
|
436
|
+
return result.join("");
|
437
|
+
};
|
438
|
+
|
439
|
+
// import a list of modules into the list
|
440
|
+
list.i = function(modules, mediaQuery) {
|
441
|
+
if(typeof modules === "string")
|
442
|
+
modules = [[null, modules, ""]];
|
443
|
+
var alreadyImportedModules = {};
|
444
|
+
for(var i = 0; i < this.length; i++) {
|
445
|
+
var id = this[i][0];
|
446
|
+
if(typeof id === "number")
|
447
|
+
alreadyImportedModules[id] = true;
|
448
|
+
}
|
449
|
+
for(i = 0; i < modules.length; i++) {
|
450
|
+
var item = modules[i];
|
451
|
+
// skip already imported module
|
452
|
+
// this implementation is not 100% perfect for weird media query combinations
|
453
|
+
// when a module is imported multiple times with different media queries.
|
454
|
+
// I hope this will never occur (Hey this way we have smaller bundles)
|
455
|
+
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
456
|
+
if(mediaQuery && !item[2]) {
|
457
|
+
item[2] = mediaQuery;
|
458
|
+
} else if(mediaQuery) {
|
459
|
+
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
460
|
+
}
|
461
|
+
list.push(item);
|
462
|
+
}
|
463
|
+
}
|
464
|
+
};
|
465
|
+
return list;
|
466
|
+
};
|
467
|
+
|
468
|
+
|
469
|
+
/***/ },
|
470
|
+
/* 4 */
|
471
|
+
/***/ function(module, exports, __webpack_require__) {
|
472
|
+
|
473
|
+
/*
|
474
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
475
|
+
Author Tobias Koppers @sokra
|
476
|
+
*/
|
477
|
+
var stylesInDom = {},
|
478
|
+
memoize = function(fn) {
|
479
|
+
var memo;
|
480
|
+
return function () {
|
481
|
+
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
|
482
|
+
return memo;
|
483
|
+
};
|
484
|
+
},
|
485
|
+
isOldIE = memoize(function() {
|
486
|
+
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
|
487
|
+
}),
|
488
|
+
getHeadElement = memoize(function () {
|
489
|
+
return document.head || document.getElementsByTagName("head")[0];
|
490
|
+
}),
|
491
|
+
singletonElement = null,
|
492
|
+
singletonCounter = 0,
|
493
|
+
styleElementsInsertedAtTop = [];
|
494
|
+
|
495
|
+
module.exports = function(list, options) {
|
496
|
+
if(false) {
|
497
|
+
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
498
|
+
}
|
499
|
+
|
500
|
+
options = options || {};
|
501
|
+
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
502
|
+
// tags it will allow on a page
|
503
|
+
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
|
504
|
+
|
505
|
+
// By default, add <style> tags to the bottom of <head>.
|
506
|
+
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
|
507
|
+
|
508
|
+
var styles = listToStyles(list);
|
509
|
+
addStylesToDom(styles, options);
|
510
|
+
|
511
|
+
return function update(newList) {
|
512
|
+
var mayRemove = [];
|
513
|
+
for(var i = 0; i < styles.length; i++) {
|
514
|
+
var item = styles[i];
|
515
|
+
var domStyle = stylesInDom[item.id];
|
516
|
+
domStyle.refs--;
|
517
|
+
mayRemove.push(domStyle);
|
518
|
+
}
|
519
|
+
if(newList) {
|
520
|
+
var newStyles = listToStyles(newList);
|
521
|
+
addStylesToDom(newStyles, options);
|
522
|
+
}
|
523
|
+
for(var i = 0; i < mayRemove.length; i++) {
|
524
|
+
var domStyle = mayRemove[i];
|
525
|
+
if(domStyle.refs === 0) {
|
526
|
+
for(var j = 0; j < domStyle.parts.length; j++)
|
527
|
+
domStyle.parts[j]();
|
528
|
+
delete stylesInDom[domStyle.id];
|
529
|
+
}
|
530
|
+
}
|
531
|
+
};
|
532
|
+
}
|
533
|
+
|
534
|
+
function addStylesToDom(styles, options) {
|
535
|
+
for(var i = 0; i < styles.length; i++) {
|
536
|
+
var item = styles[i];
|
537
|
+
var domStyle = stylesInDom[item.id];
|
538
|
+
if(domStyle) {
|
539
|
+
domStyle.refs++;
|
540
|
+
for(var j = 0; j < domStyle.parts.length; j++) {
|
541
|
+
domStyle.parts[j](item.parts[j]);
|
542
|
+
}
|
543
|
+
for(; j < item.parts.length; j++) {
|
544
|
+
domStyle.parts.push(addStyle(item.parts[j], options));
|
545
|
+
}
|
546
|
+
} else {
|
547
|
+
var parts = [];
|
548
|
+
for(var j = 0; j < item.parts.length; j++) {
|
549
|
+
parts.push(addStyle(item.parts[j], options));
|
550
|
+
}
|
551
|
+
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
|
556
|
+
function listToStyles(list) {
|
557
|
+
var styles = [];
|
558
|
+
var newStyles = {};
|
559
|
+
for(var i = 0; i < list.length; i++) {
|
560
|
+
var item = list[i];
|
561
|
+
var id = item[0];
|
562
|
+
var css = item[1];
|
563
|
+
var media = item[2];
|
564
|
+
var sourceMap = item[3];
|
565
|
+
var part = {css: css, media: media, sourceMap: sourceMap};
|
566
|
+
if(!newStyles[id])
|
567
|
+
styles.push(newStyles[id] = {id: id, parts: [part]});
|
568
|
+
else
|
569
|
+
newStyles[id].parts.push(part);
|
570
|
+
}
|
571
|
+
return styles;
|
572
|
+
}
|
573
|
+
|
574
|
+
function insertStyleElement(options, styleElement) {
|
575
|
+
var head = getHeadElement();
|
576
|
+
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
577
|
+
if (options.insertAt === "top") {
|
578
|
+
if(!lastStyleElementInsertedAtTop) {
|
579
|
+
head.insertBefore(styleElement, head.firstChild);
|
580
|
+
} else if(lastStyleElementInsertedAtTop.nextSibling) {
|
581
|
+
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
|
582
|
+
} else {
|
583
|
+
head.appendChild(styleElement);
|
584
|
+
}
|
585
|
+
styleElementsInsertedAtTop.push(styleElement);
|
586
|
+
} else if (options.insertAt === "bottom") {
|
587
|
+
head.appendChild(styleElement);
|
588
|
+
} else {
|
589
|
+
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
590
|
+
}
|
591
|
+
}
|
592
|
+
|
593
|
+
function removeStyleElement(styleElement) {
|
594
|
+
styleElement.parentNode.removeChild(styleElement);
|
595
|
+
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
|
596
|
+
if(idx >= 0) {
|
597
|
+
styleElementsInsertedAtTop.splice(idx, 1);
|
598
|
+
}
|
599
|
+
}
|
600
|
+
|
601
|
+
function createStyleElement(options) {
|
602
|
+
var styleElement = document.createElement("style");
|
603
|
+
styleElement.type = "text/css";
|
604
|
+
insertStyleElement(options, styleElement);
|
605
|
+
return styleElement;
|
606
|
+
}
|
607
|
+
|
608
|
+
function createLinkElement(options) {
|
609
|
+
var linkElement = document.createElement("link");
|
610
|
+
linkElement.rel = "stylesheet";
|
611
|
+
insertStyleElement(options, linkElement);
|
612
|
+
return linkElement;
|
613
|
+
}
|
614
|
+
|
615
|
+
function addStyle(obj, options) {
|
616
|
+
var styleElement, update, remove;
|
617
|
+
|
618
|
+
if (options.singleton) {
|
619
|
+
var styleIndex = singletonCounter++;
|
620
|
+
styleElement = singletonElement || (singletonElement = createStyleElement(options));
|
621
|
+
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
|
622
|
+
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
|
623
|
+
} else if(obj.sourceMap &&
|
624
|
+
typeof URL === "function" &&
|
625
|
+
typeof URL.createObjectURL === "function" &&
|
626
|
+
typeof URL.revokeObjectURL === "function" &&
|
627
|
+
typeof Blob === "function" &&
|
628
|
+
typeof btoa === "function") {
|
629
|
+
styleElement = createLinkElement(options);
|
630
|
+
update = updateLink.bind(null, styleElement);
|
631
|
+
remove = function() {
|
632
|
+
removeStyleElement(styleElement);
|
633
|
+
if(styleElement.href)
|
634
|
+
URL.revokeObjectURL(styleElement.href);
|
635
|
+
};
|
636
|
+
} else {
|
637
|
+
styleElement = createStyleElement(options);
|
638
|
+
update = applyToTag.bind(null, styleElement);
|
639
|
+
remove = function() {
|
640
|
+
removeStyleElement(styleElement);
|
641
|
+
};
|
642
|
+
}
|
643
|
+
|
644
|
+
update(obj);
|
645
|
+
|
646
|
+
return function updateStyle(newObj) {
|
647
|
+
if(newObj) {
|
648
|
+
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
|
649
|
+
return;
|
650
|
+
update(obj = newObj);
|
651
|
+
} else {
|
652
|
+
remove();
|
653
|
+
}
|
654
|
+
};
|
655
|
+
}
|
656
|
+
|
657
|
+
var replaceText = (function () {
|
658
|
+
var textStore = [];
|
659
|
+
|
660
|
+
return function (index, replacement) {
|
661
|
+
textStore[index] = replacement;
|
662
|
+
return textStore.filter(Boolean).join('\n');
|
663
|
+
};
|
664
|
+
})();
|
665
|
+
|
666
|
+
function applyToSingletonTag(styleElement, index, remove, obj) {
|
667
|
+
var css = remove ? "" : obj.css;
|
668
|
+
|
669
|
+
if (styleElement.styleSheet) {
|
670
|
+
styleElement.styleSheet.cssText = replaceText(index, css);
|
671
|
+
} else {
|
672
|
+
var cssNode = document.createTextNode(css);
|
673
|
+
var childNodes = styleElement.childNodes;
|
674
|
+
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
|
675
|
+
if (childNodes.length) {
|
676
|
+
styleElement.insertBefore(cssNode, childNodes[index]);
|
677
|
+
} else {
|
678
|
+
styleElement.appendChild(cssNode);
|
679
|
+
}
|
680
|
+
}
|
681
|
+
}
|
682
|
+
|
683
|
+
function applyToTag(styleElement, obj) {
|
684
|
+
var css = obj.css;
|
685
|
+
var media = obj.media;
|
686
|
+
|
687
|
+
if(media) {
|
688
|
+
styleElement.setAttribute("media", media)
|
689
|
+
}
|
690
|
+
|
691
|
+
if(styleElement.styleSheet) {
|
692
|
+
styleElement.styleSheet.cssText = css;
|
693
|
+
} else {
|
694
|
+
while(styleElement.firstChild) {
|
695
|
+
styleElement.removeChild(styleElement.firstChild);
|
696
|
+
}
|
697
|
+
styleElement.appendChild(document.createTextNode(css));
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
function updateLink(linkElement, obj) {
|
702
|
+
var css = obj.css;
|
703
|
+
var sourceMap = obj.sourceMap;
|
704
|
+
|
705
|
+
if(sourceMap) {
|
706
|
+
// http://stackoverflow.com/a/26603875
|
707
|
+
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
708
|
+
}
|
709
|
+
|
710
|
+
var blob = new Blob([css], { type: "text/css" });
|
711
|
+
|
712
|
+
var oldSrc = linkElement.href;
|
713
|
+
|
714
|
+
linkElement.href = URL.createObjectURL(blob);
|
715
|
+
|
716
|
+
if(oldSrc)
|
717
|
+
URL.revokeObjectURL(oldSrc);
|
718
|
+
}
|
719
|
+
|
720
|
+
|
721
|
+
/***/ },
|
722
|
+
/* 5 */
|
723
|
+
/***/ function(module, exports) {
|
724
|
+
|
725
|
+
// Generated by CoffeeScript 1.10.0
|
726
|
+
(function() {
|
727
|
+
var QJ, rreturn, rtrim;
|
728
|
+
|
729
|
+
QJ = function(selector) {
|
730
|
+
if (QJ.isDOMElement(selector)) {
|
731
|
+
return selector;
|
732
|
+
}
|
733
|
+
return document.querySelectorAll(selector);
|
734
|
+
};
|
735
|
+
|
736
|
+
QJ.isDOMElement = function(el) {
|
737
|
+
return el && (el.nodeName != null);
|
738
|
+
};
|
739
|
+
|
740
|
+
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
741
|
+
|
742
|
+
QJ.trim = function(text) {
|
743
|
+
if (text === null) {
|
744
|
+
return "";
|
745
|
+
} else {
|
746
|
+
return (text + "").replace(rtrim, "");
|
747
|
+
}
|
748
|
+
};
|
749
|
+
|
750
|
+
rreturn = /\r/g;
|
751
|
+
|
752
|
+
QJ.val = function(el, val) {
|
753
|
+
var ret;
|
754
|
+
if (arguments.length > 1) {
|
755
|
+
return el.value = val;
|
756
|
+
} else {
|
757
|
+
ret = el.value;
|
758
|
+
if (typeof ret === "string") {
|
759
|
+
return ret.replace(rreturn, "");
|
760
|
+
} else {
|
761
|
+
if (ret === null) {
|
762
|
+
return "";
|
763
|
+
} else {
|
764
|
+
return ret;
|
765
|
+
}
|
766
|
+
}
|
767
|
+
}
|
768
|
+
};
|
769
|
+
|
770
|
+
QJ.preventDefault = function(eventObject) {
|
771
|
+
if (typeof eventObject.preventDefault === "function") {
|
772
|
+
eventObject.preventDefault();
|
773
|
+
return;
|
774
|
+
}
|
775
|
+
eventObject.returnValue = false;
|
776
|
+
return false;
|
777
|
+
};
|
778
|
+
|
779
|
+
QJ.normalizeEvent = function(e) {
|
780
|
+
var original;
|
781
|
+
original = e;
|
782
|
+
e = {
|
783
|
+
which: original.which != null ? original.which : void 0,
|
784
|
+
target: original.target || original.srcElement,
|
785
|
+
preventDefault: function() {
|
786
|
+
return QJ.preventDefault(original);
|
787
|
+
},
|
788
|
+
originalEvent: original,
|
789
|
+
data: original.data || original.detail
|
790
|
+
};
|
791
|
+
if (e.which == null) {
|
792
|
+
e.which = original.charCode != null ? original.charCode : original.keyCode;
|
793
|
+
}
|
794
|
+
return e;
|
795
|
+
};
|
796
|
+
|
797
|
+
QJ.on = function(element, eventName, callback) {
|
798
|
+
var el, i, j, len, len1, multEventName, originalCallback, ref;
|
799
|
+
if (element.length) {
|
800
|
+
for (i = 0, len = element.length; i < len; i++) {
|
801
|
+
el = element[i];
|
802
|
+
QJ.on(el, eventName, callback);
|
803
|
+
}
|
804
|
+
return;
|
805
|
+
}
|
806
|
+
if (eventName.match(" ")) {
|
807
|
+
ref = eventName.split(" ");
|
808
|
+
for (j = 0, len1 = ref.length; j < len1; j++) {
|
809
|
+
multEventName = ref[j];
|
810
|
+
QJ.on(element, multEventName, callback);
|
811
|
+
}
|
812
|
+
return;
|
813
|
+
}
|
814
|
+
originalCallback = callback;
|
815
|
+
callback = function(e) {
|
816
|
+
e = QJ.normalizeEvent(e);
|
817
|
+
return originalCallback(e);
|
818
|
+
};
|
819
|
+
if (element.addEventListener) {
|
820
|
+
return element.addEventListener(eventName, callback, false);
|
821
|
+
}
|
822
|
+
if (element.attachEvent) {
|
823
|
+
eventName = "on" + eventName;
|
824
|
+
return element.attachEvent(eventName, callback);
|
825
|
+
}
|
826
|
+
element['on' + eventName] = callback;
|
827
|
+
};
|
828
|
+
|
829
|
+
QJ.addClass = function(el, className) {
|
830
|
+
var e;
|
831
|
+
if (el.length) {
|
832
|
+
return (function() {
|
833
|
+
var i, len, results;
|
834
|
+
results = [];
|
835
|
+
for (i = 0, len = el.length; i < len; i++) {
|
836
|
+
e = el[i];
|
837
|
+
results.push(QJ.addClass(e, className));
|
838
|
+
}
|
839
|
+
return results;
|
840
|
+
})();
|
841
|
+
}
|
842
|
+
if (el.classList) {
|
843
|
+
return el.classList.add(className);
|
844
|
+
} else {
|
845
|
+
return el.className += ' ' + className;
|
846
|
+
}
|
847
|
+
};
|
848
|
+
|
849
|
+
QJ.hasClass = function(el, className) {
|
850
|
+
var e, hasClass, i, len;
|
851
|
+
if (el.length) {
|
852
|
+
hasClass = true;
|
853
|
+
for (i = 0, len = el.length; i < len; i++) {
|
854
|
+
e = el[i];
|
855
|
+
hasClass = hasClass && QJ.hasClass(e, className);
|
856
|
+
}
|
857
|
+
return hasClass;
|
858
|
+
}
|
859
|
+
if (el.classList) {
|
860
|
+
return el.classList.contains(className);
|
861
|
+
} else {
|
862
|
+
return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
|
863
|
+
}
|
864
|
+
};
|
865
|
+
|
866
|
+
QJ.removeClass = function(el, className) {
|
867
|
+
var cls, e, i, len, ref, results;
|
868
|
+
if (el.length) {
|
869
|
+
return (function() {
|
870
|
+
var i, len, results;
|
871
|
+
results = [];
|
872
|
+
for (i = 0, len = el.length; i < len; i++) {
|
873
|
+
e = el[i];
|
874
|
+
results.push(QJ.removeClass(e, className));
|
875
|
+
}
|
876
|
+
return results;
|
877
|
+
})();
|
878
|
+
}
|
879
|
+
if (el.classList) {
|
880
|
+
ref = className.split(' ');
|
881
|
+
results = [];
|
882
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
883
|
+
cls = ref[i];
|
884
|
+
results.push(el.classList.remove(cls));
|
885
|
+
}
|
886
|
+
return results;
|
887
|
+
} else {
|
888
|
+
return el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
889
|
+
}
|
890
|
+
};
|
891
|
+
|
892
|
+
QJ.toggleClass = function(el, className, bool) {
|
893
|
+
var e;
|
894
|
+
if (el.length) {
|
895
|
+
return (function() {
|
896
|
+
var i, len, results;
|
897
|
+
results = [];
|
898
|
+
for (i = 0, len = el.length; i < len; i++) {
|
899
|
+
e = el[i];
|
900
|
+
results.push(QJ.toggleClass(e, className, bool));
|
901
|
+
}
|
902
|
+
return results;
|
903
|
+
})();
|
904
|
+
}
|
905
|
+
if (bool) {
|
906
|
+
if (!QJ.hasClass(el, className)) {
|
907
|
+
return QJ.addClass(el, className);
|
908
|
+
}
|
909
|
+
} else {
|
910
|
+
return QJ.removeClass(el, className);
|
911
|
+
}
|
912
|
+
};
|
913
|
+
|
914
|
+
QJ.append = function(el, toAppend) {
|
915
|
+
var e;
|
916
|
+
if (el.length) {
|
917
|
+
return (function() {
|
918
|
+
var i, len, results;
|
919
|
+
results = [];
|
920
|
+
for (i = 0, len = el.length; i < len; i++) {
|
921
|
+
e = el[i];
|
922
|
+
results.push(QJ.append(e, toAppend));
|
923
|
+
}
|
924
|
+
return results;
|
925
|
+
})();
|
926
|
+
}
|
927
|
+
return el.insertAdjacentHTML('beforeend', toAppend);
|
928
|
+
};
|
929
|
+
|
930
|
+
QJ.find = function(el, selector) {
|
931
|
+
if (el instanceof NodeList || el instanceof Array) {
|
932
|
+
el = el[0];
|
933
|
+
}
|
934
|
+
return el.querySelectorAll(selector);
|
935
|
+
};
|
936
|
+
|
937
|
+
QJ.trigger = function(el, name, data) {
|
938
|
+
var e, error, ev;
|
939
|
+
try {
|
940
|
+
ev = new CustomEvent(name, {
|
941
|
+
detail: data
|
942
|
+
});
|
943
|
+
} catch (error) {
|
944
|
+
e = error;
|
945
|
+
ev = document.createEvent('CustomEvent');
|
946
|
+
if (ev.initCustomEvent) {
|
947
|
+
ev.initCustomEvent(name, true, true, data);
|
948
|
+
} else {
|
949
|
+
ev.initEvent(name, true, true, data);
|
950
|
+
}
|
951
|
+
}
|
952
|
+
return el.dispatchEvent(ev);
|
953
|
+
};
|
954
|
+
|
955
|
+
module.exports = QJ;
|
956
|
+
|
957
|
+
}).call(this);
|
958
|
+
|
959
|
+
|
960
|
+
/***/ },
|
961
|
+
/* 6 */
|
962
|
+
/***/ function(module, exports, __webpack_require__) {
|
963
|
+
|
964
|
+
/* WEBPACK VAR INJECTION */(function(global) {// Generated by CoffeeScript 1.10.0
|
965
|
+
(function() {
|
966
|
+
var Payment, QJ, cardFromNumber, cardFromType, cards, defaultFormat, formatBackCardNumber, formatBackExpiry, formatCardNumber, formatExpiry, formatForwardExpiry, formatForwardSlash, formatMonthExpiry, hasTextSelected, luhnCheck, reFormatCardNumber, restrictCVC, restrictCardNumber, restrictCombinedExpiry, restrictExpiry, restrictMonthExpiry, restrictNumeric, restrictYearExpiry, setCardType,
|
967
|
+
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
968
|
+
|
969
|
+
QJ = __webpack_require__(5);
|
970
|
+
|
971
|
+
defaultFormat = /(\d{1,4})/g;
|
972
|
+
|
973
|
+
cards = [
|
974
|
+
{
|
975
|
+
type: 'amex',
|
976
|
+
pattern: /^3[47]/,
|
977
|
+
format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
|
978
|
+
length: [15],
|
979
|
+
cvcLength: [4],
|
980
|
+
luhn: true
|
981
|
+
}, {
|
982
|
+
type: 'dankort',
|
983
|
+
pattern: /^5019/,
|
984
|
+
format: defaultFormat,
|
985
|
+
length: [16],
|
986
|
+
cvcLength: [3],
|
987
|
+
luhn: true
|
988
|
+
}, {
|
989
|
+
type: 'dinersclub',
|
990
|
+
pattern: /^(36|38|30[0-5])/,
|
991
|
+
format: /(\d{1,4})(\d{1,6})?(\d{1,4})?/,
|
992
|
+
length: [14],
|
993
|
+
cvcLength: [3],
|
994
|
+
luhn: true
|
995
|
+
}, {
|
996
|
+
type: 'discover',
|
997
|
+
pattern: /^(6011|65|64[4-9]|622)/,
|
998
|
+
format: defaultFormat,
|
999
|
+
length: [16],
|
1000
|
+
cvcLength: [3],
|
1001
|
+
luhn: true
|
1002
|
+
}, {
|
1003
|
+
type: 'jcb',
|
1004
|
+
pattern: /^35/,
|
1005
|
+
format: defaultFormat,
|
1006
|
+
length: [16],
|
1007
|
+
cvcLength: [3],
|
1008
|
+
luhn: true
|
1009
|
+
}, {
|
1010
|
+
type: 'laser',
|
1011
|
+
pattern: /^(6706|6771|6709)/,
|
1012
|
+
format: defaultFormat,
|
1013
|
+
length: [16, 17, 18, 19],
|
1014
|
+
cvcLength: [3],
|
1015
|
+
luhn: true
|
1016
|
+
}, {
|
1017
|
+
type: 'maestro',
|
1018
|
+
pattern: /^(5018|5020|5038|6304|6703|6759|676[1-3])/,
|
1019
|
+
format: defaultFormat,
|
1020
|
+
length: [12, 13, 14, 15, 16, 17, 18, 19],
|
1021
|
+
cvcLength: [3],
|
1022
|
+
luhn: true
|
1023
|
+
}, {
|
1024
|
+
type: 'mastercard',
|
1025
|
+
pattern: /^5[1-5]/,
|
1026
|
+
pattern: /^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/,
|
1027
|
+
format: defaultFormat,
|
1028
|
+
length: [16],
|
1029
|
+
cvcLength: [3],
|
1030
|
+
luhn: true
|
1031
|
+
}, {
|
1032
|
+
type: 'unionpay',
|
1033
|
+
pattern: /^62/,
|
1034
|
+
format: defaultFormat,
|
1035
|
+
length: [16, 17, 18, 19],
|
1036
|
+
cvcLength: [3],
|
1037
|
+
luhn: false
|
1038
|
+
}, {
|
1039
|
+
type: 'visaelectron',
|
1040
|
+
pattern: /^4(026|17500|405|508|844|91[37])/,
|
1041
|
+
format: defaultFormat,
|
1042
|
+
length: [16],
|
1043
|
+
cvcLength: [3],
|
1044
|
+
luhn: true
|
1045
|
+
}, {
|
1046
|
+
type: 'elo',
|
1047
|
+
pattern: /^4011|438935|45(1416|76|7393)|50(4175|6699|67|90[4-7])|63(6297|6368)/,
|
1048
|
+
format: defaultFormat,
|
1049
|
+
length: [16],
|
1050
|
+
cvcLength: [3],
|
1051
|
+
luhn: true
|
1052
|
+
}, {
|
1053
|
+
type: 'visa',
|
1054
|
+
pattern: /^4/,
|
1055
|
+
format: defaultFormat,
|
1056
|
+
length: [13, 16, 19],
|
1057
|
+
cvcLength: [3],
|
1058
|
+
luhn: true
|
1059
|
+
}
|
1060
|
+
];
|
1061
|
+
|
1062
|
+
cardFromNumber = function(num) {
|
1063
|
+
var card, i, len;
|
1064
|
+
num = (num + '').replace(/\D/g, '');
|
1065
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1066
|
+
card = cards[i];
|
1067
|
+
if (card.pattern.test(num)) {
|
1068
|
+
return card;
|
1069
|
+
}
|
1070
|
+
}
|
1071
|
+
};
|
1072
|
+
|
1073
|
+
cardFromType = function(type) {
|
1074
|
+
var card, i, len;
|
1075
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1076
|
+
card = cards[i];
|
1077
|
+
if (card.type === type) {
|
1078
|
+
return card;
|
1079
|
+
}
|
1080
|
+
}
|
1081
|
+
};
|
1082
|
+
|
1083
|
+
luhnCheck = function(num) {
|
1084
|
+
var digit, digits, i, len, odd, sum;
|
1085
|
+
odd = true;
|
1086
|
+
sum = 0;
|
1087
|
+
digits = (num + '').split('').reverse();
|
1088
|
+
for (i = 0, len = digits.length; i < len; i++) {
|
1089
|
+
digit = digits[i];
|
1090
|
+
digit = parseInt(digit, 10);
|
1091
|
+
if ((odd = !odd)) {
|
1092
|
+
digit *= 2;
|
1093
|
+
}
|
1094
|
+
if (digit > 9) {
|
1095
|
+
digit -= 9;
|
1096
|
+
}
|
1097
|
+
sum += digit;
|
1098
|
+
}
|
1099
|
+
return sum % 10 === 0;
|
1100
|
+
};
|
1101
|
+
|
1102
|
+
hasTextSelected = function(target) {
|
1103
|
+
var e, error, ref;
|
1104
|
+
try {
|
1105
|
+
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
|
1106
|
+
return true;
|
1107
|
+
}
|
1108
|
+
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
|
1109
|
+
if (document.selection.createRange().text) {
|
1110
|
+
return true;
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
} catch (error) {
|
1114
|
+
e = error;
|
1115
|
+
}
|
1116
|
+
return false;
|
1117
|
+
};
|
1118
|
+
|
1119
|
+
reFormatCardNumber = function(e) {
|
1120
|
+
return setTimeout((function(_this) {
|
1121
|
+
return function() {
|
1122
|
+
var target, value;
|
1123
|
+
target = e.target;
|
1124
|
+
value = QJ.val(target);
|
1125
|
+
value = Payment.fns.formatCardNumber(value);
|
1126
|
+
QJ.val(target, value);
|
1127
|
+
return QJ.trigger(target, 'change');
|
1128
|
+
};
|
1129
|
+
})(this));
|
1130
|
+
};
|
1131
|
+
|
1132
|
+
formatCardNumber = function(e) {
|
1133
|
+
var card, digit, length, re, target, upperLength, value;
|
1134
|
+
digit = String.fromCharCode(e.which);
|
1135
|
+
if (!/^\d+$/.test(digit)) {
|
1136
|
+
return;
|
1137
|
+
}
|
1138
|
+
target = e.target;
|
1139
|
+
value = QJ.val(target);
|
1140
|
+
card = cardFromNumber(value + digit);
|
1141
|
+
length = (value.replace(/\D/g, '') + digit).length;
|
1142
|
+
upperLength = 16;
|
1143
|
+
if (card) {
|
1144
|
+
upperLength = card.length[card.length.length - 1];
|
1145
|
+
}
|
1146
|
+
if (length >= upperLength) {
|
1147
|
+
return;
|
1148
|
+
}
|
1149
|
+
if (hasTextSelected(target)) {
|
1150
|
+
return;
|
1151
|
+
}
|
1152
|
+
if (card && card.type === 'amex') {
|
1153
|
+
re = /^(\d{4}|\d{4}\s\d{6})$/;
|
1154
|
+
} else {
|
1155
|
+
re = /(?:^|\s)(\d{4})$/;
|
1156
|
+
}
|
1157
|
+
if (re.test(value)) {
|
1158
|
+
e.preventDefault();
|
1159
|
+
QJ.val(target, value + ' ' + digit);
|
1160
|
+
return QJ.trigger(target, 'change');
|
1161
|
+
} else if (re.test(value + digit)) {
|
1162
|
+
e.preventDefault();
|
1163
|
+
QJ.val(target, value + digit + ' ');
|
1164
|
+
return QJ.trigger(target, 'change');
|
1165
|
+
}
|
1166
|
+
};
|
1167
|
+
|
1168
|
+
formatBackCardNumber = function(e) {
|
1169
|
+
var target, value;
|
1170
|
+
target = e.target;
|
1171
|
+
value = QJ.val(target);
|
1172
|
+
if (e.meta) {
|
1173
|
+
return;
|
1174
|
+
}
|
1175
|
+
if (e.which !== 8) {
|
1176
|
+
return;
|
1177
|
+
}
|
1178
|
+
if (hasTextSelected(target)) {
|
1179
|
+
return;
|
1180
|
+
}
|
1181
|
+
if (/\d\s$/.test(value)) {
|
1182
|
+
e.preventDefault();
|
1183
|
+
return QJ.val(target, value.replace(/\d\s$/, ''));
|
1184
|
+
} else if (/\s\d?$/.test(value)) {
|
1185
|
+
e.preventDefault();
|
1186
|
+
return QJ.val(target, value.replace(/\s\d?$/, ''));
|
1187
|
+
}
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
formatExpiry = function(e) {
|
1191
|
+
var digit, target, val;
|
1192
|
+
digit = String.fromCharCode(e.which);
|
1193
|
+
if (!/^\d+$/.test(digit)) {
|
1194
|
+
return;
|
1195
|
+
}
|
1196
|
+
target = e.target;
|
1197
|
+
val = QJ.val(target) + digit;
|
1198
|
+
if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
|
1199
|
+
e.preventDefault();
|
1200
|
+
return QJ.val(target, "0" + val + " / ");
|
1201
|
+
} else if (/^\d\d$/.test(val)) {
|
1202
|
+
e.preventDefault();
|
1203
|
+
return QJ.val(target, val + " / ");
|
1204
|
+
}
|
1205
|
+
};
|
1206
|
+
|
1207
|
+
formatMonthExpiry = function(e) {
|
1208
|
+
var digit, target, val;
|
1209
|
+
digit = String.fromCharCode(e.which);
|
1210
|
+
if (!/^\d+$/.test(digit)) {
|
1211
|
+
return;
|
1212
|
+
}
|
1213
|
+
target = e.target;
|
1214
|
+
val = QJ.val(target) + digit;
|
1215
|
+
if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
|
1216
|
+
e.preventDefault();
|
1217
|
+
return QJ.val(target, "0" + val);
|
1218
|
+
} else if (/^\d\d$/.test(val)) {
|
1219
|
+
e.preventDefault();
|
1220
|
+
return QJ.val(target, "" + val);
|
1221
|
+
}
|
1222
|
+
};
|
1223
|
+
|
1224
|
+
formatForwardExpiry = function(e) {
|
1225
|
+
var digit, target, val;
|
1226
|
+
digit = String.fromCharCode(e.which);
|
1227
|
+
if (!/^\d+$/.test(digit)) {
|
1228
|
+
return;
|
1229
|
+
}
|
1230
|
+
target = e.target;
|
1231
|
+
val = QJ.val(target);
|
1232
|
+
if (/^\d\d$/.test(val)) {
|
1233
|
+
return QJ.val(target, val + " / ");
|
1234
|
+
}
|
1235
|
+
};
|
1236
|
+
|
1237
|
+
formatForwardSlash = function(e) {
|
1238
|
+
var slash, target, val;
|
1239
|
+
slash = String.fromCharCode(e.which);
|
1240
|
+
if (slash !== '/') {
|
1241
|
+
return;
|
1242
|
+
}
|
1243
|
+
target = e.target;
|
1244
|
+
val = QJ.val(target);
|
1245
|
+
if (/^\d$/.test(val) && val !== '0') {
|
1246
|
+
return QJ.val(target, "0" + val + " / ");
|
1247
|
+
}
|
1248
|
+
};
|
1249
|
+
|
1250
|
+
formatBackExpiry = function(e) {
|
1251
|
+
var target, value;
|
1252
|
+
if (e.metaKey) {
|
1253
|
+
return;
|
1254
|
+
}
|
1255
|
+
target = e.target;
|
1256
|
+
value = QJ.val(target);
|
1257
|
+
if (e.which !== 8) {
|
1258
|
+
return;
|
1259
|
+
}
|
1260
|
+
if (hasTextSelected(target)) {
|
1261
|
+
return;
|
1262
|
+
}
|
1263
|
+
if (/\d(\s|\/)+$/.test(value)) {
|
1264
|
+
e.preventDefault();
|
1265
|
+
return QJ.val(target, value.replace(/\d(\s|\/)*$/, ''));
|
1266
|
+
} else if (/\s\/\s?\d?$/.test(value)) {
|
1267
|
+
e.preventDefault();
|
1268
|
+
return QJ.val(target, value.replace(/\s\/\s?\d?$/, ''));
|
1269
|
+
}
|
1270
|
+
};
|
1271
|
+
|
1272
|
+
restrictNumeric = function(e) {
|
1273
|
+
var input;
|
1274
|
+
if (e.metaKey || e.ctrlKey) {
|
1275
|
+
return true;
|
1276
|
+
}
|
1277
|
+
if (e.which === 32) {
|
1278
|
+
return e.preventDefault();
|
1279
|
+
}
|
1280
|
+
if (e.which === 0) {
|
1281
|
+
return true;
|
1282
|
+
}
|
1283
|
+
if (e.which < 33) {
|
1284
|
+
return true;
|
1285
|
+
}
|
1286
|
+
input = String.fromCharCode(e.which);
|
1287
|
+
if (!/[\d\s]/.test(input)) {
|
1288
|
+
return e.preventDefault();
|
1289
|
+
}
|
1290
|
+
};
|
1291
|
+
|
1292
|
+
restrictCardNumber = function(e) {
|
1293
|
+
var card, digit, target, value;
|
1294
|
+
target = e.target;
|
1295
|
+
digit = String.fromCharCode(e.which);
|
1296
|
+
if (!/^\d+$/.test(digit)) {
|
1297
|
+
return;
|
1298
|
+
}
|
1299
|
+
if (hasTextSelected(target)) {
|
1300
|
+
return;
|
1301
|
+
}
|
1302
|
+
value = (QJ.val(target) + digit).replace(/\D/g, '');
|
1303
|
+
card = cardFromNumber(value);
|
1304
|
+
if (card) {
|
1305
|
+
if (!(value.length <= card.length[card.length.length - 1])) {
|
1306
|
+
return e.preventDefault();
|
1307
|
+
}
|
1308
|
+
} else {
|
1309
|
+
if (!(value.length <= 16)) {
|
1310
|
+
return e.preventDefault();
|
1311
|
+
}
|
1312
|
+
}
|
1313
|
+
};
|
1314
|
+
|
1315
|
+
restrictExpiry = function(e, length) {
|
1316
|
+
var digit, target, value;
|
1317
|
+
target = e.target;
|
1318
|
+
digit = String.fromCharCode(e.which);
|
1319
|
+
if (!/^\d+$/.test(digit)) {
|
1320
|
+
return;
|
1321
|
+
}
|
1322
|
+
if (hasTextSelected(target)) {
|
1323
|
+
return;
|
1324
|
+
}
|
1325
|
+
value = QJ.val(target) + digit;
|
1326
|
+
value = value.replace(/\D/g, '');
|
1327
|
+
if (value.length > length) {
|
1328
|
+
return e.preventDefault();
|
1329
|
+
}
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
restrictCombinedExpiry = function(e) {
|
1333
|
+
return restrictExpiry(e, 6);
|
1334
|
+
};
|
1335
|
+
|
1336
|
+
restrictMonthExpiry = function(e) {
|
1337
|
+
return restrictExpiry(e, 2);
|
1338
|
+
};
|
1339
|
+
|
1340
|
+
restrictYearExpiry = function(e) {
|
1341
|
+
return restrictExpiry(e, 4);
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
restrictCVC = function(e) {
|
1345
|
+
var digit, target, val;
|
1346
|
+
target = e.target;
|
1347
|
+
digit = String.fromCharCode(e.which);
|
1348
|
+
if (!/^\d+$/.test(digit)) {
|
1349
|
+
return;
|
1350
|
+
}
|
1351
|
+
if (hasTextSelected(target)) {
|
1352
|
+
return;
|
1353
|
+
}
|
1354
|
+
val = QJ.val(target) + digit;
|
1355
|
+
if (!(val.length <= 4)) {
|
1356
|
+
return e.preventDefault();
|
1357
|
+
}
|
1358
|
+
};
|
1359
|
+
|
1360
|
+
setCardType = function(e) {
|
1361
|
+
var allTypes, card, cardType, target, val;
|
1362
|
+
target = e.target;
|
1363
|
+
val = QJ.val(target);
|
1364
|
+
cardType = Payment.fns.cardType(val) || 'unknown';
|
1365
|
+
if (!QJ.hasClass(target, cardType)) {
|
1366
|
+
allTypes = (function() {
|
1367
|
+
var i, len, results;
|
1368
|
+
results = [];
|
1369
|
+
for (i = 0, len = cards.length; i < len; i++) {
|
1370
|
+
card = cards[i];
|
1371
|
+
results.push(card.type);
|
1372
|
+
}
|
1373
|
+
return results;
|
1374
|
+
})();
|
1375
|
+
QJ.removeClass(target, 'unknown');
|
1376
|
+
QJ.removeClass(target, allTypes.join(' '));
|
1377
|
+
QJ.addClass(target, cardType);
|
1378
|
+
QJ.toggleClass(target, 'identified', cardType !== 'unknown');
|
1379
|
+
return QJ.trigger(target, 'payment.cardType', cardType);
|
1380
|
+
}
|
1381
|
+
};
|
1382
|
+
|
1383
|
+
Payment = (function() {
|
1384
|
+
function Payment() {}
|
1385
|
+
|
1386
|
+
Payment.fns = {
|
1387
|
+
cardExpiryVal: function(value) {
|
1388
|
+
var month, prefix, ref, year;
|
1389
|
+
value = value.replace(/\s/g, '');
|
1390
|
+
ref = value.split('/', 2), month = ref[0], year = ref[1];
|
1391
|
+
if ((year != null ? year.length : void 0) === 2 && /^\d+$/.test(year)) {
|
1392
|
+
prefix = (new Date).getFullYear();
|
1393
|
+
prefix = prefix.toString().slice(0, 2);
|
1394
|
+
year = prefix + year;
|
1395
|
+
}
|
1396
|
+
month = parseInt(month, 10);
|
1397
|
+
year = parseInt(year, 10);
|
1398
|
+
return {
|
1399
|
+
month: month,
|
1400
|
+
year: year
|
1401
|
+
};
|
1402
|
+
},
|
1403
|
+
validateCardNumber: function(num) {
|
1404
|
+
var card, ref;
|
1405
|
+
num = (num + '').replace(/\s+|-/g, '');
|
1406
|
+
if (!/^\d+$/.test(num)) {
|
1407
|
+
return false;
|
1408
|
+
}
|
1409
|
+
card = cardFromNumber(num);
|
1410
|
+
if (!card) {
|
1411
|
+
return false;
|
1412
|
+
}
|
1413
|
+
return (ref = num.length, indexOf.call(card.length, ref) >= 0) && (card.luhn === false || luhnCheck(num));
|
1414
|
+
},
|
1415
|
+
validateCardExpiry: function(month, year) {
|
1416
|
+
var currentTime, expiry, prefix, ref;
|
1417
|
+
if (typeof month === 'object' && 'month' in month) {
|
1418
|
+
ref = month, month = ref.month, year = ref.year;
|
1419
|
+
}
|
1420
|
+
if (!(month && year)) {
|
1421
|
+
return false;
|
1422
|
+
}
|
1423
|
+
month = QJ.trim(month);
|
1424
|
+
year = QJ.trim(year);
|
1425
|
+
if (!/^\d+$/.test(month)) {
|
1426
|
+
return false;
|
1427
|
+
}
|
1428
|
+
if (!/^\d+$/.test(year)) {
|
1429
|
+
return false;
|
1430
|
+
}
|
1431
|
+
month = parseInt(month, 10);
|
1432
|
+
if (!(month && month <= 12)) {
|
1433
|
+
return false;
|
1434
|
+
}
|
1435
|
+
if (year.length === 2) {
|
1436
|
+
prefix = (new Date).getFullYear();
|
1437
|
+
prefix = prefix.toString().slice(0, 2);
|
1438
|
+
year = prefix + year;
|
1439
|
+
}
|
1440
|
+
expiry = new Date(year, month);
|
1441
|
+
currentTime = new Date;
|
1442
|
+
expiry.setMonth(expiry.getMonth() - 1);
|
1443
|
+
expiry.setMonth(expiry.getMonth() + 1, 1);
|
1444
|
+
return expiry > currentTime;
|
1445
|
+
},
|
1446
|
+
validateCardCVC: function(cvc, type) {
|
1447
|
+
var ref, ref1;
|
1448
|
+
cvc = QJ.trim(cvc);
|
1449
|
+
if (!/^\d+$/.test(cvc)) {
|
1450
|
+
return false;
|
1451
|
+
}
|
1452
|
+
if (type && cardFromType(type)) {
|
1453
|
+
return ref = cvc.length, indexOf.call((ref1 = cardFromType(type)) != null ? ref1.cvcLength : void 0, ref) >= 0;
|
1454
|
+
} else {
|
1455
|
+
return cvc.length >= 3 && cvc.length <= 4;
|
1456
|
+
}
|
1457
|
+
},
|
1458
|
+
cardType: function(num) {
|
1459
|
+
var ref;
|
1460
|
+
if (!num) {
|
1461
|
+
return null;
|
1462
|
+
}
|
1463
|
+
return ((ref = cardFromNumber(num)) != null ? ref.type : void 0) || null;
|
1464
|
+
},
|
1465
|
+
formatCardNumber: function(num) {
|
1466
|
+
var card, groups, ref, upperLength;
|
1467
|
+
card = cardFromNumber(num);
|
1468
|
+
if (!card) {
|
1469
|
+
return num;
|
1470
|
+
}
|
1471
|
+
upperLength = card.length[card.length.length - 1];
|
1472
|
+
num = num.replace(/\D/g, '');
|
1473
|
+
num = num.slice(0, upperLength);
|
1474
|
+
if (card.format.global) {
|
1475
|
+
return (ref = num.match(card.format)) != null ? ref.join(' ') : void 0;
|
1476
|
+
} else {
|
1477
|
+
groups = card.format.exec(num);
|
1478
|
+
if (groups != null) {
|
1479
|
+
groups.shift();
|
1480
|
+
}
|
1481
|
+
return groups != null ? groups.join(' ') : void 0;
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
};
|
1485
|
+
|
1486
|
+
Payment.restrictNumeric = function(el) {
|
1487
|
+
return QJ.on(el, 'keypress', restrictNumeric);
|
1488
|
+
};
|
1489
|
+
|
1490
|
+
Payment.cardExpiryVal = function(el) {
|
1491
|
+
return Payment.fns.cardExpiryVal(QJ.val(el));
|
1492
|
+
};
|
1493
|
+
|
1494
|
+
Payment.formatCardCVC = function(el) {
|
1495
|
+
Payment.restrictNumeric(el);
|
1496
|
+
QJ.on(el, 'keypress', restrictCVC);
|
1497
|
+
return el;
|
1498
|
+
};
|
1499
|
+
|
1500
|
+
Payment.formatCardExpiry = function(el) {
|
1501
|
+
var month, year;
|
1502
|
+
Payment.restrictNumeric(el);
|
1503
|
+
if (el.length && el.length === 2) {
|
1504
|
+
month = el[0], year = el[1];
|
1505
|
+
this.formatCardExpiryMultiple(month, year);
|
1506
|
+
} else {
|
1507
|
+
QJ.on(el, 'keypress', restrictCombinedExpiry);
|
1508
|
+
QJ.on(el, 'keypress', formatExpiry);
|
1509
|
+
QJ.on(el, 'keypress', formatForwardSlash);
|
1510
|
+
QJ.on(el, 'keypress', formatForwardExpiry);
|
1511
|
+
QJ.on(el, 'keydown', formatBackExpiry);
|
1512
|
+
}
|
1513
|
+
return el;
|
1514
|
+
};
|
1515
|
+
|
1516
|
+
Payment.formatCardExpiryMultiple = function(month, year) {
|
1517
|
+
QJ.on(month, 'keypress', restrictMonthExpiry);
|
1518
|
+
QJ.on(month, 'keypress', formatMonthExpiry);
|
1519
|
+
return QJ.on(year, 'keypress', restrictYearExpiry);
|
1520
|
+
};
|
1521
|
+
|
1522
|
+
Payment.formatCardNumber = function(el) {
|
1523
|
+
Payment.restrictNumeric(el);
|
1524
|
+
QJ.on(el, 'keypress', restrictCardNumber);
|
1525
|
+
QJ.on(el, 'keypress', formatCardNumber);
|
1526
|
+
QJ.on(el, 'keydown', formatBackCardNumber);
|
1527
|
+
QJ.on(el, 'keyup', setCardType);
|
1528
|
+
QJ.on(el, 'paste', reFormatCardNumber);
|
1529
|
+
return el;
|
1530
|
+
};
|
1531
|
+
|
1532
|
+
Payment.getCardArray = function() {
|
1533
|
+
return cards;
|
1534
|
+
};
|
1535
|
+
|
1536
|
+
Payment.setCardArray = function(cardArray) {
|
1537
|
+
cards = cardArray;
|
1538
|
+
return true;
|
1539
|
+
};
|
1540
|
+
|
1541
|
+
Payment.addToCardArray = function(cardObject) {
|
1542
|
+
return cards.push(cardObject);
|
1543
|
+
};
|
1544
|
+
|
1545
|
+
Payment.removeFromCardArray = function(type) {
|
1546
|
+
var key, value;
|
1547
|
+
for (key in cards) {
|
1548
|
+
value = cards[key];
|
1549
|
+
if (value.type === type) {
|
1550
|
+
cards.splice(key, 1);
|
1551
|
+
}
|
1552
|
+
}
|
1553
|
+
return true;
|
1554
|
+
};
|
1555
|
+
|
1556
|
+
return Payment;
|
1557
|
+
|
1558
|
+
})();
|
1559
|
+
|
1560
|
+
module.exports = Payment;
|
1561
|
+
|
1562
|
+
global.Payment = Payment;
|
1563
|
+
|
1564
|
+
}).call(this);
|
1565
|
+
|
1566
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
1567
|
+
|
1568
|
+
/***/ },
|
1569
|
+
/* 7 */
|
1570
|
+
/***/ function(module, exports, __webpack_require__) {
|
1571
|
+
|
1572
|
+
module.exports = __webpack_require__(8);
|
1573
|
+
|
1574
|
+
|
1575
|
+
|
1576
|
+
/***/ },
|
1577
|
+
/* 8 */
|
1578
|
+
/***/ function(module, exports, __webpack_require__) {
|
1579
|
+
|
1580
|
+
/*!
|
1581
|
+
* node.extend
|
1582
|
+
* Copyright 2011, John Resig
|
1583
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1584
|
+
* http://jquery.org/license
|
1585
|
+
*
|
1586
|
+
* @fileoverview
|
1587
|
+
* Port of jQuery.extend that actually works on node.js
|
1588
|
+
*/
|
1589
|
+
var is = __webpack_require__(9);
|
1590
|
+
|
1591
|
+
function extend() {
|
1592
|
+
var target = arguments[0] || {};
|
1593
|
+
var i = 1;
|
1594
|
+
var length = arguments.length;
|
1595
|
+
var deep = false;
|
1596
|
+
var options, name, src, copy, copy_is_array, clone;
|
1597
|
+
|
1598
|
+
// Handle a deep copy situation
|
1599
|
+
if (typeof target === 'boolean') {
|
1600
|
+
deep = target;
|
1601
|
+
target = arguments[1] || {};
|
1602
|
+
// skip the boolean and the target
|
1603
|
+
i = 2;
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
// Handle case when target is a string or something (possible in deep copy)
|
1607
|
+
if (typeof target !== 'object' && !is.fn(target)) {
|
1608
|
+
target = {};
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
for (; i < length; i++) {
|
1612
|
+
// Only deal with non-null/undefined values
|
1613
|
+
options = arguments[i]
|
1614
|
+
if (options != null) {
|
1615
|
+
if (typeof options === 'string') {
|
1616
|
+
options = options.split('');
|
1617
|
+
}
|
1618
|
+
// Extend the base object
|
1619
|
+
for (name in options) {
|
1620
|
+
src = target[name];
|
1621
|
+
copy = options[name];
|
1622
|
+
|
1623
|
+
// Prevent never-ending loop
|
1624
|
+
if (target === copy) {
|
1625
|
+
continue;
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
// Recurse if we're merging plain objects or arrays
|
1629
|
+
if (deep && copy && (is.hash(copy) || (copy_is_array = is.array(copy)))) {
|
1630
|
+
if (copy_is_array) {
|
1631
|
+
copy_is_array = false;
|
1632
|
+
clone = src && is.array(src) ? src : [];
|
1633
|
+
} else {
|
1634
|
+
clone = src && is.hash(src) ? src : {};
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
// Never move original objects, clone them
|
1638
|
+
target[name] = extend(deep, clone, copy);
|
1639
|
+
|
1640
|
+
// Don't bring in undefined values
|
1641
|
+
} else if (typeof copy !== 'undefined') {
|
1642
|
+
target[name] = copy;
|
1643
|
+
}
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
}
|
1647
|
+
|
1648
|
+
// Return the modified object
|
1649
|
+
return target;
|
1650
|
+
};
|
1651
|
+
|
1652
|
+
/**
|
1653
|
+
* @public
|
1654
|
+
*/
|
1655
|
+
extend.version = '1.1.3';
|
1656
|
+
|
1657
|
+
/**
|
1658
|
+
* Exports module.
|
1659
|
+
*/
|
1660
|
+
module.exports = extend;
|
1661
|
+
|
1662
|
+
|
1663
|
+
|
1664
|
+
/***/ },
|
1665
|
+
/* 9 */
|
1666
|
+
/***/ function(module, exports) {
|
1667
|
+
|
1668
|
+
/* globals window, HTMLElement */
|
1669
|
+
/**!
|
1670
|
+
* is
|
1671
|
+
* the definitive JavaScript type testing library
|
1672
|
+
*
|
1673
|
+
* @copyright 2013-2014 Enrico Marino / Jordan Harband
|
1674
|
+
* @license MIT
|
1675
|
+
*/
|
1676
|
+
|
1677
|
+
var objProto = Object.prototype;
|
1678
|
+
var owns = objProto.hasOwnProperty;
|
1679
|
+
var toStr = objProto.toString;
|
1680
|
+
var symbolValueOf;
|
1681
|
+
if (typeof Symbol === 'function') {
|
1682
|
+
symbolValueOf = Symbol.prototype.valueOf;
|
1683
|
+
}
|
1684
|
+
var isActualNaN = function (value) {
|
1685
|
+
return value !== value;
|
1686
|
+
};
|
1687
|
+
var NON_HOST_TYPES = {
|
1688
|
+
'boolean': 1,
|
1689
|
+
number: 1,
|
1690
|
+
string: 1,
|
1691
|
+
undefined: 1
|
1692
|
+
};
|
1693
|
+
|
1694
|
+
var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
|
1695
|
+
var hexRegex = /^[A-Fa-f0-9]+$/;
|
1696
|
+
|
1697
|
+
/**
|
1698
|
+
* Expose `is`
|
1699
|
+
*/
|
1700
|
+
|
1701
|
+
var is = module.exports = {};
|
1702
|
+
|
1703
|
+
/**
|
1704
|
+
* Test general.
|
1705
|
+
*/
|
1706
|
+
|
1707
|
+
/**
|
1708
|
+
* is.type
|
1709
|
+
* Test if `value` is a type of `type`.
|
1710
|
+
*
|
1711
|
+
* @param {Mixed} value value to test
|
1712
|
+
* @param {String} type type
|
1713
|
+
* @return {Boolean} true if `value` is a type of `type`, false otherwise
|
1714
|
+
* @api public
|
1715
|
+
*/
|
1716
|
+
|
1717
|
+
is.a = is.type = function (value, type) {
|
1718
|
+
return typeof value === type;
|
1719
|
+
};
|
1720
|
+
|
1721
|
+
/**
|
1722
|
+
* is.defined
|
1723
|
+
* Test if `value` is defined.
|
1724
|
+
*
|
1725
|
+
* @param {Mixed} value value to test
|
1726
|
+
* @return {Boolean} true if 'value' is defined, false otherwise
|
1727
|
+
* @api public
|
1728
|
+
*/
|
1729
|
+
|
1730
|
+
is.defined = function (value) {
|
1731
|
+
return typeof value !== 'undefined';
|
1732
|
+
};
|
1733
|
+
|
1734
|
+
/**
|
1735
|
+
* is.empty
|
1736
|
+
* Test if `value` is empty.
|
1737
|
+
*
|
1738
|
+
* @param {Mixed} value value to test
|
1739
|
+
* @return {Boolean} true if `value` is empty, false otherwise
|
1740
|
+
* @api public
|
1741
|
+
*/
|
1742
|
+
|
1743
|
+
is.empty = function (value) {
|
1744
|
+
var type = toStr.call(value);
|
1745
|
+
var key;
|
1746
|
+
|
1747
|
+
if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {
|
1748
|
+
return value.length === 0;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
if (type === '[object Object]') {
|
1752
|
+
for (key in value) {
|
1753
|
+
if (owns.call(value, key)) { return false; }
|
1754
|
+
}
|
1755
|
+
return true;
|
1756
|
+
}
|
1757
|
+
|
1758
|
+
return !value;
|
1759
|
+
};
|
1760
|
+
|
1761
|
+
/**
|
1762
|
+
* is.equal
|
1763
|
+
* Test if `value` is equal to `other`.
|
1764
|
+
*
|
1765
|
+
* @param {Mixed} value value to test
|
1766
|
+
* @param {Mixed} other value to compare with
|
1767
|
+
* @return {Boolean} true if `value` is equal to `other`, false otherwise
|
1768
|
+
*/
|
1769
|
+
|
1770
|
+
is.equal = function equal(value, other) {
|
1771
|
+
if (value === other) {
|
1772
|
+
return true;
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
var type = toStr.call(value);
|
1776
|
+
var key;
|
1777
|
+
|
1778
|
+
if (type !== toStr.call(other)) {
|
1779
|
+
return false;
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
if (type === '[object Object]') {
|
1783
|
+
for (key in value) {
|
1784
|
+
if (!is.equal(value[key], other[key]) || !(key in other)) {
|
1785
|
+
return false;
|
1786
|
+
}
|
1787
|
+
}
|
1788
|
+
for (key in other) {
|
1789
|
+
if (!is.equal(value[key], other[key]) || !(key in value)) {
|
1790
|
+
return false;
|
1791
|
+
}
|
1792
|
+
}
|
1793
|
+
return true;
|
1794
|
+
}
|
1795
|
+
|
1796
|
+
if (type === '[object Array]') {
|
1797
|
+
key = value.length;
|
1798
|
+
if (key !== other.length) {
|
1799
|
+
return false;
|
1800
|
+
}
|
1801
|
+
while (--key) {
|
1802
|
+
if (!is.equal(value[key], other[key])) {
|
1803
|
+
return false;
|
1804
|
+
}
|
1805
|
+
}
|
1806
|
+
return true;
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
if (type === '[object Function]') {
|
1810
|
+
return value.prototype === other.prototype;
|
1811
|
+
}
|
1812
|
+
|
1813
|
+
if (type === '[object Date]') {
|
1814
|
+
return value.getTime() === other.getTime();
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
return false;
|
1818
|
+
};
|
1819
|
+
|
1820
|
+
/**
|
1821
|
+
* is.hosted
|
1822
|
+
* Test if `value` is hosted by `host`.
|
1823
|
+
*
|
1824
|
+
* @param {Mixed} value to test
|
1825
|
+
* @param {Mixed} host host to test with
|
1826
|
+
* @return {Boolean} true if `value` is hosted by `host`, false otherwise
|
1827
|
+
* @api public
|
1828
|
+
*/
|
1829
|
+
|
1830
|
+
is.hosted = function (value, host) {
|
1831
|
+
var type = typeof host[value];
|
1832
|
+
return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
|
1833
|
+
};
|
1834
|
+
|
1835
|
+
/**
|
1836
|
+
* is.instance
|
1837
|
+
* Test if `value` is an instance of `constructor`.
|
1838
|
+
*
|
1839
|
+
* @param {Mixed} value value to test
|
1840
|
+
* @return {Boolean} true if `value` is an instance of `constructor`
|
1841
|
+
* @api public
|
1842
|
+
*/
|
1843
|
+
|
1844
|
+
is.instance = is['instanceof'] = function (value, constructor) {
|
1845
|
+
return value instanceof constructor;
|
1846
|
+
};
|
1847
|
+
|
1848
|
+
/**
|
1849
|
+
* is.nil / is.null
|
1850
|
+
* Test if `value` is null.
|
1851
|
+
*
|
1852
|
+
* @param {Mixed} value value to test
|
1853
|
+
* @return {Boolean} true if `value` is null, false otherwise
|
1854
|
+
* @api public
|
1855
|
+
*/
|
1856
|
+
|
1857
|
+
is.nil = is['null'] = function (value) {
|
1858
|
+
return value === null;
|
1859
|
+
};
|
1860
|
+
|
1861
|
+
/**
|
1862
|
+
* is.undef / is.undefined
|
1863
|
+
* Test if `value` is undefined.
|
1864
|
+
*
|
1865
|
+
* @param {Mixed} value value to test
|
1866
|
+
* @return {Boolean} true if `value` is undefined, false otherwise
|
1867
|
+
* @api public
|
1868
|
+
*/
|
1869
|
+
|
1870
|
+
is.undef = is.undefined = function (value) {
|
1871
|
+
return typeof value === 'undefined';
|
1872
|
+
};
|
1873
|
+
|
1874
|
+
/**
|
1875
|
+
* Test arguments.
|
1876
|
+
*/
|
1877
|
+
|
1878
|
+
/**
|
1879
|
+
* is.args
|
1880
|
+
* Test if `value` is an arguments object.
|
1881
|
+
*
|
1882
|
+
* @param {Mixed} value value to test
|
1883
|
+
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
1884
|
+
* @api public
|
1885
|
+
*/
|
1886
|
+
|
1887
|
+
is.args = is.arguments = function (value) {
|
1888
|
+
var isStandardArguments = toStr.call(value) === '[object Arguments]';
|
1889
|
+
var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
|
1890
|
+
return isStandardArguments || isOldArguments;
|
1891
|
+
};
|
1892
|
+
|
1893
|
+
/**
|
1894
|
+
* Test array.
|
1895
|
+
*/
|
1896
|
+
|
1897
|
+
/**
|
1898
|
+
* is.array
|
1899
|
+
* Test if 'value' is an array.
|
1900
|
+
*
|
1901
|
+
* @param {Mixed} value value to test
|
1902
|
+
* @return {Boolean} true if `value` is an array, false otherwise
|
1903
|
+
* @api public
|
1904
|
+
*/
|
1905
|
+
|
1906
|
+
is.array = Array.isArray || function (value) {
|
1907
|
+
return toStr.call(value) === '[object Array]';
|
1908
|
+
};
|
1909
|
+
|
1910
|
+
/**
|
1911
|
+
* is.arguments.empty
|
1912
|
+
* Test if `value` is an empty arguments object.
|
1913
|
+
*
|
1914
|
+
* @param {Mixed} value value to test
|
1915
|
+
* @return {Boolean} true if `value` is an empty arguments object, false otherwise
|
1916
|
+
* @api public
|
1917
|
+
*/
|
1918
|
+
is.args.empty = function (value) {
|
1919
|
+
return is.args(value) && value.length === 0;
|
1920
|
+
};
|
1921
|
+
|
1922
|
+
/**
|
1923
|
+
* is.array.empty
|
1924
|
+
* Test if `value` is an empty array.
|
1925
|
+
*
|
1926
|
+
* @param {Mixed} value value to test
|
1927
|
+
* @return {Boolean} true if `value` is an empty array, false otherwise
|
1928
|
+
* @api public
|
1929
|
+
*/
|
1930
|
+
is.array.empty = function (value) {
|
1931
|
+
return is.array(value) && value.length === 0;
|
1932
|
+
};
|
1933
|
+
|
1934
|
+
/**
|
1935
|
+
* is.arraylike
|
1936
|
+
* Test if `value` is an arraylike object.
|
1937
|
+
*
|
1938
|
+
* @param {Mixed} value value to test
|
1939
|
+
* @return {Boolean} true if `value` is an arguments object, false otherwise
|
1940
|
+
* @api public
|
1941
|
+
*/
|
1942
|
+
|
1943
|
+
is.arraylike = function (value) {
|
1944
|
+
return !!value && !is.bool(value)
|
1945
|
+
&& owns.call(value, 'length')
|
1946
|
+
&& isFinite(value.length)
|
1947
|
+
&& is.number(value.length)
|
1948
|
+
&& value.length >= 0;
|
1949
|
+
};
|
1950
|
+
|
1951
|
+
/**
|
1952
|
+
* Test boolean.
|
1953
|
+
*/
|
1954
|
+
|
1955
|
+
/**
|
1956
|
+
* is.bool
|
1957
|
+
* Test if `value` is a boolean.
|
1958
|
+
*
|
1959
|
+
* @param {Mixed} value value to test
|
1960
|
+
* @return {Boolean} true if `value` is a boolean, false otherwise
|
1961
|
+
* @api public
|
1962
|
+
*/
|
1963
|
+
|
1964
|
+
is.bool = is['boolean'] = function (value) {
|
1965
|
+
return toStr.call(value) === '[object Boolean]';
|
1966
|
+
};
|
1967
|
+
|
1968
|
+
/**
|
1969
|
+
* is.false
|
1970
|
+
* Test if `value` is false.
|
1971
|
+
*
|
1972
|
+
* @param {Mixed} value value to test
|
1973
|
+
* @return {Boolean} true if `value` is false, false otherwise
|
1974
|
+
* @api public
|
1975
|
+
*/
|
1976
|
+
|
1977
|
+
is['false'] = function (value) {
|
1978
|
+
return is.bool(value) && Boolean(Number(value)) === false;
|
1979
|
+
};
|
1980
|
+
|
1981
|
+
/**
|
1982
|
+
* is.true
|
1983
|
+
* Test if `value` is true.
|
1984
|
+
*
|
1985
|
+
* @param {Mixed} value value to test
|
1986
|
+
* @return {Boolean} true if `value` is true, false otherwise
|
1987
|
+
* @api public
|
1988
|
+
*/
|
1989
|
+
|
1990
|
+
is['true'] = function (value) {
|
1991
|
+
return is.bool(value) && Boolean(Number(value)) === true;
|
1992
|
+
};
|
1993
|
+
|
1994
|
+
/**
|
1995
|
+
* Test date.
|
1996
|
+
*/
|
1997
|
+
|
1998
|
+
/**
|
1999
|
+
* is.date
|
2000
|
+
* Test if `value` is a date.
|
2001
|
+
*
|
2002
|
+
* @param {Mixed} value value to test
|
2003
|
+
* @return {Boolean} true if `value` is a date, false otherwise
|
2004
|
+
* @api public
|
2005
|
+
*/
|
2006
|
+
|
2007
|
+
is.date = function (value) {
|
2008
|
+
return toStr.call(value) === '[object Date]';
|
2009
|
+
};
|
2010
|
+
|
2011
|
+
/**
|
2012
|
+
* Test element.
|
2013
|
+
*/
|
2014
|
+
|
2015
|
+
/**
|
2016
|
+
* is.element
|
2017
|
+
* Test if `value` is an html element.
|
2018
|
+
*
|
2019
|
+
* @param {Mixed} value value to test
|
2020
|
+
* @return {Boolean} true if `value` is an HTML Element, false otherwise
|
2021
|
+
* @api public
|
2022
|
+
*/
|
2023
|
+
|
2024
|
+
is.element = function (value) {
|
2025
|
+
return value !== undefined
|
2026
|
+
&& typeof HTMLElement !== 'undefined'
|
2027
|
+
&& value instanceof HTMLElement
|
2028
|
+
&& value.nodeType === 1;
|
2029
|
+
};
|
2030
|
+
|
2031
|
+
/**
|
2032
|
+
* Test error.
|
2033
|
+
*/
|
2034
|
+
|
2035
|
+
/**
|
2036
|
+
* is.error
|
2037
|
+
* Test if `value` is an error object.
|
2038
|
+
*
|
2039
|
+
* @param {Mixed} value value to test
|
2040
|
+
* @return {Boolean} true if `value` is an error object, false otherwise
|
2041
|
+
* @api public
|
2042
|
+
*/
|
2043
|
+
|
2044
|
+
is.error = function (value) {
|
2045
|
+
return toStr.call(value) === '[object Error]';
|
2046
|
+
};
|
2047
|
+
|
2048
|
+
/**
|
2049
|
+
* Test function.
|
2050
|
+
*/
|
2051
|
+
|
2052
|
+
/**
|
2053
|
+
* is.fn / is.function (deprecated)
|
2054
|
+
* Test if `value` is a function.
|
2055
|
+
*
|
2056
|
+
* @param {Mixed} value value to test
|
2057
|
+
* @return {Boolean} true if `value` is a function, false otherwise
|
2058
|
+
* @api public
|
2059
|
+
*/
|
2060
|
+
|
2061
|
+
is.fn = is['function'] = function (value) {
|
2062
|
+
var isAlert = typeof window !== 'undefined' && value === window.alert;
|
2063
|
+
return isAlert || toStr.call(value) === '[object Function]';
|
2064
|
+
};
|
2065
|
+
|
2066
|
+
/**
|
2067
|
+
* Test number.
|
2068
|
+
*/
|
2069
|
+
|
2070
|
+
/**
|
2071
|
+
* is.number
|
2072
|
+
* Test if `value` is a number.
|
2073
|
+
*
|
2074
|
+
* @param {Mixed} value value to test
|
2075
|
+
* @return {Boolean} true if `value` is a number, false otherwise
|
2076
|
+
* @api public
|
2077
|
+
*/
|
2078
|
+
|
2079
|
+
is.number = function (value) {
|
2080
|
+
return toStr.call(value) === '[object Number]';
|
2081
|
+
};
|
2082
|
+
|
2083
|
+
/**
|
2084
|
+
* is.infinite
|
2085
|
+
* Test if `value` is positive or negative infinity.
|
2086
|
+
*
|
2087
|
+
* @param {Mixed} value value to test
|
2088
|
+
* @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
|
2089
|
+
* @api public
|
2090
|
+
*/
|
2091
|
+
is.infinite = function (value) {
|
2092
|
+
return value === Infinity || value === -Infinity;
|
2093
|
+
};
|
2094
|
+
|
2095
|
+
/**
|
2096
|
+
* is.decimal
|
2097
|
+
* Test if `value` is a decimal number.
|
2098
|
+
*
|
2099
|
+
* @param {Mixed} value value to test
|
2100
|
+
* @return {Boolean} true if `value` is a decimal number, false otherwise
|
2101
|
+
* @api public
|
2102
|
+
*/
|
2103
|
+
|
2104
|
+
is.decimal = function (value) {
|
2105
|
+
return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
|
2106
|
+
};
|
2107
|
+
|
2108
|
+
/**
|
2109
|
+
* is.divisibleBy
|
2110
|
+
* Test if `value` is divisible by `n`.
|
2111
|
+
*
|
2112
|
+
* @param {Number} value value to test
|
2113
|
+
* @param {Number} n dividend
|
2114
|
+
* @return {Boolean} true if `value` is divisible by `n`, false otherwise
|
2115
|
+
* @api public
|
2116
|
+
*/
|
2117
|
+
|
2118
|
+
is.divisibleBy = function (value, n) {
|
2119
|
+
var isDividendInfinite = is.infinite(value);
|
2120
|
+
var isDivisorInfinite = is.infinite(n);
|
2121
|
+
var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
|
2122
|
+
return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
|
2123
|
+
};
|
2124
|
+
|
2125
|
+
/**
|
2126
|
+
* is.integer
|
2127
|
+
* Test if `value` is an integer.
|
2128
|
+
*
|
2129
|
+
* @param value to test
|
2130
|
+
* @return {Boolean} true if `value` is an integer, false otherwise
|
2131
|
+
* @api public
|
2132
|
+
*/
|
2133
|
+
|
2134
|
+
is.integer = is['int'] = function (value) {
|
2135
|
+
return is.number(value) && !isActualNaN(value) && value % 1 === 0;
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
/**
|
2139
|
+
* is.maximum
|
2140
|
+
* Test if `value` is greater than 'others' values.
|
2141
|
+
*
|
2142
|
+
* @param {Number} value value to test
|
2143
|
+
* @param {Array} others values to compare with
|
2144
|
+
* @return {Boolean} true if `value` is greater than `others` values
|
2145
|
+
* @api public
|
2146
|
+
*/
|
2147
|
+
|
2148
|
+
is.maximum = function (value, others) {
|
2149
|
+
if (isActualNaN(value)) {
|
2150
|
+
throw new TypeError('NaN is not a valid value');
|
2151
|
+
} else if (!is.arraylike(others)) {
|
2152
|
+
throw new TypeError('second argument must be array-like');
|
2153
|
+
}
|
2154
|
+
var len = others.length;
|
2155
|
+
|
2156
|
+
while (--len >= 0) {
|
2157
|
+
if (value < others[len]) {
|
2158
|
+
return false;
|
2159
|
+
}
|
2160
|
+
}
|
2161
|
+
|
2162
|
+
return true;
|
2163
|
+
};
|
2164
|
+
|
2165
|
+
/**
|
2166
|
+
* is.minimum
|
2167
|
+
* Test if `value` is less than `others` values.
|
2168
|
+
*
|
2169
|
+
* @param {Number} value value to test
|
2170
|
+
* @param {Array} others values to compare with
|
2171
|
+
* @return {Boolean} true if `value` is less than `others` values
|
2172
|
+
* @api public
|
2173
|
+
*/
|
2174
|
+
|
2175
|
+
is.minimum = function (value, others) {
|
2176
|
+
if (isActualNaN(value)) {
|
2177
|
+
throw new TypeError('NaN is not a valid value');
|
2178
|
+
} else if (!is.arraylike(others)) {
|
2179
|
+
throw new TypeError('second argument must be array-like');
|
2180
|
+
}
|
2181
|
+
var len = others.length;
|
2182
|
+
|
2183
|
+
while (--len >= 0) {
|
2184
|
+
if (value > others[len]) {
|
2185
|
+
return false;
|
2186
|
+
}
|
2187
|
+
}
|
2188
|
+
|
2189
|
+
return true;
|
2190
|
+
};
|
2191
|
+
|
2192
|
+
/**
|
2193
|
+
* is.nan
|
2194
|
+
* Test if `value` is not a number.
|
2195
|
+
*
|
2196
|
+
* @param {Mixed} value value to test
|
2197
|
+
* @return {Boolean} true if `value` is not a number, false otherwise
|
2198
|
+
* @api public
|
2199
|
+
*/
|
2200
|
+
|
2201
|
+
is.nan = function (value) {
|
2202
|
+
return !is.number(value) || value !== value;
|
2203
|
+
};
|
2204
|
+
|
2205
|
+
/**
|
2206
|
+
* is.even
|
2207
|
+
* Test if `value` is an even number.
|
2208
|
+
*
|
2209
|
+
* @param {Number} value value to test
|
2210
|
+
* @return {Boolean} true if `value` is an even number, false otherwise
|
2211
|
+
* @api public
|
2212
|
+
*/
|
2213
|
+
|
2214
|
+
is.even = function (value) {
|
2215
|
+
return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
|
2216
|
+
};
|
2217
|
+
|
2218
|
+
/**
|
2219
|
+
* is.odd
|
2220
|
+
* Test if `value` is an odd number.
|
2221
|
+
*
|
2222
|
+
* @param {Number} value value to test
|
2223
|
+
* @return {Boolean} true if `value` is an odd number, false otherwise
|
2224
|
+
* @api public
|
2225
|
+
*/
|
2226
|
+
|
2227
|
+
is.odd = function (value) {
|
2228
|
+
return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
|
2229
|
+
};
|
2230
|
+
|
2231
|
+
/**
|
2232
|
+
* is.ge
|
2233
|
+
* Test if `value` is greater than or equal to `other`.
|
2234
|
+
*
|
2235
|
+
* @param {Number} value value to test
|
2236
|
+
* @param {Number} other value to compare with
|
2237
|
+
* @return {Boolean}
|
2238
|
+
* @api public
|
2239
|
+
*/
|
2240
|
+
|
2241
|
+
is.ge = function (value, other) {
|
2242
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2243
|
+
throw new TypeError('NaN is not a valid value');
|
2244
|
+
}
|
2245
|
+
return !is.infinite(value) && !is.infinite(other) && value >= other;
|
2246
|
+
};
|
2247
|
+
|
2248
|
+
/**
|
2249
|
+
* is.gt
|
2250
|
+
* Test if `value` is greater than `other`.
|
2251
|
+
*
|
2252
|
+
* @param {Number} value value to test
|
2253
|
+
* @param {Number} other value to compare with
|
2254
|
+
* @return {Boolean}
|
2255
|
+
* @api public
|
2256
|
+
*/
|
2257
|
+
|
2258
|
+
is.gt = function (value, other) {
|
2259
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2260
|
+
throw new TypeError('NaN is not a valid value');
|
2261
|
+
}
|
2262
|
+
return !is.infinite(value) && !is.infinite(other) && value > other;
|
2263
|
+
};
|
2264
|
+
|
2265
|
+
/**
|
2266
|
+
* is.le
|
2267
|
+
* Test if `value` is less than or equal to `other`.
|
2268
|
+
*
|
2269
|
+
* @param {Number} value value to test
|
2270
|
+
* @param {Number} other value to compare with
|
2271
|
+
* @return {Boolean} if 'value' is less than or equal to 'other'
|
2272
|
+
* @api public
|
2273
|
+
*/
|
2274
|
+
|
2275
|
+
is.le = function (value, other) {
|
2276
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2277
|
+
throw new TypeError('NaN is not a valid value');
|
2278
|
+
}
|
2279
|
+
return !is.infinite(value) && !is.infinite(other) && value <= other;
|
2280
|
+
};
|
2281
|
+
|
2282
|
+
/**
|
2283
|
+
* is.lt
|
2284
|
+
* Test if `value` is less than `other`.
|
2285
|
+
*
|
2286
|
+
* @param {Number} value value to test
|
2287
|
+
* @param {Number} other value to compare with
|
2288
|
+
* @return {Boolean} if `value` is less than `other`
|
2289
|
+
* @api public
|
2290
|
+
*/
|
2291
|
+
|
2292
|
+
is.lt = function (value, other) {
|
2293
|
+
if (isActualNaN(value) || isActualNaN(other)) {
|
2294
|
+
throw new TypeError('NaN is not a valid value');
|
2295
|
+
}
|
2296
|
+
return !is.infinite(value) && !is.infinite(other) && value < other;
|
2297
|
+
};
|
2298
|
+
|
2299
|
+
/**
|
2300
|
+
* is.within
|
2301
|
+
* Test if `value` is within `start` and `finish`.
|
2302
|
+
*
|
2303
|
+
* @param {Number} value value to test
|
2304
|
+
* @param {Number} start lower bound
|
2305
|
+
* @param {Number} finish upper bound
|
2306
|
+
* @return {Boolean} true if 'value' is is within 'start' and 'finish'
|
2307
|
+
* @api public
|
2308
|
+
*/
|
2309
|
+
is.within = function (value, start, finish) {
|
2310
|
+
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
|
2311
|
+
throw new TypeError('NaN is not a valid value');
|
2312
|
+
} else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
|
2313
|
+
throw new TypeError('all arguments must be numbers');
|
2314
|
+
}
|
2315
|
+
var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
|
2316
|
+
return isAnyInfinite || (value >= start && value <= finish);
|
2317
|
+
};
|
2318
|
+
|
2319
|
+
/**
|
2320
|
+
* Test object.
|
2321
|
+
*/
|
2322
|
+
|
2323
|
+
/**
|
2324
|
+
* is.object
|
2325
|
+
* Test if `value` is an object.
|
2326
|
+
*
|
2327
|
+
* @param {Mixed} value value to test
|
2328
|
+
* @return {Boolean} true if `value` is an object, false otherwise
|
2329
|
+
* @api public
|
2330
|
+
*/
|
2331
|
+
|
2332
|
+
is.object = function (value) {
|
2333
|
+
return toStr.call(value) === '[object Object]';
|
2334
|
+
};
|
2335
|
+
|
2336
|
+
/**
|
2337
|
+
* is.hash
|
2338
|
+
* Test if `value` is a hash - a plain object literal.
|
2339
|
+
*
|
2340
|
+
* @param {Mixed} value value to test
|
2341
|
+
* @return {Boolean} true if `value` is a hash, false otherwise
|
2342
|
+
* @api public
|
2343
|
+
*/
|
2344
|
+
|
2345
|
+
is.hash = function (value) {
|
2346
|
+
return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
|
2347
|
+
};
|
2348
|
+
|
2349
|
+
/**
|
2350
|
+
* Test regexp.
|
2351
|
+
*/
|
2352
|
+
|
2353
|
+
/**
|
2354
|
+
* is.regexp
|
2355
|
+
* Test if `value` is a regular expression.
|
2356
|
+
*
|
2357
|
+
* @param {Mixed} value value to test
|
2358
|
+
* @return {Boolean} true if `value` is a regexp, false otherwise
|
2359
|
+
* @api public
|
2360
|
+
*/
|
2361
|
+
|
2362
|
+
is.regexp = function (value) {
|
2363
|
+
return toStr.call(value) === '[object RegExp]';
|
2364
|
+
};
|
2365
|
+
|
2366
|
+
/**
|
2367
|
+
* Test string.
|
2368
|
+
*/
|
2369
|
+
|
2370
|
+
/**
|
2371
|
+
* is.string
|
2372
|
+
* Test if `value` is a string.
|
2373
|
+
*
|
2374
|
+
* @param {Mixed} value value to test
|
2375
|
+
* @return {Boolean} true if 'value' is a string, false otherwise
|
2376
|
+
* @api public
|
2377
|
+
*/
|
2378
|
+
|
2379
|
+
is.string = function (value) {
|
2380
|
+
return toStr.call(value) === '[object String]';
|
2381
|
+
};
|
2382
|
+
|
2383
|
+
/**
|
2384
|
+
* Test base64 string.
|
2385
|
+
*/
|
2386
|
+
|
2387
|
+
/**
|
2388
|
+
* is.base64
|
2389
|
+
* Test if `value` is a valid base64 encoded string.
|
2390
|
+
*
|
2391
|
+
* @param {Mixed} value value to test
|
2392
|
+
* @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
|
2393
|
+
* @api public
|
2394
|
+
*/
|
2395
|
+
|
2396
|
+
is.base64 = function (value) {
|
2397
|
+
return is.string(value) && (!value.length || base64Regex.test(value));
|
2398
|
+
};
|
2399
|
+
|
2400
|
+
/**
|
2401
|
+
* Test base64 string.
|
2402
|
+
*/
|
2403
|
+
|
2404
|
+
/**
|
2405
|
+
* is.hex
|
2406
|
+
* Test if `value` is a valid hex encoded string.
|
2407
|
+
*
|
2408
|
+
* @param {Mixed} value value to test
|
2409
|
+
* @return {Boolean} true if 'value' is a hex encoded string, false otherwise
|
2410
|
+
* @api public
|
2411
|
+
*/
|
2412
|
+
|
2413
|
+
is.hex = function (value) {
|
2414
|
+
return is.string(value) && (!value.length || hexRegex.test(value));
|
2415
|
+
};
|
2416
|
+
|
2417
|
+
/**
|
2418
|
+
* is.symbol
|
2419
|
+
* Test if `value` is an ES6 Symbol
|
2420
|
+
*
|
2421
|
+
* @param {Mixed} value value to test
|
2422
|
+
* @return {Boolean} true if `value` is a Symbol, false otherise
|
2423
|
+
* @api public
|
2424
|
+
*/
|
2425
|
+
|
2426
|
+
is.symbol = function (value) {
|
2427
|
+
return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';
|
2428
|
+
};
|
2429
|
+
|
2430
|
+
|
2431
|
+
/***/ }
|
2432
|
+
/******/ ]);
|