|
|
@ -1839,8 +1839,7 @@ define([
|
|
|
|
UIElements.setExpirationValue(cfg.expire, $creation);
|
|
|
|
UIElements.setExpirationValue(cfg.expire, $creation);
|
|
|
|
|
|
|
|
|
|
|
|
// Create the pad
|
|
|
|
// Create the pad
|
|
|
|
var create = function (template) {
|
|
|
|
var getFormValues = function (template) {
|
|
|
|
$creationContainer.remove();
|
|
|
|
|
|
|
|
// Type of pad
|
|
|
|
// Type of pad
|
|
|
|
var ownedVal = parseInt($('input[name="cp-creation-owned"]:checked').val());
|
|
|
|
var ownedVal = parseInt($('input[name="cp-creation-owned"]:checked').val());
|
|
|
|
// Life time
|
|
|
|
// Life time
|
|
|
@ -1856,11 +1855,16 @@ define([
|
|
|
|
expireVal = ($('#cp-creation-expire-val').val() || 0) * unit;
|
|
|
|
expireVal = ($('#cp-creation-expire-val').val() || 0) * unit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
common.createPad({
|
|
|
|
return {
|
|
|
|
owned: ownedVal,
|
|
|
|
owned: ownedVal,
|
|
|
|
expire: expireVal,
|
|
|
|
expire: expireVal,
|
|
|
|
template: template
|
|
|
|
template: template
|
|
|
|
}, function () {
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var create = function (template) {
|
|
|
|
|
|
|
|
$creationContainer.remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
common.createPad(getFormValues(template), function () {
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -1905,10 +1909,39 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// Settings button
|
|
|
|
// Settings button
|
|
|
|
var origin = common.getMetadataMgr().getPrivateData().origin;
|
|
|
|
var origin = common.getMetadataMgr().getPrivateData().origin;
|
|
|
|
$(h('div.cp-creation-settings', h('a', {
|
|
|
|
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide();
|
|
|
|
href: origin + '/settings/#creation',
|
|
|
|
var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide();
|
|
|
|
target: '_blank'
|
|
|
|
var okTo;
|
|
|
|
}, Messages.creation_settings))).appendTo($creation);
|
|
|
|
var $saveButton = $('<button>').text(Messages.creation_saveSettings).click(function () {
|
|
|
|
|
|
|
|
if (okTo) { clearTimeout(okTo); }
|
|
|
|
|
|
|
|
$ok.hide();
|
|
|
|
|
|
|
|
$spinner.show();
|
|
|
|
|
|
|
|
var val = getFormValues();
|
|
|
|
|
|
|
|
NThen(function (waitFor) {
|
|
|
|
|
|
|
|
common.setAttribute(['general', 'creation', 'owned'], val.owned, waitFor(function (e) {
|
|
|
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
common.setAttribute(['general', 'creation', 'expire'], val.expire, waitFor(function (e) {
|
|
|
|
|
|
|
|
if (e) { return void console.error(e); }
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
$spinner.hide();
|
|
|
|
|
|
|
|
$ok.show();
|
|
|
|
|
|
|
|
okTo = setTimeout(function () {
|
|
|
|
|
|
|
|
$ok.hide();
|
|
|
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(h('div.cp-creation-settings', [
|
|
|
|
|
|
|
|
$saveButton[0],
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
|
|
|
|
h('a', {
|
|
|
|
|
|
|
|
href: origin + '/settings/#creation',
|
|
|
|
|
|
|
|
target: '_blank'
|
|
|
|
|
|
|
|
}, Messages.creation_settings),
|
|
|
|
|
|
|
|
$ok[0],
|
|
|
|
|
|
|
|
$spinner[0]
|
|
|
|
|
|
|
|
])).appendTo($creation);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIElements.onServerError = function (common, err, toolbar, cb) {
|
|
|
|
UIElements.onServerError = function (common, err, toolbar, cb) {
|
|
|
|