1280 lines
43 KiB
JavaScript
Raw Normal View History

2018-01-26 15:50:15 +01:00
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 43);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var $ = jQuery;
module.exports = {
random: function random(len) {
var text = '';
var possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < len; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
},
form: function form(id) {
return $(id).serializeArray();
},
ucfirst: function ucfirst(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
},
list: function list(input) {
// Convert object to list
if ($.isPlainObject(input)) {
var result = [];
var params = decodeURIComponent($.param(input)).split('&');
// Loop over params
$.each(params, function (index, item) {
var value = item.split('=');
// Add item
result.push({ name: value[0], value: value[1] });
});
return result;
}
return input;
},
json: function json(input) {
if ($.type(input) === 'string') {
var result = input.match(/{[\s\S]+}/);
if (result !== null) {
return result[0];
}
}
return false;
}
};
/***/ }),
/***/ 20:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var Util = __webpack_require__(0),
Dialog = __webpack_require__(21);
var Extensions = {
's3': 'Amazon S3 Extension',
'url': 'URL Extension',
'ftp': 'FTP Extension',
'gdrive': 'Google Drive Extension',
'dropbox': 'Dropbox Extension'
};
window.Ai1wmExportController = function (provider) {
this._export = {};
this._provider = provider;
};
window.Ai1wmExportController.prototype.start = function () {
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.');
};
window.Ai1wmImportController = function (provider) {
this._import = {};
this._provider = provider;
};
window.Ai1wmImportController.prototype.init = function () {};
window.Ai1wmImportController.prototype.download = function () {
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.');
};
jQuery(document).ready(function ($) {
'use strict';
// Box extension
$('#ai1wmbe-import-file-cancel').attr('type', 'button');
$('#ai1wmbe-import-file').attr('type', 'button');
// Dropbox extension
$('#ai1wmde-import-file-cancel').attr('type', 'button');
$('#ai1wmde-import-file').attr('type', 'button');
// FTP extension
$('#ai1wmfe-import-file-cancel').attr('type', 'button');
$('#ai1wmfe-import-file').attr('type', 'button');
// Google Drive extension
$('#ai1wmge-import-file-cancel').attr('type', 'button');
$('#ai1wmge-import-file').attr('type', 'button');
// OneDrive extension
$('#ai1wmoe-import-file-cancel').attr('type', 'button');
$('#ai1wmoe-import-file').attr('type', 'button');
// Amazon S3 extension
$('#ai1wmse-import-file-cancel').attr('type', 'button');
$('#ai1wmse-import-file').attr('type', 'button');
// URL extension
$('#ai1wmle-import-file-cancel').attr('type', 'button');
$('#ai1wmle-import-file').attr('type', 'button');
});
/***/ }),
/***/ 21:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var $ = jQuery;
var Dialog = function Dialog(text) {
var self = this;
// Create the overlay
this.overlay = $('<div class="ai1wm-overlay"></div>');
// Create the modal container
this.container = $('<div></div>');
// Create the modal container
this.modal = $('<div class="ai1wm-modal-container"></div>');
// Create section to hold title, message and action
this.section = $('<section></section>');
// Create paragraph to hold mesage
this.message = $('<p></p>').addClass('ai1wm-dialog-message').html(text);
// Create action section
this.action = $('<div></div>');
// Create close button
this.closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
self.modal.hide();
self.overlay.hide();
});
// Append close button
this.action.append(this.closeButton);
// Append message to section
this.section.append(this.message);
// Append section and action to container
this.container.append(this.section).append(this.action);
// Render modal
this.modal.html(this.container).show();
this.overlay.show();
$('body').append(this.overlay).append(this.modal);
};
module.exports = Dialog;
/***/ }),
/***/ 43:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var Query = __webpack_require__(44),
FindReplace = __webpack_require__(45),
Report = __webpack_require__(5),
Feedback = __webpack_require__(6),
Util = __webpack_require__(0),
Deprecated = __webpack_require__(20),
Export = __webpack_require__(46);
jQuery(document).ready(function ($) {
'use strict';
var model = new Export();
// Export to file
$('#ai1wm-export-file').click(function (e) {
var storage = Util.random(12);
var options = Util.form('#ai1wm-export-form').concat({ name: 'storage', value: storage });
// Set global params
model.setParams(options);
// Start export
model.start();
e.preventDefault();
});
$('.ai1wm-accordion > .ai1wm-title').click(function () {
$(this).parent().toggleClass('ai1wm-active');
});
$('#ai1wm-add-new-replace-button').ai1wm_find_replace();
$('.ai1wm-expandable > p:first, .ai1wm-expandable > h4:first, .ai1wm-expandable > div.ai1wm-button-main').on('click', function () {
$(this).parent().toggleClass('ai1wm-open');
});
$('.ai1wm-query').ai1wm_query();
});
global.Ai1wm = { Util: Util, Export: Export };
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
/***/ }),
/***/ 44:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
;(function ($) {
$.fn.ai1wm_query = function () {
var findInput = $(this).find('input.ai1wm-query-find-input'),
replaceInput = $(this).find('input.ai1wm-query-replace-input'),
findText = $(this).find('small.ai1wm-query-find-text'),
replaceText = $(this).find('small.ai1wm-query-replace-text');
findInput.on('change paste input keypress keydown keyup', function () {
var _inputValue = $(this).val().length > 0 ? $(this).val() : '<text>';
findText.text(_inputValue);
});
replaceInput.on('change paste input keypress keydown keyup', function () {
var _inputValue = $(this).val().length > 0 ? $(this).val() : '<another-text>';
replaceText.text(_inputValue);
});
return this;
};
})(jQuery);
/***/ }),
/***/ 45:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
;(function ($) {
$.fn.ai1wm_find_replace = function () {
$(this).click(function (e) {
e.preventDefault();
var row = $('#ai1wm-queries > li:first').clone();
// Reset input values
row.find('input').val('');
// Reset ai1wm-query-find-text
row.find('.ai1wm-query-find-text').html('&lt;text&gt;');
// Reset ai1wm-query-replace-text
row.find('.ai1wm-query-replace-text').html('&lt;another-text&gt;');
$('#ai1wm-queries > li').removeClass('ai1wm-open');
$(row).addClass('ai1wm-open');
// Add new replace fields
$('#ai1wm-queries').append(row);
$(row).ai1wm_query();
$(row).find('p:first').on('click', function () {
$(this).parent().toggleClass('ai1wm-open');
});
});
return this;
};
})(jQuery);
/***/ }),
/***/ 46:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var Util = __webpack_require__(0),
Modal = __webpack_require__(47),
$ = jQuery;
var Export = function Export() {
var self = this;
// Set params
this.params = [];
// Set stop flag
this.stopExport = false;
// Set modal
this.modal = new Modal();
// Set stop listener
this.modal.onStop = function (options) {
self.onStop(options);
};
};
Export.prototype.setParams = function (params) {
this.params = Util.list(params);
};
Export.prototype.start = function (options, retries) {
var self = this;
var retries = retries || 0;
// Set stop flag
if (retries === 0) {
this.stopExport = false;
}
// Stop running export
if (this.stopExport) {
return;
}
// Initializing beforeunload event
$(window).bind('beforeunload', function () {
return 'You are about to stop exporting your website, are you sure?';
});
// Set initial status
this.setStatus({ type: 'info', message: 'Preparing to export...' });
// Set params
var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key });
// Set additional params
if (options) {
params = params.concat(Util.list(options));
}
// Export
$.ajax({
url: ai1wm_export.ajax.url,
type: 'POST',
dataType: 'json',
data: params,
dataFilter: function dataFilter(data, type) {
return Util.json(data);
}
}).done(function () {
self.getStatus();
}).done(function (params) {
if (params) {
self.run(params);
}
}).fail(function () {
var timeout = retries * 1000;
if (retries >= 5) {
return self.setStatus({
type: 'error',
message: 'Unable to start the export. Refresh the page and try again'
});
}
retries++;
setTimeout(self.start.bind(self, options, retries), timeout);
});
};
Export.prototype.run = function (params, retries) {
var self = this;
var retries = retries || 0;
// Stop running export
if (this.stopExport) {
return;
}
// Export
$.ajax({
url: ai1wm_export.ajax.url,
type: 'POST',
dataType: 'json',
data: params,
dataFilter: function dataFilter(data, type) {
return Util.json(data);
}
}).done(function (params) {
if (params) {
self.run(params);
}
}).fail(function () {
var timeout = retries * 1000;
if (retries >= 5) {
return self.setStatus({
type: 'error',
message: 'Unable to run the export. Refresh the page and try again'
});
}
retries++;
setTimeout(self.run.bind(self, params, retries), timeout);
});
};
Export.prototype.clean = function (options, retries) {
var self = this;
var retries = retries || 0;
// Set stop flag
this.stopExport = true;
// Set initial status
this.setStatus({ type: 'info', message: 'Please wait, stopping the export...' });
// Set params
var params = this.params.concat({ name: 'secret_key', value: ai1wm_export.secret_key }).concat({ name: 'priority', value: 300 });
// Set additional params
if (options) {
params = params.concat(Util.list(options));
}
// Clean
$.ajax({
url: ai1wm_export.ajax.url,
type: 'POST',
dataType: 'json',
data: params,
dataFilter: function dataFilter(data, type) {
return Util.json(data);
}
}).done(function () {
// Unbinding the beforeunload event when we stop exporting
$(window).unbind('beforeunload');
// Destroy modal
self.modal.destroy();
}).fail(function () {
var timeout = retries * 1000;
if (retries >= 5) {
return self.setStatus({
type: 'error',
message: 'Unable to stop the export. Refresh the page and try again'
});
}
retries++;
setTimeout(self.clean.bind(self, options, retries), timeout);
});
};
Export.prototype.getStatus = function () {
var self = this;
// Stop getting status
if (this.stopExport) {
return;
}
$.ajax({
url: ai1wm_export.status.url,
type: 'GET',
dataType: 'json',
cache: false,
dataFilter: function dataFilter(data, type) {
return Util.json(data);
}
}).done(function (params) {
if (params) {
self.setStatus(params);
// Next status
switch (params.type) {
case 'done':
case 'error':
case 'download':
// Unbinding beforeunload event when any case is performed
$(window).unbind('beforeunload');
return;
}
}
// Export is not done yet, let's check status in 3 seconds
setTimeout(self.getStatus.bind(self), 3000);
}).fail(function () {
// Export is not done yet, let's check status in 3 seconds
setTimeout(self.getStatus.bind(self), 3000);
});
};
Export.prototype.setStatus = function (params) {
this.modal.render(params);
};
Export.prototype.onStop = function (options) {
this.clean(options);
};
module.exports = Export;
/***/ }),
/***/ 47:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var $ = jQuery;
var Modal = function Modal() {
var self = this;
// Error Modal
this.error = function (params) {
// Create the modal container
var container = $('<div></div>');
// Create section to hold title, message and action
var section = $('<section></section>');
// Create header to hold title
var header = $('<h1></h1>');
// Create paragraph to hold mesage
var message = $('<p></p>').html(params.message);
// Create action section
var action = $('<div></div>');
// Create title
var title = $('<span></span>').addClass('ai1wm-title-red').text('Unable to export');
// Create close button
var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
self.destroy();
});
// Append close button
action.append(closeButton);
// Append title to section
header.append(title);
// Append header and message to section
section.append(header).append(message);
// Append section and action to container
container.append(section).append(action);
// Render modal
self.modal.html(container).show();
self.overlay.show();
};
// Info Modal
this.info = function (params) {
// Create the modal container
var container = $('<div></div>');
// Create section to hold title, message and action
var section = $('<section></section>');
// Create header to hold loader
var header = $('<h1></h1>');
// Create paragraph to hold mesage
var message = $('<p></p>').html(params.message);
// Create action section
var action = $('<div></div>');
// Create loader
var loader = $('<span class="ai1wm-loader"></span>');
// Create stop export
var stopButton = $('<button type="button" class="ai1wm-button-red"><i class="ai1wm-icon-notification"></i> Stop export</button>').on('click', function () {
$(this).attr('disabled', 'disabled');
self.onStop();
});
// Append stop button
action.append(stopButton);
// Append loader to header
header.append(loader);
// Append header and message to section
section.append(header).append(message);
// Append section and action to container
container.append(section).append(action);
// Render modal
self.modal.html(container).show();
self.overlay.show();
};
// Done Modal
this.done = function (params) {
// Create the modal container
var container = $('<div></div>');
// Create section to hold title, message and action
var section = $('<section></section>');
// Create header to hold title
var header = $('<h1></h1>');
// Create paragraph to hold mesage
var message = $('<p></p>').html(params.message);
// Create action section
var action = $('<div></div>');
// Create title
var title = $('<span></span>').addClass('ai1wm-title-green').text(params.title);
// Create close button
var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
self.destroy();
});
// Append close button
action.append(closeButton);
// Append title to section
header.append(title);
// Append header and message to section
section.append(header).append(message);
// Append section and action to container
container.append(section).append(action);
// Render modal
self.modal.html(container).show();
self.overlay.show();
};
// Download Modal
this.download = function (params) {
// Create the modal container
var container = $('<div></div>');
// Create section to hold title, message and action
var section = $('<section></section>');
// Create header to hold title
var header = $('<h1></h1>');
// Create paragraph to hold mesage
var message = $('<p></p>').html(params.message);
// Create action section
var action = $('<div></div>');
// Create close button
var closeButton = $('<button type="button" class="ai1wm-button-red">Close</button>').on('click', function () {
self.destroy();
});
// Append close button
action.append(closeButton);
// Append message to section
section.append(message);
// Append section and action to container
container.append(section).append(action);
// Render modal
self.modal.html(container).show();
self.overlay.show();
};
// Create the overlay
this.overlay = $('<div class="ai1wm-overlay"></div>');
// Create the modal container
this.modal = $('<div class="ai1wm-modal-container"></div>');
$('body').append(this.overlay) // Append overlay to body
.append(this.modal); // Append modal to body
};
Modal.prototype.render = function (params) {
// Show modal
switch (params.type) {
case 'error':
this.error(params);
break;
case 'info':
this.info(params);
break;
case 'done':
this.done(params);
break;
case 'download':
this.download(params);
break;
}
};
Modal.prototype.destroy = function () {
this.modal.hide();
this.overlay.hide();
};
module.exports = Modal;
/***/ }),
/***/ 5:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var Util = __webpack_require__(0);
jQuery(document).ready(function ($) {
'use strict';
$('#ai1wm-report-problem-button').click(function (e) {
$(this).next('.ai1wm-report-problem-dialog').toggleClass('ai1wm-report-active');
e.preventDefault();
});
$('#ai1wm-report-cancel').click(function (e) {
$(this).closest('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active');
e.preventDefault();
});
$('#ai1wm-report-submit').click(function (event) {
event.preventDefault();
var submit_button = $(this);
var spinner = $(submit_button).next();
var email = $('.ai1wm-report-email').val();
var message = $('.ai1wm-report-message').val();
var terms = $('.ai1wm-report-terms').is(':checked');
$(submit_button).attr('disabled', true);
$(spinner).css('visibility', 'visible');
$.ajax({
url: ai1wm_report.ajax.url,
type: 'POST',
dataType: 'json',
async: true,
data: {
'secret_key': ai1wm_report.secret_key,
'ai1wm_email': email,
'ai1wm_message': message,
'ai1wm_terms': +terms
},
dataFilter: function dataFilter(data, type) {
return Util.json(data);
},
success: function success(data) {
$(submit_button).attr('disabled', false);
$(spinner).css('visibility', 'hidden');
if (data.errors.length > 0) {
// Reset previous messages
$('.ai1wm-report-problem-dialog .ai1wm-message').remove();
var errorMessage = $('<div />').addClass('ai1wm-message ai1wm-error-message');
$.each(data.errors, function (key, value) {
errorMessage.append('<p>' + value + '</p>');
});
$('.ai1wm-report-problem-dialog').prepend(errorMessage);
} else {
var successMessage = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your request!</p>');
$('.ai1wm-report-problem-dialog').html(successMessage);
// Hide message
setTimeout(function () {
$('.ai1wm-report-problem-dialog').removeClass('ai1wm-report-active');
}, 2000);
}
}
});
});
});
/***/ }),
/***/ 6:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (C) 2014-2017 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*
*
*
*/
var Util = __webpack_require__(0);
jQuery(document).ready(function ($) {
'use strict';
// Reset feedback form
$('.ai1wm-feedback-type').attr('checked', false);
// Review
$('#ai1wm-feedback-type-link-1').click(function (e) {
var radio = $('#ai1wm-feedback-type-1');
if (radio.is(':checked')) {
radio.attr('checked', false);
e.preventDefault();
} else {
radio.attr('checked', true);
}
});
// Improvement
$('#ai1wm-feedback-type-2').click(function () {
// Hide other options
$('#ai1wm-feedback-type-1, #ai1wm-feedback-type-3').closest('li').hide();
// change placeholder message
$('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', 'Leave plugin developers any feedback here');
// Show feedback form
$('.ai1wm-feedback-form').fadeIn();
});
// Help
$('#ai1wm-feedback-type-3').click(function () {
// Hide other options
$('#ai1wm-feedback-type-1, #ai1wm-feedback-type-2').closest('li').hide();
// change placeholder message
$('.ai1wm-feedback-form').find('.ai1wm-feedback-message').attr('placeholder', 'How may we help you?');
// Show feedback form
$('.ai1wm-feedback-form').fadeIn();
});
// Cancel feedback form
$('#ai1wm-feedback-cancel').click(function (e) {
$('.ai1wm-feedback-form').fadeOut(function () {
$('.ai1wm-feedback-type').attr('checked', false).closest('li').show();
});
e.preventDefault();
});
// Send feedback form
$('#ai1wm-feedback-submit').click(function (event) {
event.preventDefault();
var submit_button = $(this);
var spinner = $(submit_button).next();
var type = $('.ai1wm-feedback-type:checked').val();
var email = $('.ai1wm-feedback-email').val();
var message = $('.ai1wm-feedback-message').val();
var terms = $('.ai1wm-feedback-terms').is(':checked');
$(submit_button).attr('disabled', true);
$(spinner).css('visibility', 'visible');
$.ajax({
url: ai1wm_feedback.ajax.url,
type: 'POST',
dataType: 'json',
async: true,
data: {
'secret_key': ai1wm_feedback.secret_key,
'ai1wm_type': type,
'ai1wm_email': email,
'ai1wm_message': message,
'ai1wm_terms': +terms
},
dataFilter: function dataFilter(data, type) {
return Util.json(data);
},
success: function success(data) {
$(submit_button).attr('disabled', false);
$(spinner).css('visibility', 'hidden');
if (data.errors.length > 0) {
// Reset previous messages
$('.ai1wm-feedback .ai1wm-message').remove();
var errorMessage = $('<div />').addClass('ai1wm-message ai1wm-error-message');
$.each(data.errors, function (key, value) {
errorMessage.append('<p>' + value + '</p>');
});
$('.ai1wm-feedback').prepend(errorMessage);
} else {
var successMessage = $('<div />').addClass('ai1wm-message ai1wm-success-message').append('<p>Thanks for submitting your feedback!</p>');
$('.ai1wm-feedback').html(successMessage);
}
}
});
});
});
/***/ }),
/***/ 7:
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ })
/******/ });