All-in-One WP Migration - Version 6.50

Version Description

Fixed

  • Stuck on preparing to import
Download this release

Release Info

Developer yani.iliev
Plugin Icon 128x128 All-in-One WP Migration
Version 6.50
Comparing to
See all releases

Code changes from version 6.49 to 6.50

all-in-one-wp-migration.php CHANGED
@@ -5,7 +5,7 @@
5
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
6
* Author: ServMask
7
* Author URI: https://servmask.com/
8
- * Version: 6.49
9
* Text Domain: all-in-one-wp-migration
10
* Domain Path: /languages
11
* Network: True
5
* Description: Migration tool for all your blog data. Import or Export your blog content with a single click.
6
* Author: ServMask
7
* Author URI: https://servmask.com/
8
+ * Version: 6.50
9
* Text Domain: all-in-one-wp-migration
10
* Domain Path: /languages
11
* Network: True
constants.php CHANGED
@@ -31,7 +31,7 @@ define( 'AI1WM_DEBUG', false );
31
// ==================
32
// = Plugin Version =
33
// ==================
34
- define( 'AI1WM_VERSION', '6.49' );
35
36
// ===============
37
// = Plugin Name =
31
// ==================
32
// = Plugin Version =
33
// ==================
34
+ define( 'AI1WM_VERSION', '6.50' );
35
36
// ===============
37
// = Plugin Name =
lib/view/assets/javascript/import.min.js CHANGED
@@ -47,7 +47,7 @@
47
'use strict';
48
49
/**
50
- * Copyright (C) 2014-2016 ServMask Inc.
51
*
52
* This program is free software: you can redistribute it and/or modify
53
* it under the terms of the GNU General Public License as published by
@@ -71,7 +71,7 @@
71
*/
72
73
var Report = __webpack_require__(1),
74
- Feedback = __webpack_require__(2),
75
Deprecated = __webpack_require__(8),
76
FileUploader = __webpack_require__(12);
77
@@ -89,12 +89,12 @@
89
90
/***/ },
91
/* 1 */
92
- /***/ function(module, exports) {
93
94
'use strict';
95
96
/**
97
- * Copyright (C) 2014-2016 ServMask Inc.
98
*
99
* This program is free software: you can redistribute it and/or modify
100
* it under the terms of the GNU General Public License as published by
@@ -117,6 +117,8 @@
117
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
118
*/
119
120
jQuery(document).ready(function ($) {
121
'use strict';
122
@@ -138,33 +140,35 @@
138
var terms = $('.ai1wm-report-terms').is(':checked');
139
140
$.ajax({
141
- type: 'POST',
142
url: ai1wm_report.ajax.url,
143
- data: { 'ai1wm-email': email, 'ai1wm-message': message, 'ai1wm-terms': +terms },
144
success: function success(data) {
145
- var errors = data.errors;
146
- if (errors.length > 0) {
147
// Reset previous messages
148
$('.ai1wm-report-problem-dialog .ai1wm-message').remove();
149
150
- var content = $('<div />').addClass('ai1wm-message ai1wm-error-message');
151
- $.each(errors, function (key, value) {
152
- content.append('<p>' + value + '</p>');
153
});
154
155
- $('.ai1wm-report-problem-dialog').prepend(content);
156
} else {
157
- var _content = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your request!</p>');
158
- $('.ai1wm-report-problem-dialog').html(_content);
159
160
// Hide message
161
setTimeout(function () {
162
$('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active');
163
}, 2000);
164
}
165
- },
166
- dataType: 'json',
167
- async: false
168
});
169
});
170
});
@@ -176,7 +180,87 @@
176
'use strict';
177
178
/**
179
- * Copyright (C) 2014-2016 ServMask Inc.
180
*
181
* This program is free software: you can redistribute it and/or modify
182
* it under the terms of the GNU General Public License as published by
@@ -199,6 +283,8 @@
199
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
200
*/
201
202
jQuery(document).ready(function ($) {
203
'use strict';
204
@@ -257,102 +343,34 @@
257
var terms = $('.ai1wm-feedback-terms').is(':checked');
258
259
$.ajax({
260
- type: 'POST',
261
url: ai1wm_feedback.ajax.url,
262
- data: { 'ai1wm-type': type, 'ai1wm-email': email, 'ai1wm-message': message, 'ai1wm-terms': +terms },
263
success: function success(data) {
264
- var errors = data.errors;
265
- if (errors.length > 0) {
266
// Reset previous messages
267
$('.ai1wm-feedback .ai1wm-message').remove();
268
269
- var content = $('<div />').addClass('ai1wm-message ai1wm-error-message');
270
- $.each(errors, function (key, value) {
271
- content.append('<p>' + value + '</p>');
272
});
273
274
- $('.ai1wm-feedback').prepend(content);
275
} else {
276
- var _content = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your feedback!</p>');
277
- $('.ai1wm-feedback').html(_content);
278
}
279
- },
280
- dataType: 'json',
281
- async: false
282
});
283
});
284
});
285
286
- /***/ },
287
- /* 3 */
288
- /***/ function(module, exports) {
289
-
290
- 'use strict';
291
-
292
- /**
293
- * Copyright (C) 2014-2016 ServMask Inc.
294
- *
295
- * This program is free software: you can redistribute it and/or modify
296
- * it under the terms of the GNU General Public License as published by
297
- * the Free Software Foundation, either version 3 of the License, or
298
- * (at your option) any later version.
299
- *
300
- * This program is distributed in the hope that it will be useful,
301
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
302
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303
- * GNU General Public License for more details.
304
- *
305
- * You should have received a copy of the GNU General Public License
306
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
307
- *
308
- * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
309
- * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
310
- * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
311
- * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
312
- * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
313
- * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
314
- */
315
-
316
- var $ = jQuery;
317
-
318
- module.exports = {
319
- random: function random(len) {
320
- var text = '';
321
- var possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
322
-
323
- for (var i = 0; i < len; i++) {
324
- text += possible.charAt(Math.floor(Math.random() * possible.length));
325
- }
326
-
327
- return text;
328
- },
329
- form: function form(id) {
330
- return $(id).serializeArray();
331
- },
332
- ucfirst: function ucfirst(text) {
333
- return text.charAt(0).toUpperCase() + text.slice(1);
334
- },
335
- list: function list(input) {
336
- // Convert object to list
337
- if ($.isPlainObject(input)) {
338
- var result = [];
339
- var params = decodeURIComponent($.param(input)).split('&');
340
-
341
- // Loop over params
342
- $.each(params, function (index, item) {
343
- var value = item.split('=');
344
-
345
- // Add item
346
- result.push({ name: value[0], value: value[1] });
347
- });
348
-
349
- return result;
350
- }
351
-
352
- return input;
353
- }
354
- };
355
-
356
/***/ },
357
/* 4 */
358
/***/ function(module, exports, __webpack_require__) {
@@ -360,7 +378,7 @@
360
'use strict';
361
362
/**
363
- * Copyright (C) 2014-2016 ServMask Inc.
364
*
365
* This program is free software: you can redistribute it and/or modify
366
* it under the terms of the GNU General Public License as published by
@@ -383,7 +401,7 @@
383
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
384
*/
385
386
- var Util = __webpack_require__(3),
387
Modal = __webpack_require__(5),
388
$ = jQuery;
389
@@ -393,6 +411,9 @@
393
// Set params
394
this.params = [];
395
396
// Set modal
397
this.modal = new Modal();
398
@@ -416,17 +437,25 @@
416
this.params = Util.list(params);
417
};
418
419
- Import.prototype.start = function (options) {
420
var self = this;
421
422
// Initializing beforeunload event
423
$(window).bind('beforeunload', function () {
424
return 'You are about to stop importing your website, are you sure?';
425
});
426
427
- // Set stop
428
- this.stop = false;
429
-
430
// Set initial status
431
this.setStatus({ type: 'info', message: 'Preparing to import...' });
432
@@ -439,18 +468,74 @@
439
}
440
441
// Import
442
- $.post(ai1wm_import.ajax.url, params).done(function () {
443
self.getStatus();
444
}).fail(function () {
445
- self.setStatus({
446
- type: 'error',
447
- message: 'Unable to start the import. Refresh the page and try again'
448
- });
449
});
450
};
451
452
- Import.prototype.confirm = function (options) {
453
var self = this;
454
455
// Set params
456
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -461,18 +546,43 @@
461
}
462
463
// Confirm
464
- $.post(ai1wm_import.ajax.url, params).done(function () {
465
self.getStatus();
466
}).fail(function () {
467
- self.setStatus({
468
- type: 'error',
469
- message: 'Unable to confirm the import. Refresh the page and try again'
470
- });
471
});
472
};
473
474
- Import.prototype.blogs = function (options) {
475
var self = this;
476
477
// Set params
478
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
@@ -483,21 +593,44 @@
483
}
484
485
// Blogs
486
- $.post(ai1wm_import.ajax.url, params).done(function () {
487
self.getStatus();
488
}).fail(function () {
489
- self.setStatus({
490
- type: 'error',
491
- message: 'Unable to prepare blogs the import. Refresh the page and try again'
492
- });
493
});
494
};
495
496
- Import.prototype.clean = function (options) {
497
var self = this;
498
499
- // Set stop
500
- this.stop = true;
501
502
// Set params
503
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
@@ -508,14 +641,32 @@
508
}
509
510
// Clean
511
- $.post(ai1wm_import.ajax.url, params).done(function () {
512
// Unbinding the beforeunload event when we stop importing
513
$(window).unbind('beforeunload');
514
}).fail(function () {
515
- self.setStatus({
516
- type: 'error',
517
- message: 'Unable to clean the import. Refresh the page and try again'
518
- });
519
});
520
};
521
@@ -523,14 +674,18 @@
523
var self = this;
524
525
// Stop getting status
526
- if (this.stop) {
527
return;
528
}
529
530
$.ajax({
531
- cache: false,
532
url: ai1wm_import.status.url,
533
- dataType: 'json'
534
}).done(function (params) {
535
if (params) {
536
self.setStatus(params);
@@ -550,14 +705,10 @@
550
}
551
552
// Import is not done yet, let's check status in 3 seconds
553
- setTimeout(function () {
554
- self.getStatus();
555
- }, 3000);
556
}).fail(function () {
557
// Import is not done yet, let's check status in 3 seconds
558
- setTimeout(function () {
559
- self.getStatus();
560
- }, 3000);
561
});;
562
};
563
@@ -586,7 +737,7 @@
586
'use strict';
587
588
/**
589
- * Copyright (C) 2014-2016 ServMask Inc.
590
*
591
* This program is free software: you can redistribute it and/or modify
592
* it under the terms of the GNU General Public License as published by
@@ -637,9 +788,8 @@
637
var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
638
639
// Create close button
640
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
641
- self.modal.hide();
642
- self.overlay.hide();
643
});
644
645
// Append close button
@@ -662,6 +812,7 @@
662
// Progress Modal
663
this.progress = function (params) {
664
if (this.view === 'progress') {
665
// Update progressBarMeter
666
this.progress.progressBarMeter.width(params.percent + '%');
667
@@ -694,11 +845,9 @@
694
this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
695
696
// Create stop import
697
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
698
$(this).attr('disabled', 'disabled');
699
self.onStop();
700
- self.modal.hide();
701
- self.overlay.hide();
702
});
703
704
// Append progress meter and progress percent
@@ -744,7 +893,7 @@
744
var warning = $('<span class="ai1wm-icon-notification"></span>');
745
746
// Create confirm button
747
- var confirmButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
748
$(this).attr('disabled', 'disabled');
749
self.onConfirm();
750
});
@@ -788,7 +937,7 @@
788
var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
789
790
// Create continue button
791
- var continueButton = $('<button class="ai1wm-button-green">Continue</button>').on('click', function () {
792
$(this).attr('disabled', 'disabled');
793
self.onBlogs($(this).closest('form').serializeArray());
794
});
@@ -832,7 +981,7 @@
832
var loader = $('<span class="ai1wm-loader"></span>');
833
834
// Create stop import
835
- var stopButton = $('<button class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
836
837
// Append stop button
838
action.append(stopButton);
@@ -873,9 +1022,8 @@
873
var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
874
875
// Create close button
876
- var closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
877
- self.modal.hide();
878
- self.overlay.hide();
879
});
880
881
// Append close button
@@ -937,6 +1085,11 @@
937
this.view = params.type;
938
};
939
940
module.exports = Modal;
941
942
/***/ },
@@ -948,7 +1101,7 @@
948
'use strict';
949
950
/**
951
- * Copyright (C) 2014-2016 ServMask Inc.
952
*
953
* This program is free software: you can redistribute it and/or modify
954
* it under the terms of the GNU General Public License as published by
@@ -971,37 +1124,70 @@
971
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
972
*/
973
974
- var Util = __webpack_require__(3),
975
Dialog = __webpack_require__(9);
976
977
var Extensions = {
978
- 's3': 'Amazon S3 Extension',
979
- 'url': 'URL Extension',
980
- 'ftp': 'FTP Extension',
981
- 'gdrive': 'Google Drive Extension',
982
- 'dropbox': 'Dropbox Extension'
983
};
984
985
window.Ai1wmExportController = function (provider) {
986
- this._export = {};
987
- this._provider = provider;
988
};
989
990
window.Ai1wmExportController.prototype.start = function () {
991
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
992
};
993
994
window.Ai1wmImportController = function (provider) {
995
- this._import = {};
996
- this._provider = provider;
997
};
998
999
window.Ai1wmImportController.prototype.init = function () {};
1000
1001
window.Ai1wmImportController.prototype.download = function () {
1002
- new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1003
};
1004
1005
/***/ },
1006
/* 9 */
1007
/***/ function(module, exports) {
@@ -1009,7 +1195,7 @@
1009
'use strict';
1010
1011
/**
1012
- * Copyright (C) 2014-2016 ServMask Inc.
1013
*
1014
* This program is free software: you can redistribute it and/or modify
1015
* it under the terms of the GNU General Public License as published by
@@ -1056,7 +1242,7 @@
1056
this.action = $('<div></div>');
1057
1058
// Create close button
1059
- this.closeButton = $('<button class="ai1wm-button-red">Close</button>').on('click', function () {
1060
self.modal.hide();
1061
self.overlay.hide();
1062
});
@@ -1088,7 +1274,7 @@
1088
/* WEBPACK VAR INJECTION */(function(fetch, global) {'use strict';
1089
1090
/**
1091
- * Copyright (C) 2014-2016 ServMask Inc.
1092
*
1093
* This program is free software: you can redistribute it and/or modify
1094
* it under the terms of the GNU General Public License as published by
@@ -1111,7 +1297,7 @@
1111
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
1112
*/
1113
1114
- var Util = __webpack_require__(3),
1115
Import = __webpack_require__(4),
1116
$ = jQuery;
1117
@@ -1120,7 +1306,6 @@
1120
FileUploader.prototype.setDefaultValues = function () {
1121
this.model = new Import();
1122
this.stopUpload = false;
1123
- this.retries = 0;
1124
};
1125
1126
FileUploader.prototype.init = function () {
@@ -1172,11 +1357,14 @@
1172
});
1173
};
1174
1175
- FileUploader.prototype.upload = function (file) {
1176
var _this2 = this;
1177
1178
var chunkSize = file.size > ai1wm_uploader.chunk_size ? ai1wm_uploader.chunk_size : file.size;
1179
var formData = this.getFormData(file, chunkSize);
1180
fetch(ai1wm_uploader.url, {
1181
method: 'POST',
1182
credentials: 'include',
@@ -1191,22 +1379,33 @@
1191
ai1wm_uploader.chunk_size = chunkSize / 2;
1192
return _this2.upload(file);
1193
case 200:
1194
- _this2.retries = 0;
1195
- file = file.slice(chunkSize, file.size, 'application/octet-binary');
1196
- var uploadedBytes = _this2.fileSize - file.size;
1197
- var progress = uploadedBytes / _this2.fileSize * 100;
1198
- _this2.onUploadProgress(progress.toFixed(2));
1199
- return progress === 100 ? _this2.onFileUploaded() : _this2.upload(file);
1200
default:
1201
throw new Error(response.status);
1202
}
1203
}).catch(function (error) {
1204
- var timeout = _this2.retries * 1000;
1205
- if (_this2.retries > 30) {
1206
return _this2.onError(new Error('We are sorry, there seems to be a problem while uploading your file. Follow <a href="https://www.youtube.com/watch?v=mRp7qTFYKgs" target="_blank">this guide</a> to resolve it.'));
1207
}
1208
- _this2.retries++;
1209
- setTimeout(_this2.upload.bind(_this2, file), timeout);
1210
});
1211
};
1212
@@ -1255,22 +1454,22 @@
1255
FileUploader.prototype.onBeforeUpload = function (file) {
1256
var self = this;
1257
1258
- // Set storage and archive
1259
- this.storage = Util.random(12);
1260
- this.archive = file.name;
1261
1262
// Set multipart params
1263
$.extend(ai1wm_uploader.params, {
1264
- storage: this.storage,
1265
- archive: this.archive
1266
});
1267
1268
- // Set global params
1269
- self.model.setParams([{ name: 'storage', value: this.storage }, { name: 'archive', value: this.archive }]);
1270
-
1271
// Set stop
1272
this.model.onStop = function () {
1273
self.stopUpload = true;
1274
// Clean storage
1275
self.model.clean();
1276
};
@@ -1325,6 +1524,28 @@
1325
arrayBuffer: 'ArrayBuffer' in self
1326
}
1327
1328
function normalizeName(name) {
1329
if (typeof name !== 'string') {
1330
name = String(name)
@@ -1457,14 +1678,36 @@
1457
1458
function readBlobAsArrayBuffer(blob) {
1459
var reader = new FileReader()
1460
reader.readAsArrayBuffer(blob)
1461
- return fileReaderReady(reader)
1462
}
1463
1464
function readBlobAsText(blob) {
1465
var reader = new FileReader()
1466
reader.readAsText(blob)
1467
- return fileReaderReady(reader)
1468
}
1469
1470
function Body() {
@@ -1472,7 +1715,9 @@
1472
1473
this._initBody = function(body) {
1474
this._bodyInit = body
1475
- if (typeof body === 'string') {
1476
this._bodyText = body
1477
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
1478
this._bodyBlob = body
@@ -1480,11 +1725,12 @@
1480
this._bodyFormData = body
1481
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
1482
this._bodyText = body.toString()
1483
- } else if (!body) {
1484
- this._bodyText = ''
1485
- } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
1486
- // Only support ArrayBuffers for POST method.
1487
- // Receiving ArrayBuffers happens via Blobs, instead.
1488
} else {
1489
throw new Error('unsupported BodyInit type')
1490
}
@@ -1509,6 +1755,8 @@
1509
1510
if (this._bodyBlob) {
1511
return Promise.resolve(this._bodyBlob)
1512
} else if (this._bodyFormData) {
1513
throw new Error('could not read FormData body as blob')
1514
} else {
@@ -1517,27 +1765,28 @@
1517
}
1518
1519
this.arrayBuffer = function() {
1520
- return this.blob().then(readBlobAsArrayBuffer)
1521
- }
1522
-
1523
- this.text = function() {
1524
- var rejected = consumed(this)
1525
- if (rejected) {
1526
- return rejected
1527
- }
1528
-
1529
- if (this._bodyBlob) {
1530
- return readBlobAsText(this._bodyBlob)
1531
- } else if (this._bodyFormData) {
1532
- throw new Error('could not read FormData body as text')
1533
} else {
1534
- return Promise.resolve(this._bodyText)
1535
}
1536
}
1537
- } else {
1538
- this.text = function() {
1539
- var rejected = consumed(this)
1540
- return rejected ? rejected : Promise.resolve(this._bodyText)
1541
}
1542
}
1543
@@ -1565,7 +1814,10 @@
1565
function Request(input, options) {
1566
options = options || {}
1567
var body = options.body
1568
- if (Request.prototype.isPrototypeOf(input)) {
1569
if (input.bodyUsed) {
1570
throw new TypeError('Already read')
1571
}
@@ -1576,12 +1828,10 @@
1576
}
1577
this.method = input.method
1578
this.mode = input.mode
1579
- if (!body) {
1580
body = input._bodyInit
1581
input.bodyUsed = true
1582
}
1583
- } else {
1584
- this.url = input
1585
}
1586
1587
this.credentials = options.credentials || this.credentials || 'omit'
@@ -1599,7 +1849,7 @@
1599
}
1600
1601
Request.prototype.clone = function() {
1602
- return new Request(this)
1603
}
1604
1605
function decode(body) {
@@ -1615,16 +1865,17 @@
1615
return form
1616
}
1617
1618
- function headers(xhr) {
1619
- var head = new Headers()
1620
- var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
1621
- pairs.forEach(function(header) {
1622
- var split = header.trim().split(':')
1623
- var key = split.shift().trim()
1624
- var value = split.join(':').trim()
1625
- head.append(key, value)
1626
})
1627
- return head
1628
}
1629
1630
Body.call(Request.prototype)
@@ -1635,10 +1886,10 @@
1635
}
1636
1637
this.type = 'default'
1638
- this.status = options.status
1639
this.ok = this.status >= 200 && this.status < 300
1640
- this.statusText = options.statusText
1641
- this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
1642
this.url = options.url || ''
1643
this._initBody(bodyInit)
1644
}
@@ -1676,35 +1927,16 @@
1676
1677
self.fetch = function(input, init) {
1678
return new Promise(function(resolve, reject) {
1679
- var request
1680
- if (Request.prototype.isPrototypeOf(input) && !init) {
1681
- request = input
1682
- } else {
1683
- request = new Request(input, init)
1684
- }
1685
-
1686
var xhr = new XMLHttpRequest()
1687
1688
- function responseURL() {
1689
- if ('responseURL' in xhr) {
1690
- return xhr.responseURL
1691
- }
1692
-
1693
- // Avoid security warnings on getResponseHeader when not allowed by CORS
1694
- if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
1695
- return xhr.getResponseHeader('X-Request-URL')
1696
- }
1697
-
1698
- return
1699
- }
1700
-
1701
xhr.onload = function() {
1702
var options = {
1703
status: xhr.status,
1704
statusText: xhr.statusText,
1705
- headers: headers(xhr),
1706
- url: responseURL()
1707
}
1708
var body = 'response' in xhr ? xhr.response : xhr.responseText
1709
resolve(new Response(body, options))
1710
}
@@ -1747,987 +1979,1262 @@
1747
/* 14 */
1748
/***/ function(module, exports, __webpack_require__) {
1749
1750
- var require;var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(process, global, module) {/*** IMPORTS FROM imports-loader ***/
1751
(function() {
1752
1753
/*!
1754
* @overview es6-promise - a tiny implementation of Promises/A+.
1755
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
1756
* @license Licensed under MIT license
1757
- * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
1758
- * @version 3.2.1
1759
*/
1760
1761
- (function() {
1762
- "use strict";
1763
- function lib$es6$promise$utils$objectOrFunction(x) {
1764
- return typeof x === 'function' || (typeof x === 'object' && x !== null);
1765
- }
1766
1767
- function lib$es6$promise$utils$isFunction(x) {
1768
- return typeof x === 'function';
1769
- }
1770
1771
- function lib$es6$promise$utils$isMaybeThenable(x) {
1772
- return typeof x === 'object' && x !== null;
1773
- }
1774
1775
- var lib$es6$promise$utils$_isArray;
1776
- if (!Array.isArray) {
1777
- lib$es6$promise$utils$_isArray = function (x) {
1778
- return Object.prototype.toString.call(x) === '[object Array]';
1779
- };
1780
} else {
1781
- lib$es6$promise$utils$_isArray = Array.isArray;
1782
}
1783
1784
- var lib$es6$promise$utils$isArray = lib$es6$promise$utils$_isArray;
1785
- var lib$es6$promise$asap$len = 0;
1786
- var lib$es6$promise$asap$vertxNext;
1787
- var lib$es6$promise$asap$customSchedulerFn;
1788
-
1789
- var lib$es6$promise$asap$asap = function asap(callback, arg) {
1790
- lib$es6$promise$asap$queue[lib$es6$promise$asap$len] = callback;
1791
- lib$es6$promise$asap$queue[lib$es6$promise$asap$len + 1] = arg;
1792
- lib$es6$promise$asap$len += 2;
1793
- if (lib$es6$promise$asap$len === 2) {
1794
- // If len is 2, that means that we need to schedule an async flush.
1795
- // If additional callbacks are queued before the queue is flushed, they
1796
- // will be processed by this flush that we are scheduling.
1797
- if (lib$es6$promise$asap$customSchedulerFn) {
1798
- lib$es6$promise$asap$customSchedulerFn(lib$es6$promise$asap$flush);
1799
- } else {
1800
- lib$es6$promise$asap$scheduleFlush();
1801
- }
1802
- }
1803
- }
1804
1805
- function lib$es6$promise$asap$setScheduler(scheduleFn) {
1806
- lib$es6$promise$asap$customSchedulerFn = scheduleFn;
1807
- }
1808
1809
- function lib$es6$promise$asap$setAsap(asapFn) {
1810
- lib$es6$promise$asap$asap = asapFn;
1811
- }
1812
1813
- var lib$es6$promise$asap$browserWindow = (typeof window !== 'undefined') ? window : undefined;
1814
- var lib$es6$promise$asap$browserGlobal = lib$es6$promise$asap$browserWindow || {};
1815
- var lib$es6$promise$asap$BrowserMutationObserver = lib$es6$promise$asap$browserGlobal.MutationObserver || lib$es6$promise$asap$browserGlobal.WebKitMutationObserver;
1816
- var lib$es6$promise$asap$isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
1817
-
1818
- // test for web worker but not in IE10
1819
- var lib$es6$promise$asap$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
1820
- typeof importScripts !== 'undefined' &&
1821
- typeof MessageChannel !== 'undefined';
1822
-
1823
- // node
1824
- function lib$es6$promise$asap$useNextTick() {
1825
- // node version 0.10.x displays a deprecation warning when nextTick is used recursively
1826
- // see https://github.com/cujojs/when/issues/410 for details
1827
- return function() {
1828
- process.nextTick(lib$es6$promise$asap$flush);
1829
- };
1830
- }
1831
1832
- // vertx
1833
- function lib$es6$promise$asap$useVertxTimer() {
1834
- return function() {
1835
- lib$es6$promise$asap$vertxNext(lib$es6$promise$asap$flush);
1836
- };
1837
- }
1838
1839
- function lib$es6$promise$asap$useMutationObserver() {
1840
- var iterations = 0;
1841
- var observer = new lib$es6$promise$asap$BrowserMutationObserver(lib$es6$promise$asap$flush);
1842
- var node = document.createTextNode('');
1843
- observer.observe(node, { characterData: true });
1844
1845
- return function() {
1846
- node.data = (iterations = ++iterations % 2);
1847
- };
1848
- }
1849
1850
- // web worker
1851
- function lib$es6$promise$asap$useMessageChannel() {
1852
- var channel = new MessageChannel();
1853
- channel.port1.onmessage = lib$es6$promise$asap$flush;
1854
- return function () {
1855
- channel.port2.postMessage(0);
1856
- };
1857
- }
1858
1859
- function lib$es6$promise$asap$useSetTimeout() {
1860
- return function() {
1861
- setTimeout(lib$es6$promise$asap$flush, 1);
1862
- };
1863
- }
1864
1865
- var lib$es6$promise$asap$queue = new Array(1000);
1866
- function lib$es6$promise$asap$flush() {
1867
- for (var i = 0; i < lib$es6$promise$asap$len; i+=2) {
1868
- var callback = lib$es6$promise$asap$queue[i];
1869
- var arg = lib$es6$promise$asap$queue[i+1];
1870
1871
- callback(arg);
1872
1873
- lib$es6$promise$asap$queue[i] = undefined;
1874
- lib$es6$promise$asap$queue[i+1] = undefined;
1875
- }
1876
1877
- lib$es6$promise$asap$len = 0;
1878
- }
1879
1880
- function lib$es6$promise$asap$attemptVertx() {
1881
- try {
1882
- var r = require;
1883
- var vertx = __webpack_require__(17);
1884
- lib$es6$promise$asap$vertxNext = vertx.runOnLoop || vertx.runOnContext;
1885
- return lib$es6$promise$asap$useVertxTimer();
1886
- } catch(e) {
1887
- return lib$es6$promise$asap$useSetTimeout();
1888
- }
1889
- }
1890
1891
- var lib$es6$promise$asap$scheduleFlush;
1892
- // Decide what async method to use to triggering processing of queued callbacks:
1893
- if (lib$es6$promise$asap$isNode) {
1894
- lib$es6$promise$asap$scheduleFlush = lib$es6$promise$asap$useNextTick();
1895
- } else if (lib$es6$promise$asap$BrowserMutationObserver) {
1896
- lib$es6$promise$asap$scheduleFlush = lib$es6$promise$asap$useMutationObserver();
1897
- } else if (lib$es6$promise$asap$isWorker) {
1898
- lib$es6$promise$asap$scheduleFlush = lib$es6$promise$asap$useMessageChannel();
1899
- } else if (lib$es6$promise$asap$browserWindow === undefined && "function" === 'function') {
1900
- lib$es6$promise$asap$scheduleFlush = lib$es6$promise$asap$attemptVertx();
1901
- } else {
1902
- lib$es6$promise$asap$scheduleFlush = lib$es6$promise$asap$useSetTimeout();
1903
- }
1904
- function lib$es6$promise$then$then(onFulfillment, onRejection) {
1905
- var parent = this;
1906
1907
- var child = new this.constructor(lib$es6$promise$internal$noop);
1908
1909
- if (child[lib$es6$promise$internal$PROMISE_ID] === undefined) {
1910
- lib$es6$promise$internal$makePromise(child);
1911
- }
1912
1913
- var state = parent._state;
1914
1915
- if (state) {
1916
- var callback = arguments[state - 1];
1917
- lib$es6$promise$asap$asap(function(){
1918
- lib$es6$promise$internal$invokeCallback(state, child, callback, parent._result);
1919
- });
1920
- } else {
1921
- lib$es6$promise$internal$subscribe(parent, child, onFulfillment, onRejection);
1922
- }
1923
1924
- return child;
1925
- }
1926
- var lib$es6$promise$then$default = lib$es6$promise$then$then;
1927
- function lib$es6$promise$promise$resolve$resolve(object) {
1928
- /*jshint validthis:true */
1929
- var Constructor = this;
1930
1931
- if (object && typeof object === 'object' && object.constructor === Constructor) {
1932
- return object;
1933
- }
1934
1935
- var promise = new Constructor(lib$es6$promise$internal$noop);
1936
- lib$es6$promise$internal$resolve(promise, object);
1937
- return promise;
1938
- }
1939
- var lib$es6$promise$promise$resolve$default = lib$es6$promise$promise$resolve$resolve;
1940
- var lib$es6$promise$internal$PROMISE_ID = Math.random().toString(36).substring(16);
1941
1942
- function lib$es6$promise$internal$noop() {}
1943
1944
- var lib$es6$promise$internal$PENDING = void 0;
1945
- var lib$es6$promise$internal$FULFILLED = 1;
1946
- var lib$es6$promise$internal$REJECTED = 2;
1947
1948
- var lib$es6$promise$internal$GET_THEN_ERROR = new lib$es6$promise$internal$ErrorObject();
1949
1950
- function lib$es6$promise$internal$selfFulfillment() {
1951
- return new TypeError("You cannot resolve a promise with itself");
1952
- }
1953
1954
- function lib$es6$promise$internal$cannotReturnOwn() {
1955
- return new TypeError('A promises callback cannot return that same promise.');
1956
- }
1957
1958
- function lib$es6$promise$internal$getThen(promise) {
1959
- try {
1960
- return promise.then;
1961
- } catch(error) {
1962
- lib$es6$promise$internal$GET_THEN_ERROR.error = error;
1963
- return lib$es6$promise$internal$GET_THEN_ERROR;
1964
- }
1965
- }
1966
1967
- function lib$es6$promise$internal$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
1968
- try {
1969
- then.call(value, fulfillmentHandler, rejectionHandler);
1970
- } catch(e) {
1971
- return e;
1972
- }
1973
- }
1974
1975
- function lib$es6$promise$internal$handleForeignThenable(promise, thenable, then) {
1976
- lib$es6$promise$asap$asap(function(promise) {
1977
- var sealed = false;
1978
- var error = lib$es6$promise$internal$tryThen(then, thenable, function(value) {
1979
- if (sealed) { return; }
1980
- sealed = true;
1981
- if (thenable !== value) {
1982
- lib$es6$promise$internal$resolve(promise, value);
1983
- } else {
1984
- lib$es6$promise$internal$fulfill(promise, value);
1985
- }
1986
- }, function(reason) {
1987
- if (sealed) { return; }
1988
- sealed = true;
1989
1990
- lib$es6$promise$internal$reject(promise, reason);
1991
- }, 'Settle: ' + (promise._label || ' unknown promise'));
1992
1993
- if (!sealed && error) {
1994
- sealed = true;
1995
- lib$es6$promise$internal$reject(promise, error);
1996
- }
1997
- }, promise);
1998
- }
1999
2000
- function lib$es6$promise$internal$handleOwnThenable(promise, thenable) {
2001
- if (thenable._state === lib$es6$promise$internal$FULFILLED) {
2002
- lib$es6$promise$internal$fulfill(promise, thenable._result);
2003
- } else if (thenable._state === lib$es6$promise$internal$REJECTED) {
2004
- lib$es6$promise$internal$reject(promise, thenable._result);
2005
- } else {
2006
- lib$es6$promise$internal$subscribe(thenable, undefined, function(value) {
2007
- lib$es6$promise$internal$resolve(promise, value);
2008
- }, function(reason) {
2009
- lib$es6$promise$internal$reject(promise, reason);
2010
- });
2011
- }
2012
- }
2013
2014
- function lib$es6$promise$internal$handleMaybeThenable(promise, maybeThenable, then) {
2015
- if (maybeThenable.constructor === promise.constructor &&
2016
- then === lib$es6$promise$then$default &&
2017
- constructor.resolve === lib$es6$promise$promise$resolve$default) {
2018
- lib$es6$promise$internal$handleOwnThenable(promise, maybeThenable);
2019
- } else {
2020
- if (then === lib$es6$promise$internal$GET_THEN_ERROR) {
2021
- lib$es6$promise$internal$reject(promise, lib$es6$promise$internal$GET_THEN_ERROR.error);
2022
- } else if (then === undefined) {
2023
- lib$es6$promise$internal$fulfill(promise, maybeThenable);
2024
- } else if (lib$es6$promise$utils$isFunction(then)) {
2025
- lib$es6$promise$internal$handleForeignThenable(promise, maybeThenable, then);
2026
- } else {
2027
- lib$es6$promise$internal$fulfill(promise, maybeThenable);
2028
- }
2029
- }
2030
- }
2031
2032
- function lib$es6$promise$internal$resolve(promise, value) {
2033
- if (promise === value) {
2034
- lib$es6$promise$internal$reject(promise, lib$es6$promise$internal$selfFulfillment());
2035
- } else if (lib$es6$promise$utils$objectOrFunction(value)) {
2036
- lib$es6$promise$internal$handleMaybeThenable(promise, value, lib$es6$promise$internal$getThen(value));
2037
} else {
2038
- lib$es6$promise$internal$fulfill(promise, value);
2039
}
2040
- }
2041
-
2042
- function lib$es6$promise$internal$publishRejection(promise) {
2043
- if (promise._onerror) {
2044
- promise._onerror(promise._result);
2045
}
2046
2047
- lib$es6$promise$internal$publish(promise);
2048
- }
2049
2050
- function lib$es6$promise$internal$fulfill(promise, value) {
2051
- if (promise._state !== lib$es6$promise$internal$PENDING) { return; }
2052
2053
- promise._result = value;
2054
- promise._state = lib$es6$promise$internal$FULFILLED;
2055
2056
- if (promise._subscribers.length !== 0) {
2057
- lib$es6$promise$asap$asap(lib$es6$promise$internal$publish, promise);
2058
- }
2059
}
2060
2061
- function lib$es6$promise$internal$reject(promise, reason) {
2062
- if (promise._state !== lib$es6$promise$internal$PENDING) { return; }
2063
- promise._state = lib$es6$promise$internal$REJECTED;
2064
- promise._result = reason;
2065
2066
- lib$es6$promise$asap$asap(lib$es6$promise$internal$publishRejection, promise);
2067
- }
2068
2069
- function lib$es6$promise$internal$subscribe(parent, child, onFulfillment, onRejection) {
2070
- var subscribers = parent._subscribers;
2071
- var length = subscribers.length;
2072
2073
- parent._onerror = null;
2074
2075
- subscribers[length] = child;
2076
- subscribers[length + lib$es6$promise$internal$FULFILLED] = onFulfillment;
2077
- subscribers[length + lib$es6$promise$internal$REJECTED] = onRejection;
2078
2079
- if (length === 0 && parent._state) {
2080
- lib$es6$promise$asap$asap(lib$es6$promise$internal$publish, parent);
2081
- }
2082
- }
2083
2084
- function lib$es6$promise$internal$publish(promise) {
2085
- var subscribers = promise._subscribers;
2086
- var settled = promise._state;
2087
2088
- if (subscribers.length === 0) { return; }
2089
2090
- var child, callback, detail = promise._result;
2091
2092
- for (var i = 0; i < subscribers.length; i += 3) {
2093
- child = subscribers[i];
2094
- callback = subscribers[i + settled];
2095
2096
- if (child) {
2097
- lib$es6$promise$internal$invokeCallback(settled, child, callback, detail);
2098
- } else {
2099
- callback(detail);
2100
- }
2101
- }
2102
2103
- promise._subscribers.length = 0;
2104
- }
2105
2106
- function lib$es6$promise$internal$ErrorObject() {
2107
- this.error = null;
2108
- }
2109
2110
- var lib$es6$promise$internal$TRY_CATCH_ERROR = new lib$es6$promise$internal$ErrorObject();
2111
2112
- function lib$es6$promise$internal$tryCatch(callback, detail) {
2113
- try {
2114
- return callback(detail);
2115
- } catch(e) {
2116
- lib$es6$promise$internal$TRY_CATCH_ERROR.error = e;
2117
- return lib$es6$promise$internal$TRY_CATCH_ERROR;
2118
- }
2119
}
2120
2121
- function lib$es6$promise$internal$invokeCallback(settled, promise, callback, detail) {
2122
- var hasCallback = lib$es6$promise$utils$isFunction(callback),
2123
- value, error, succeeded, failed;
2124
2125
- if (hasCallback) {
2126
- value = lib$es6$promise$internal$tryCatch(callback, detail);
2127
2128
- if (value === lib$es6$promise$internal$TRY_CATCH_ERROR) {
2129
- failed = true;
2130
- error = value.error;
2131
- value = null;
2132
- } else {
2133
- succeeded = true;
2134
- }
2135
2136
- if (promise === value) {
2137
- lib$es6$promise$internal$reject(promise, lib$es6$promise$internal$cannotReturnOwn());
2138
- return;
2139
- }
2140
2141
- } else {
2142
- value = detail;
2143
- succeeded = true;
2144
- }
2145
2146
- if (promise._state !== lib$es6$promise$internal$PENDING) {
2147
- // noop
2148
- } else if (hasCallback && succeeded) {
2149
- lib$es6$promise$internal$resolve(promise, value);
2150
- } else if (failed) {
2151
- lib$es6$promise$internal$reject(promise, error);
2152
- } else if (settled === lib$es6$promise$internal$FULFILLED) {
2153
- lib$es6$promise$internal$fulfill(promise, value);
2154
- } else if (settled === lib$es6$promise$internal$REJECTED) {
2155
- lib$es6$promise$internal$reject(promise, value);
2156
- }
2157
- }
2158
2159
- function lib$es6$promise$internal$initializePromise(promise, resolver) {
2160
- try {
2161
- resolver(function resolvePromise(value){
2162
- lib$es6$promise$internal$resolve(promise, value);
2163
- }, function rejectPromise(reason) {
2164
- lib$es6$promise$internal$reject(promise, reason);
2165
- });
2166
- } catch(e) {
2167
- lib$es6$promise$internal$reject(promise, e);
2168
- }
2169
}
2170
2171
- var lib$es6$promise$internal$id = 0;
2172
- function lib$es6$promise$internal$nextId() {
2173
- return lib$es6$promise$internal$id++;
2174
}
2175
2176
- function lib$es6$promise$internal$makePromise(promise) {
2177
- promise[lib$es6$promise$internal$PROMISE_ID] = lib$es6$promise$internal$id++;
2178
- promise._state = undefined;
2179
- promise._result = undefined;
2180
- promise._subscribers = [];
2181
}
2182
2183
- function lib$es6$promise$promise$all$all(entries) {
2184
- return new lib$es6$promise$enumerator$default(this, entries).promise;
2185
- }
2186
- var lib$es6$promise$promise$all$default = lib$es6$promise$promise$all$all;
2187
- function lib$es6$promise$promise$race$race(entries) {
2188
- /*jshint validthis:true */
2189
- var Constructor = this;
2190
-
2191
- if (!lib$es6$promise$utils$isArray(entries)) {
2192
- return new Constructor(function(resolve, reject) {
2193
- reject(new TypeError('You must pass an array to race.'));
2194
- });
2195
- } else {
2196
- return new Constructor(function(resolve, reject) {
2197
- var length = entries.length;
2198
- for (var i = 0; i < length; i++) {
2199
- Constructor.resolve(entries[i]).then(resolve, reject);
2200
- }
2201
- });
2202
- }
2203
- }
2204
- var lib$es6$promise$promise$race$default = lib$es6$promise$promise$race$race;
2205
- function lib$es6$promise$promise$reject$reject(reason) {
2206
- /*jshint validthis:true */
2207
- var Constructor = this;
2208
- var promise = new Constructor(lib$es6$promise$internal$noop);
2209
- lib$es6$promise$internal$reject(promise, reason);
2210
- return promise;
2211
- }
2212
- var lib$es6$promise$promise$reject$default = lib$es6$promise$promise$reject$reject;
2213
2214
2215
- function lib$es6$promise$promise$needsResolver() {
2216
- throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
2217
- }
2218
2219
- function lib$es6$promise$promise$needsNew() {
2220
- throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
2221
- }
2222
2223
- var lib$es6$promise$promise$default = lib$es6$promise$promise$Promise;
2224
- /**
2225
- Promise objects represent the eventual result of an asynchronous operation. The
2226
- primary way of interacting with a promise is through its `then` method, which
2227
- registers callbacks to receive either a promise's eventual value or the reason
2228
- why the promise cannot be fulfilled.
2229
2230
- Terminology
2231
- -----------
2232
2233
- - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
2234
- - `thenable` is an object or function that defines a `then` method.
2235
- - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
2236
- - `exception` is a value that is thrown using the throw statement.
2237
- - `reason` is a value that indicates why a promise was rejected.
2238
- - `settled` the final resting state of a promise, fulfilled or rejected.
2239
2240
- A promise can be in one of three states: pending, fulfilled, or rejected.
2241
2242
- Promises that are fulfilled have a fulfillment value and are in the fulfilled
2243
- state. Promises that are rejected have a rejection reason and are in the
2244
- rejected state. A fulfillment value is never a thenable.
2245
2246
- Promises can also be said to *resolve* a value. If this value is also a
2247
- promise, then the original promise's settled state will match the value's
2248
- settled state. So a promise that *resolves* a promise that rejects will
2249
- itself reject, and a promise that *resolves* a promise that fulfills will
2250
- itself fulfill.
2251
2252
2253
- Basic Usage:
2254
- ------------
2255
2256
- ```js
2257
- var promise = new Promise(function(resolve, reject) {
2258
- // on success
2259
- resolve(value);
2260
2261
- // on failure
2262
- reject(reason);
2263
- });
2264
2265
- promise.then(function(value) {
2266
- // on fulfillment
2267
- }, function(reason) {
2268
- // on rejection
2269
- });
2270
- ```
2271
-
2272
- Advanced Usage:
2273
- ---------------
2274
-
2275
- Promises shine when abstracting away asynchronous interactions such as
2276
- `XMLHttpRequest`s.
2277
-
2278
- ```js
2279
- function getJSON(url) {
2280
- return new Promise(function(resolve, reject){
2281
- var xhr = new XMLHttpRequest();
2282
-
2283
- xhr.open('GET', url);
2284
- xhr.onreadystatechange = handler;
2285
- xhr.responseType = 'json';
2286
- xhr.setRequestHeader('Accept', 'application/json');
2287
- xhr.send();
2288
-
2289
- function handler() {
2290
- if (this.readyState === this.DONE) {
2291
- if (this.status === 200) {
2292
- resolve(this.response);
2293
- } else {
2294
- reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
2295
- }
2296
- }
2297
- };
2298
- });
2299
- }
2300
2301
- getJSON('/posts.json').then(function(json) {
2302
- // on fulfillment
2303
- }, function(reason) {
2304
- // on rejection
2305
- });
2306
- ```
2307
2308
- Unlike callbacks, promises are great composable primitives.
2309
2310
- ```js
2311
- Promise.all([
2312
- getJSON('/posts'),
2313
- getJSON('/comments')
2314
- ]).then(function(values){
2315
- values[0] // => postsJSON
2316
- values[1] // => commentsJSON
2317
2318
- return values;
2319
- });
2320
- ```
2321
-
2322
- @class Promise
2323
- @param {function} resolver
2324
- Useful for tooling.
2325
- @constructor
2326
- */
2327
- function lib$es6$promise$promise$Promise(resolver) {
2328
- this[lib$es6$promise$internal$PROMISE_ID] = lib$es6$promise$internal$nextId();
2329
- this._result = this._state = undefined;
2330
- this._subscribers = [];
2331
-
2332
- if (lib$es6$promise$internal$noop !== resolver) {
2333
- typeof resolver !== 'function' && lib$es6$promise$promise$needsResolver();
2334
- this instanceof lib$es6$promise$promise$Promise ? lib$es6$promise$internal$initializePromise(this, resolver) : lib$es6$promise$promise$needsNew();
2335
- }
2336
- }
2337
2338
- lib$es6$promise$promise$Promise.all = lib$es6$promise$promise$all$default;
2339
- lib$es6$promise$promise$Promise.race = lib$es6$promise$promise$race$default;
2340
- lib$es6$promise$promise$Promise.resolve = lib$es6$promise$promise$resolve$default;
2341
- lib$es6$promise$promise$Promise.reject = lib$es6$promise$promise$reject$default;
2342
- lib$es6$promise$promise$Promise._setScheduler = lib$es6$promise$asap$setScheduler;
2343
- lib$es6$promise$promise$Promise._setAsap = lib$es6$promise$asap$setAsap;
2344
- lib$es6$promise$promise$Promise._asap = lib$es6$promise$asap$asap;
2345
-
2346
- lib$es6$promise$promise$Promise.prototype = {
2347
- constructor: lib$es6$promise$promise$Promise,
2348
-
2349
- /**
2350
- The primary way of interacting with a promise is through its `then` method,
2351
- which registers callbacks to receive either a promise's eventual value or the
2352
- reason why the promise cannot be fulfilled.
2353
-
2354
- ```js
2355
- findUser().then(function(user){
2356
- // user is available
2357
- }, function(reason){
2358
- // user is unavailable, and you are given the reason why
2359
- });
2360
- ```
2361
-
2362
- Chaining
2363
- --------
2364
-
2365
- The return value of `then` is itself a promise. This second, 'downstream'
2366
- promise is resolved with the return value of the first promise's fulfillment
2367
- or rejection handler, or rejected if the handler throws an exception.
2368
-
2369
- ```js
2370
- findUser().then(function (user) {
2371
- return user.name;
2372
- }, function (reason) {
2373
- return 'default name';
2374
- }).then(function (userName) {
2375
- // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
2376
- // will be `'default name'`
2377
- });
2378
2379
- findUser().then(function (user) {
2380
- throw new Error('Found user, but still unhappy');
2381
- }, function (reason) {
2382
- throw new Error('`findUser` rejected and we're unhappy');
2383
- }).then(function (value) {
2384
- // never reached
2385
- }, function (reason) {
2386
- // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
2387
- // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
2388
- });
2389
- ```
2390
- If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
2391
-
2392
- ```js
2393
- findUser().then(function (user) {
2394
- throw new PedagogicalException('Upstream error');
2395
- }).then(function (value) {
2396
- // never reached
2397
- }).then(function (value) {
2398
- // never reached
2399
- }, function (reason) {
2400
- // The `PedgagocialException` is propagated all the way down to here
2401
- });
2402
- ```
2403
2404
- Assimilation
2405
- ------------
2406
2407
- Sometimes the value you want to propagate to a downstream promise can only be
2408
- retrieved asynchronously. This can be achieved by returning a promise in the
2409
- fulfillment or rejection handler. The downstream promise will then be pending
2410
- until the returned promise is settled. This is called *assimilation*.
2411
2412
- ```js
2413
- findUser().then(function (user) {
2414
- return findCommentsByAuthor(user);
2415
- }).then(function (comments) {
2416
- // The user's comments are now available
2417
- });
2418
- ```
2419
2420
- If the assimliated promise rejects, then the downstream promise will also reject.
2421
2422
- ```js
2423
- findUser().then(function (user) {
2424
- return findCommentsByAuthor(user);
2425
- }).then(function (comments) {
2426
- // If `findCommentsByAuthor` fulfills, we'll have the value here
2427
- }, function (reason) {
2428
- // If `findCommentsByAuthor` rejects, we'll have the reason here
2429
- });
2430
- ```
2431
2432
- Simple Example
2433
- --------------
2434
2435
- Synchronous Example
2436
2437
- ```javascript
2438
- var result;
2439
2440
- try {
2441
- result = findResult();
2442
- // success
2443
- } catch(reason) {
2444
- // failure
2445
}
2446
- ```
2447
2448
- Errback Example
2449
2450
- ```js
2451
- findResult(function(result, err){
2452
- if (err) {
2453
- // failure
2454
- } else {
2455
- // success
2456
- }
2457
- });
2458
- ```
2459
2460
- Promise Example;
2461
2462
- ```javascript
2463
- findResult().then(function(result){
2464
- // success
2465
- }, function(reason){
2466
- // failure
2467
- });
2468
- ```
2469
2470
- Advanced Example
2471
- --------------
2472
2473
- Synchronous Example
2474
2475
- ```javascript
2476
- var author, books;
2477
2478
- try {
2479
- author = findAuthor();
2480
- books = findBooksByAuthor(author);
2481
- // success
2482
- } catch(reason) {
2483
- // failure
2484
- }
2485
- ```
2486
2487
- Errback Example
2488
2489
- ```js
2490
2491
- function foundBooks(books) {
2492
2493
- }
2494
2495
- function failure(reason) {
2496
2497
- }
2498
2499
- findAuthor(function(author, err){
2500
- if (err) {
2501
- failure(err);
2502
- // failure
2503
- } else {
2504
- try {
2505
- findBoooksByAuthor(author, function(books, err) {
2506
- if (err) {
2507
- failure(err);
2508
- } else {
2509
- try {
2510
- foundBooks(books);
2511
- } catch(reason) {
2512
- failure(reason);
2513
- }
2514
- }
2515
- });
2516
- } catch(error) {
2517
- failure(err);
2518
- }
2519
- // success
2520
- }
2521
- });
2522
- ```
2523
2524
- Promise Example;
2525
2526
- ```javascript
2527
- findAuthor().
2528
- then(findBooksByAuthor).
2529
- then(function(books){
2530
- // found books
2531
- }).catch(function(reason){
2532
- // something went wrong
2533
- });
2534
- ```
2535
-
2536
- @method then
2537
- @param {Function} onFulfilled
2538
- @param {Function} onRejected
2539
- Useful for tooling.
2540
- @return {Promise}
2541
- */
2542
- then: lib$es6$promise$then$default,
2543
-
2544
- /**
2545
- `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
2546
- as the catch block of a try/catch statement.
2547
-
2548
- ```js
2549
- function findAuthor(){
2550
- throw new Error('couldn't find that author');
2551
- }
2552
2553
- // synchronous
2554
- try {
2555
- findAuthor();
2556
- } catch(reason) {
2557
- // something went wrong
2558
- }
2559
2560
- // async with promises
2561
- findAuthor().catch(function(reason){
2562
- // something went wrong
2563
- });
2564
- ```
2565
-
2566
- @method catch
2567
- @param {Function} onRejection
2568
- Useful for tooling.
2569
- @return {Promise}
2570
- */
2571
- 'catch': function(onRejection) {
2572
- return this.then(null, onRejection);
2573
- }
2574
- };
2575
- var lib$es6$promise$enumerator$default = lib$es6$promise$enumerator$Enumerator;
2576
- function lib$es6$promise$enumerator$Enumerator(Constructor, input) {
2577
- this._instanceConstructor = Constructor;
2578
- this.promise = new Constructor(lib$es6$promise$internal$noop);
2579
-
2580
- if (!this.promise[lib$es6$promise$internal$PROMISE_ID]) {
2581
- lib$es6$promise$internal$makePromise(this.promise);
2582
- }
2583
2584
- if (lib$es6$promise$utils$isArray(input)) {
2585
- this._input = input;
2586
- this.length = input.length;
2587
- this._remaining = input.length;
2588
2589
- this._result = new Array(this.length);
2590
2591
- if (this.length === 0) {
2592
- lib$es6$promise$internal$fulfill(this.promise, this._result);
2593
- } else {
2594
- this.length = this.length || 0;
2595
- this._enumerate();
2596
- if (this._remaining === 0) {
2597
- lib$es6$promise$internal$fulfill(this.promise, this._result);
2598
}
2599
}
2600
- } else {
2601
- lib$es6$promise$internal$reject(this.promise, lib$es6$promise$enumerator$validationError());
2602
- }
2603
- }
2604
-
2605
- function lib$es6$promise$enumerator$validationError() {
2606
- return new Error('Array Methods must be provided an Array');
2607
- }
2608
2609
- lib$es6$promise$enumerator$Enumerator.prototype._enumerate = function() {
2610
- var length = this.length;
2611
- var input = this._input;
2612
2613
- for (var i = 0; this._state === lib$es6$promise$internal$PENDING && i < length; i++) {
2614
- this._eachEntry(input[i], i);
2615
- }
2616
- };
2617
-
2618
- lib$es6$promise$enumerator$Enumerator.prototype._eachEntry = function(entry, i) {
2619
- var c = this._instanceConstructor;
2620
- var resolve = c.resolve;
2621
-
2622
- if (resolve === lib$es6$promise$promise$resolve$default) {
2623
- var then = lib$es6$promise$internal$getThen(entry);
2624
-
2625
- if (then === lib$es6$promise$then$default &&
2626
- entry._state !== lib$es6$promise$internal$PENDING) {
2627
- this._settledAt(entry._state, i, entry._result);
2628
- } else if (typeof then !== 'function') {
2629
- this._remaining--;
2630
- this._result[i] = entry;
2631
- } else if (c === lib$es6$promise$promise$default) {
2632
- var promise = new c(lib$es6$promise$internal$noop);
2633
- lib$es6$promise$internal$handleMaybeThenable(promise, entry, then);
2634
- this._willSettleAt(promise, i);
2635
- } else {
2636
- this._willSettleAt(new c(function(resolve) { resolve(entry); }), i);
2637
- }
2638
- } else {
2639
- this._willSettleAt(resolve(entry), i);
2640
- }
2641
- };
2642
2643
- lib$es6$promise$enumerator$Enumerator.prototype._settledAt = function(state, i, value) {
2644
- var promise = this.promise;
2645
2646
- if (promise._state === lib$es6$promise$internal$PENDING) {
2647
- this._remaining--;
2648
2649
- if (state === lib$es6$promise$internal$REJECTED) {
2650
- lib$es6$promise$internal$reject(promise, value);
2651
- } else {
2652
- this._result[i] = value;
2653
- }
2654
}
2655
-
2656
- if (this._remaining === 0) {
2657
- lib$es6$promise$internal$fulfill(promise, this._result);
2658
}
2659
- };
2660
2661
- lib$es6$promise$enumerator$Enumerator.prototype._willSettleAt = function(promise, i) {
2662
- var enumerator = this;
2663
2664
- lib$es6$promise$internal$subscribe(promise, undefined, function(value) {
2665
- enumerator._settledAt(lib$es6$promise$internal$FULFILLED, i, value);
2666
- }, function(reason) {
2667
- enumerator._settledAt(lib$es6$promise$internal$REJECTED, i, reason);
2668
- });
2669
- };
2670
- function lib$es6$promise$polyfill$polyfill() {
2671
- var local;
2672
-
2673
- if (typeof global !== 'undefined') {
2674
- local = global;
2675
- } else if (typeof self !== 'undefined') {
2676
- local = self;
2677
- } else {
2678
- try {
2679
- local = Function('return this')();
2680
- } catch (e) {
2681
- throw new Error('polyfill failed because global object is unavailable in this environment');
2682
- }
2683
- }
2684
2685
- var P = local.Promise;
2686
2687
- if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
2688
- return;
2689
- }
2690
2691
- local.Promise = lib$es6$promise$promise$default;
2692
- }
2693
- var lib$es6$promise$polyfill$default = lib$es6$promise$polyfill$polyfill;
2694
-
2695
- var lib$es6$promise$umd$ES6Promise = {
2696
- 'Promise': lib$es6$promise$promise$default,
2697
- 'polyfill': lib$es6$promise$polyfill$default
2698
- };
2699
-
2700
- /* global define:true module:true window: true */
2701
- if ("function" === 'function' && __webpack_require__(18)['amd']) {
2702
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return lib$es6$promise$umd$ES6Promise; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2703
- } else if (typeof module !== 'undefined' && module['exports']) {
2704
- module['exports'] = lib$es6$promise$umd$ES6Promise;
2705
- } else if (typeof this !== 'undefined') {
2706
- this['ES6Promise'] = lib$es6$promise$umd$ES6Promise;
2707
}
2708
2709
- lib$es6$promise$polyfill$default();
2710
- }).call(this);
2711
2712
2713
2714
/*** EXPORTS FROM exports-loader ***/
2715
module.exports = global.Promise;
2716
}.call(global));
2717
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15), (function() { return this; }()), __webpack_require__(16)(module)))
2718
2719
/***/ },
2720
/* 15 */
2721
/***/ function(module, exports) {
2722
2723
// shim for using process in browser
2724
-
2725
var process = module.exports = {};
2726
2727
- // cached from whatever global is present so that test runners that stub it don't break things.
2728
- var cachedSetTimeout = setTimeout;
2729
- var cachedClearTimeout = clearTimeout;
2730
2731
var queue = [];
2732
var draining = false;
2733
var currentQueue;
@@ -2752,7 +3259,7 @@
2752
if (draining) {
2753
return;
2754
}
2755
- var timeout = cachedSetTimeout(cleanUpNextTick);
2756
draining = true;
2757
2758
var len = queue.length;
@@ -2769,7 +3276,7 @@
2769
}
2770
currentQueue = null;
2771
draining = false;
2772
- cachedClearTimeout(timeout);
2773
}
2774
2775
process.nextTick = function (fun) {
@@ -2781,7 +3288,7 @@
2781
}
2782
queue.push(new Item(fun, args));
2783
if (queue.length === 1 && !draining) {
2784
- cachedSetTimeout(drainQueue, 0);
2785
}
2786
};
2787
@@ -2823,32 +3330,9 @@
2823
2824
/***/ },
2825
/* 16 */
2826
- /***/ function(module, exports) {
2827
-
2828
- module.exports = function(module) {
2829
- if(!module.webpackPolyfill) {
2830
- module.deprecate = function() {};
2831
- module.paths = [];
2832
- // module.parent = undefined by default
2833
- module.children = [];
2834
- module.webpackPolyfill = 1;
2835
- }
2836
- return module;
2837
- }
2838
-
2839
-
2840
- /***/ },
2841
- /* 17 */
2842
/***/ function(module, exports) {
2843
2844
/* (ignored) */
2845
2846
- /***/ },
2847
- /* 18 */
2848
- /***/ function(module, exports) {
2849
-
2850
- module.exports = function() { throw new Error("define cannot be used indirect"); };
2851
-
2852
-
2853
/***/ }
2854
/******/ ]);
47
'use strict';
48
49
/**
50
+ * Copyright (C) 2014-2017 ServMask Inc.
51
*
52
* This program is free software: you can redistribute it and/or modify
53
* it under the terms of the GNU General Public License as published by
71
*/
72
73
var Report = __webpack_require__(1),
74
+ Feedback = __webpack_require__(3),
75
Deprecated = __webpack_require__(8),
76
FileUploader = __webpack_require__(12);
77
89
90
/***/ },
91
/* 1 */
92
+ /***/ function(module, exports, __webpack_require__) {
93
94
'use strict';
95
96
/**
97
+ * Copyright (C) 2014-2017 ServMask Inc.
98
*
99
* This program is free software: you can redistribute it and/or modify
100
* it under the terms of the GNU General Public License as published by
117
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
118
*/
119
120
+ var Util = __webpack_require__(2);
121
+
122
jQuery(document).ready(function ($) {
123
'use strict';
124
140
var terms = $('.ai1wm-report-terms').is(':checked');
141
142
$.ajax({
143
url: ai1wm_report.ajax.url,
144
+ type: 'POST',
145
+ dataType: 'json',
146
+ async: false,
147
+ data: { 'ai1wm_email': email, 'ai1wm_message': message, 'ai1wm_terms': +terms },
148
+ dataFilter: function dataFilter(data, type) {
149
+ return Util.json(data);
150
+ },
151
success: function success(data) {
152
+ if (data.errors.length > 0) {
153
// Reset previous messages
154
$('.ai1wm-report-problem-dialog .ai1wm-message').remove();
155
156
+ var errorMessage = $('<div />').addClass('ai1wm-message ai1wm-error-message');
157
+ $.each(data.errors, function (key, value) {
158
+ errorMessage.append('<p>' + value + '</p>');
159
});
160
161
+ $('.ai1wm-report-problem-dialog').prepend(errorMessage);
162
} else {
163
+ var successMessage = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your request!</p>');
164
+ $('.ai1wm-report-problem-dialog').html(successMessage);
165
166
// Hide message
167
setTimeout(function () {
168
$('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active');
169
}, 2000);
170
}
171
+ }
172
});
173
});
174
});
180
'use strict';
181
182
/**
183
+ * Copyright (C) 2014-2017 ServMask Inc.
184
+ *
185
+ * This program is free software: you can redistribute it and/or modify
186
+ * it under the terms of the GNU General Public License as published by
187
+ * the Free Software Foundation, either version 3 of the License, or
188
+ * (at your option) any later version.
189
+ *
190
+ * This program is distributed in the hope that it will be useful,
191
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
192
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
193
+ * GNU General Public License for more details.
194
+ *
195
+ * You should have received a copy of the GNU General Public License
196
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
197
+ *
198
+ * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
199
+ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
200
+ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
201
+ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
202
+ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
203
+ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
204
+ */
205
+
206
+ var $ = jQuery;
207
+
208
+ module.exports = {
209
+ random: function random(len) {
210
+ var text = '';
211
+ var possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
212
+
213
+ for (var i = 0; i < len; i++) {
214
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
215
+ }
216
+
217
+ return text;
218
+ },
219
+ form: function form(id) {
220
+ return $(id).serializeArray();
221
+ },
222
+ ucfirst: function ucfirst(text) {
223
+ return text.charAt(0).toUpperCase() + text.slice(1);
224
+ },
225
+ list: function list(input) {
226
+ // Convert object to list
227
+ if ($.isPlainObject(input)) {
228
+ var result = [];
229
+ var params = decodeURIComponent($.param(input)).split('&');
230
+
231
+ // Loop over params
232
+ $.each(params, function (index, item) {
233
+ var value = item.split('=');
234
+
235
+ // Add item
236
+ result.push({ name: value[0], value: value[1] });
237
+ });
238
+
239
+ return result;
240
+ }
241
+
242
+ return input;
243
+ },
244
+ json: function json(input) {
245
+ if ($.type(input) === 'string') {
246
+ var result = input.match(/{[\s\S]+}/);
247
+ if (result !== null) {
248
+ return result[0];
249
+ }
250
+ }
251
+
252
+ return false;
253
+ }
254
+ };
255
+
256
+ /***/ },
257
+ /* 3 */
258
+ /***/ function(module, exports, __webpack_require__) {
259
+
260
+ 'use strict';
261
+
262
+ /**
263
+ * Copyright (C) 2014-2017 ServMask Inc.
264
*
265
* This program is free software: you can redistribute it and/or modify
266
* it under the terms of the GNU General Public License as published by
283
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
284
*/
285
286
+ var Util = __webpack_require__(2);
287
+
288
jQuery(document).ready(function ($) {
289
'use strict';
290
343
var terms = $('.ai1wm-feedback-terms').is(':checked');
344
345
$.ajax({
346
url: ai1wm_feedback.ajax.url,
347
+ type: 'POST',
348
+ dataType: 'json',
349
+ async: false,
350
+ data: { 'ai1wm_type': type, 'ai1wm_email': email, 'ai1wm_message': message, 'ai1wm_terms': +terms },
351
+ dataFilter: function dataFilter(data, type) {
352
+ return Util.json(data);
353
+ },
354
success: function success(data) {
355
+ if (data.errors.length > 0) {
356
// Reset previous messages
357
$('.ai1wm-feedback .ai1wm-message').remove();
358
359
+ var errorMessage = $('<div />').addClass('ai1wm-message ai1wm-error-message');
360
+ $.each(data.errors, function (key, value) {
361
+ errorMessage.append('<p>' + value + '</p>');
362
});
363
364
+ $('.ai1wm-feedback').prepend(errorMessage);
365
} else {
366
+ var successMessage = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your feedback!</p>');
367
+ $('.ai1wm-feedback').html(successMessage);
368
}
369
+ }
370
});
371
});
372
});
373
374
/***/ },
375
/* 4 */
376
/***/ function(module, exports, __webpack_require__) {
378
'use strict';
379
380
/**
381
+ * Copyright (C) 2014-2017 ServMask Inc.
382
*
383
* This program is free software: you can redistribute it and/or modify
384
* it under the terms of the GNU General Public License as published by
401
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
402
*/
403
404
+ var Util = __webpack_require__(2),
405
Modal = __webpack_require__(5),
406
$ = jQuery;
407
411
// Set params
412
this.params = [];
413
414
+ // Set stop flag
415
+ this.stopImport = false;
416
+
417
// Set modal
418
this.modal = new Modal();
419
437
this.params = Util.list(params);
438
};
439
440
+ Import.prototype.start = function (options, retries) {
441
var self = this;
442
+ var retries = retries || 0;
443
+
444
+ // Set stop flag
445
+ if (retries === 0) {
446
+ this.stopImport = false;
447
+ }
448
+
449
+ // Stop running import
450
+ if (this.stopImport) {
451
+ return;
452
+ }
453
454
// Initializing beforeunload event
455
$(window).bind('beforeunload', function () {
456
return 'You are about to stop importing your website, are you sure?';
457
});
458
459
// Set initial status
460
this.setStatus({ type: 'info', message: 'Preparing to import...' });
461
468
}
469
470
// Import
471
+ $.ajax({
472
+ url: ai1wm_import.ajax.url,
473
+ type: 'POST',
474
+ dataType: 'json',
475
+ data: params,
476
+ dataFilter: function dataFilter(data, type) {
477
+ return Util.json(data);
478
+ }
479
+ }).done(function () {
480
self.getStatus();
481
+ }).done(function (params) {
482
+ if (params) {
483
+ self.run(params);
484
+ }
485
}).fail(function () {
486
+ var timeout = retries * 1000;
487
+ if (retries >= 5) {
488
+ return self.setStatus({
489
+ type: 'error',
490
+ message: 'Unable to start the import. Refresh the page and try again'
491
+ });
492
+ }
493
+
494
+ retries++;
495
+
496
+ setTimeout(self.start.bind(self, options, retries), timeout);
497
+ });
498
+ };
499
+
500
+ Import.prototype.run = function (params, retries) {
501
+ var self = this;
502
+ var retries = retries || 0;
503
+
504
+ // Stop running import
505
+ if (this.stopImport) {
506
+ return;
507
+ }
508
+
509
+ // Import
510
+ $.ajax({
511
+ url: ai1wm_import.ajax.url,
512
+ type: 'POST',
513
+ dataType: 'json',
514
+ data: params,
515
+ dataFilter: function dataFilter(data, type) {
516
+ return Util.json(data);
517
+ }
518
+ }).done(function (params) {
519
+ if (params) {
520
+ self.run(params);
521
+ }
522
+ }).fail(function () {
523
+ var timeout = retries * 1000;
524
+
525
+ retries++;
526
+
527
+ setTimeout(self.run.bind(self, params, retries), timeout);
528
});
529
};
530
531
+ Import.prototype.confirm = function (options, retries) {
532
var self = this;
533
+ var retries = retries || 0;
534
+
535
+ // Stop running import
536
+ if (this.stopImport) {
537
+ return;
538
+ }
539
540
// Set params
541
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
546
}
547
548
// Confirm
549
+ $.ajax({
550
+ url: ai1wm_import.ajax.url,
551
+ type: 'POST',
552
+ dataType: 'json',
553
+ data: params,
554
+ dataFilter: function dataFilter(data, type) {
555
+ return Util.json(data);
556
+ }
557
+ }).done(function () {
558
self.getStatus();
559
+ }).done(function (params) {
560
+ if (params) {
561
+ self.run(params);
562
+ }
563
}).fail(function () {
564
+ var timeout = retries * 1000;
565
+ if (retries >= 5) {
566
+ return self.setStatus({
567
+ type: 'error',
568
+ message: 'Unable to confirm the import. Refresh the page and try again'
569
+ });
570
+ }
571
+
572
+ retries++;
573
+
574
+ setTimeout(self.confirm.bind(self, options, retries), timeout);
575
});
576
};
577
578
+ Import.prototype.blogs = function (options, retries) {
579
var self = this;
580
+ var retries = retries || 0;
581
+
582
+ // Stop running import
583
+ if (this.stopImport) {
584
+ return;
585
+ }
586
587
// Set params
588
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 150 });
593
}
594
595
// Blogs
596
+ $.ajax({
597
+ url: ai1wm_import.ajax.url,
598
+ type: 'POST',
599
+ dataType: 'json',
600
+ data: params,
601
+ dataFilter: function dataFilter(data, type) {
602
+ return Util.json(data);
603
+ }
604
+ }).done(function () {
605
self.getStatus();
606
+ }).done(function (params) {
607
+ if (params) {
608
+ self.run(params);
609
+ }
610
}).fail(function () {
611
+ var timeout = retries * 1000;
612
+ if (retries >= 5) {
613
+ return self.setStatus({
614
+ type: 'error',
615
+ message: 'Unable to prepare blogs the import. Refresh the page and try again'
616
+ });
617
+ }
618
+
619
+ retries++;
620
+
621
+ setTimeout(self.blogs.bind(self, options, retries), timeout);
622
});
623
};
624
625
+ Import.prototype.clean = function (options, retries) {
626
var self = this;
627
+ var retries = retries || 0;
628
629
+ // Set stop flag
630
+ this.stopImport = true;
631
+
632
+ // Set initial status
633
+ this.setStatus({ type: 'info', message: 'Please wait, stopping the import...' });
634
635
// Set params
636
var params = this.params.concat({ name: 'secret_key', value: ai1wm_import.secret_key }).concat({ name: 'priority', value: 400 });
641
}
642
643
// Clean
644
+ $.ajax({
645
+ url: ai1wm_import.ajax.url,
646
+ type: 'POST',
647
+ dataType: 'json',
648
+ data: params,
649
+ dataFilter: function dataFilter(data, type) {
650
+ return Util.json(data);
651
+ }
652
+ }).done(function () {
653
// Unbinding the beforeunload event when we stop importing
654
$(window).unbind('beforeunload');
655
+
656
+ // Destroy modal
657
+ self.modal.destroy();
658
}).fail(function () {
659
+ var timeout = retries * 1000;
660
+ if (retries >= 5) {
661
+ return self.setStatus({
662
+ type: 'error',
663
+ message: 'Unable to stop the import. Refresh the page and try again'
664
+ });
665
+ }
666
+
667
+ retries++;
668
+
669
+ setTimeout(self.clean.bind(self, options, retries), timeout);
670
});
671
};
672
674
var self = this;
675
676
// Stop getting status
677
+ if (this.stopImport) {
678
return;
679
}
680
681
$.ajax({
682
url: ai1wm_import.status.url,
683
+ type: 'GET',
684
+ dataType: 'json',
685
+ cache: false,
686
+ dataFilter: function dataFilter(data, type) {
687
+ return Util.json(data);
688
+ }
689
}).done(function (params) {
690
if (params) {
691
self.setStatus(params);
705
}
706
707
// Import is not done yet, let's check status in 3 seconds
708
+ setTimeout(self.getStatus.bind(self), 3000);
709
}).fail(function () {
710
// Import is not done yet, let's check status in 3 seconds
711
+ setTimeout(self.getStatus.bind(self), 3000);
712
});;
713
};
714
737
'use strict';
738
739
/**
740
+ * Copyright (C) 2014-2017 ServMask Inc.
741
*
742
* This program is free software: you can redistribute it and/or modify
743
* it under the terms of the GNU General Public License as published by
788
var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to import');
789
790
// Create close button
791
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
792
+ self.destroy();
793
});
794
795
// Append close button
812
// Progress Modal
813
this.progress = function (params) {
814
if (this.view === 'progress') {
815
+
816
// Update progressBarMeter
817
this.progress.progressBarMeter.width(params.percent + '%');
818
845
this.progress.progressBarPercent = $('<span class="ai1wm-progress-bar-percent">0%</span>').text(params.percent + '%');
846
847
// Create stop import
848
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').on('click', function () {
849
$(this).attr('disabled', 'disabled');
850
self.onStop();
851
});
852
853
// Append progress meter and progress percent
893
var warning = $('<span class="ai1wm-icon-notification"></span>');
894
895
// Create confirm button
896
+ var confirmButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
897
$(this).attr('disabled', 'disabled');
898
self.onConfirm();
899
});
937
var title = $('<span></span>').addClass('ai1wm-title-grey').text(params.title);
938
939
// Create continue button
940
+ var continueButton = $('<button type="button" class="ai1wm-button-green">Continue</button>').on('click', function () {
941
$(this).attr('disabled', 'disabled');
942
self.onBlogs($(this).closest('form').serializeArray());
943
});
981
var loader = $('<span class="ai1wm-loader"></span>');
982
983
// Create stop import
984
+ var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop import</button>').attr('disabled', 'disabled');
985
986
// Append stop button
987
action.append(stopButton);
1022
var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
1023
1024
// Create close button
1025
+ var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1026
+ self.destroy();
1027
});
1028
1029
// Append close button
1085
this.view = params.type;
1086
};
1087
1088
+ Modal.prototype.destroy = function () {
1089
+ this.modal.hide();
1090
+ this.overlay.hide();
1091
+ };
1092
+
1093
module.exports = Modal;
1094
1095
/***/ },
1101
'use strict';
1102
1103
/**
1104
+ * Copyright (C) 2014-2017 ServMask Inc.
1105
*
1106
* This program is free software: you can redistribute it and/or modify
1107
* it under the terms of the GNU General Public License as published by
1124
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
1125
*/
1126
1127
+ var Util = __webpack_require__(2),
1128
Dialog = __webpack_require__(9);
1129
1130
var Extensions = {
1131
+ 's3': 'Amazon S3 Extension',
1132
+ 'url': 'URL Extension',
1133
+ 'ftp': 'FTP Extension',
1134
+ 'gdrive': 'Google Drive Extension',
1135
+ 'dropbox': 'Dropbox Extension'
1136
};
1137
1138
window.Ai1wmExportController = function (provider) {
1139
+ this._export = {};
1140
+ this._provider = provider;
1141
};
1142
1143
window.Ai1wmExportController.prototype.start = function () {
1144
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1145
};
1146
1147
window.Ai1wmImportController = function (provider) {
1148
+ this._import = {};
1149
+ this._provider = provider;
1150
};
1151
1152
window.Ai1wmImportController.prototype.init = function () {};
1153
1154
window.Ai1wmImportController.prototype.download = function () {
1155
+ new Dialog('<strong>All in One WP Migration</strong> is not compatible with current version of ' + '<strong>' + Extensions[this._provider] + '</strong>. Please contact ' + '<a href="mailto:support@servmask.com">support@servmask.com</a> for more details.');
1156
};
1157
1158
+ jQuery(document).ready(function ($) {
1159
+ 'use strict';
1160
+
1161
+ // Box extension
1162
+
1163
+ $('#ai1wmbe-import-file-cancel').attr('type', 'button');
1164
+ $('#ai1wmbe-import-file').attr('type', 'button');
1165
+
1166
+ // Dropbox extension
1167
+ $('#ai1wmde-import-file-cancel').attr('type', 'button');
1168
+ $('#ai1wmde-import-file').attr('type', 'button');
1169
+
1170
+ // FTP extension
1171
+ $('#ai1wmfe-import-file-cancel').attr('type', 'button');
1172
+ $('#ai1wmfe-import-file').attr('type', 'button');
1173
+
1174
+ // Google Drive extension
1175
+ $('#ai1wmge-import-file-cancel').attr('type', 'button');
1176
+ $('#ai1wmge-import-file').attr('type', 'button');
1177
+
1178
+ // OneDrive extension
1179
+ $('#ai1wmoe-import-file-cancel').attr('type', 'button');
1180
+ $('#ai1wmoe-import-file').attr('type', 'button');
1181
+
1182
+ // Amazon S3 extension
1183
+ $('#ai1wmse-import-file-cancel').attr('type', 'button');
1184
+ $('#ai1wmse-import-file').attr('type', 'button');
1185
+
1186
+ // URL extension
1187
+ $('#ai1wmle-import-file-cancel').attr('type', 'button');
1188
+ $('#ai1wmle-import-file').attr('type', 'button');
1189
+ });
1190
+
1191
/***/ },
1192
/* 9 */
1193
/***/ function(module, exports) {
1195
'use strict';
1196
1197
/**
1198
+ * Copyright (C) 2014-2017 ServMask Inc.
1199
*
1200
* This program is free software: you can redistribute it and/or modify
1201
* it under the terms of the GNU General Public License as published by
1242
this.action = $('<div></div>');
1243
1244
// Create close button
1245
+ this.closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
1246
self.modal.hide();
1247
self.overlay.hide();
1248
});
1274
/* WEBPACK VAR INJECTION */(function(fetch, global) {'use strict';
1275
1276
/**
1277
+ * Copyright (C) 2014-2017 ServMask Inc.
1278
*
1279
* This program is free software: you can redistribute it and/or modify
1280
* it under the terms of the GNU General Public License as published by
1297
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
1298
*/
1299
1300
+ var Util = __webpack_require__(2),