|
|
@ -13,8 +13,6 @@ define([
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
|
|
|
|
|
|
|
|
'css!/common/tippy.css',
|
|
|
|
|
|
|
|
], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Clipboard,
|
|
|
|
], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Clipboard,
|
|
|
|
Messages, AppConfig, NThen) {
|
|
|
|
Messages, AppConfig, NThen) {
|
|
|
|
var UIElements = {};
|
|
|
|
var UIElements = {};
|
|
|
@ -237,7 +235,11 @@ define([
|
|
|
|
var link = h('div.cp-share-modal', [
|
|
|
|
var link = h('div.cp-share-modal', [
|
|
|
|
h('label', Messages.share_linkAccess),
|
|
|
|
h('label', Messages.share_linkAccess),
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
h('input#cp-share-editable-true.cp-share-editable-value', {
|
|
|
|
UI.createRadio('cp-share-editable', 'cp-share-editable-true',
|
|
|
|
|
|
|
|
Messages.share_linkEdit, true, { mark: {tabindex:1} }),
|
|
|
|
|
|
|
|
UI.createRadio('cp-share-editable', 'cp-share-editable-false',
|
|
|
|
|
|
|
|
Messages.share_linkView, false, { mark: {tabindex:1} }),
|
|
|
|
|
|
|
|
/*h('input#cp-share-editable-true.cp-share-editable-value', {
|
|
|
|
type: 'radio',
|
|
|
|
type: 'radio',
|
|
|
|
name: 'cp-share-editable',
|
|
|
|
name: 'cp-share-editable',
|
|
|
|
value: 1,
|
|
|
|
value: 1,
|
|
|
@ -248,25 +250,14 @@ define([
|
|
|
|
name: 'cp-share-editable',
|
|
|
|
name: 'cp-share-editable',
|
|
|
|
value: 0
|
|
|
|
value: 0
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
h('label', { 'for': 'cp-share-editable-false' }, Messages.share_linkView),
|
|
|
|
h('label', { 'for': 'cp-share-editable-false' }, Messages.share_linkView),*/
|
|
|
|
h('br'),
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
h('label', Messages.share_linkOptions),
|
|
|
|
h('label', Messages.share_linkOptions),
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
h('input#cp-share-embed', {
|
|
|
|
UI.createCheckbox('cp-share-embed', Messages.share_linkEmbed, false, { mark: {tabindex:1} }),
|
|
|
|
type: 'checkbox',
|
|
|
|
UI.createCheckbox('cp-share-present', Messages.share_linkPresent, false, { mark: {tabindex:1} }),
|
|
|
|
name: 'cp-share-embed'
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
h('label', { 'for': 'cp-share-embed' }, Messages.share_linkEmbed),
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
h('br'),
|
|
|
|
h('input#cp-share-present', {
|
|
|
|
UI.dialog.selectable('', { id: 'cp-share-link-preview', tabindex: 1 })
|
|
|
|
type: 'checkbox',
|
|
|
|
|
|
|
|
name: 'cp-share-present'
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
h('label', { 'for': 'cp-share-present' }, Messages.share_linkPresent),
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
|
|
|
|
h('br'),
|
|
|
|
|
|
|
|
UI.dialog.selectable('', { id: 'cp-share-link-preview' })
|
|
|
|
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
if (!hashes.editHash) {
|
|
|
|
if (!hashes.editHash) {
|
|
|
|
$(link).find('#cp-share-editable-false').attr('checked', true);
|
|
|
|
$(link).find('#cp-share-editable-false').attr('checked', true);
|
|
|
@ -1685,14 +1676,10 @@ define([
|
|
|
|
var priv = common.getMetadataMgr().getPrivateData();
|
|
|
|
var priv = common.getMetadataMgr().getPrivateData();
|
|
|
|
var c = (priv.settings.general && priv.settings.general.creation) || {};
|
|
|
|
var c = (priv.settings.general && priv.settings.general.creation) || {};
|
|
|
|
if (AppConfig.displayCreationScreen && common.isLoggedIn() && c.skip) {
|
|
|
|
if (AppConfig.displayCreationScreen && common.isLoggedIn() && c.skip) {
|
|
|
|
$advanced = $('<input>', {
|
|
|
|
var $cboxLabel = $(UI.createCheckbox('cp-app-toolbar-creation-advanced',
|
|
|
|
type: 'checkbox',
|
|
|
|
Messages.creation_newPadModalAdvanced, true))
|
|
|
|
checked: 'checked',
|
|
|
|
.appendTo($advancedContainer);
|
|
|
|
id: 'cp-app-toolbar-creation-advanced'
|
|
|
|
$advanced = $cboxLabel.find('input');
|
|
|
|
}).appendTo($advancedContainer);
|
|
|
|
|
|
|
|
$('<label>', {
|
|
|
|
|
|
|
|
for: 'cp-app-toolbar-creation-advanced'
|
|
|
|
|
|
|
|
}).text(Messages.creation_newPadModalAdvanced).appendTo($advancedContainer);
|
|
|
|
|
|
|
|
$description.append('<br>');
|
|
|
|
$description.append('<br>');
|
|
|
|
$description.append(Messages.creation_newPadModalDescriptionAdvanced);
|
|
|
|
$description.append(Messages.creation_newPadModalDescriptionAdvanced);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1782,11 +1769,15 @@ define([
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
|
var focus;
|
|
|
|
var focus;
|
|
|
|
|
|
|
|
|
|
|
|
var pickerCfg = {
|
|
|
|
var pickerCfgInit = {
|
|
|
|
types: [type],
|
|
|
|
types: [type],
|
|
|
|
where: ['template'],
|
|
|
|
where: ['template'],
|
|
|
|
hidden: true
|
|
|
|
hidden: true
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var pickerCfg = {
|
|
|
|
|
|
|
|
types: [type],
|
|
|
|
|
|
|
|
where: ['template'],
|
|
|
|
|
|
|
|
};
|
|
|
|
var onConfirm = function (yes) {
|
|
|
|
var onConfirm = function (yes) {
|
|
|
|
if (!yes) {
|
|
|
|
if (!yes) {
|
|
|
|
if (focus) { focus.focus(); }
|
|
|
|
if (focus) { focus.focus(); }
|
|
|
@ -1814,7 +1805,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {
|
|
|
|
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {
|
|
|
|
if (data) {
|
|
|
|
if (data) {
|
|
|
|
common.openFilePicker(pickerCfg);
|
|
|
|
common.openFilePicker(pickerCfgInit);
|
|
|
|
focus = document.activeElement;
|
|
|
|
focus = document.activeElement;
|
|
|
|
if (force) { return void onConfirm(true); }
|
|
|
|
if (force) { return void onConfirm(true); }
|
|
|
|
UI.confirm(Messages.useTemplate, onConfirm, {
|
|
|
|
UI.confirm(Messages.useTemplate, onConfirm, {
|
|
|
@ -1858,11 +1849,15 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var $body = $('body');
|
|
|
|
var $body = $('body');
|
|
|
|
var $creationContainer = $('<div>', { id: 'cp-creation-container' }).appendTo($body);
|
|
|
|
var $creationContainer = $('<div>', { id: 'cp-creation-container' }).appendTo($body);
|
|
|
|
|
|
|
|
var urlArgs = (Config.requireConf && Config.requireConf.urlArgs) || '';
|
|
|
|
|
|
|
|
var l = h('div.cp-creation-logo', h('img', { src: '/customize/alt-favicon.png?' + urlArgs }));
|
|
|
|
|
|
|
|
$(l).appendTo($creationContainer);
|
|
|
|
var $creation = $('<div>', { id: 'cp-creation', tabindex: 1 }).appendTo($creationContainer);
|
|
|
|
var $creation = $('<div>', { id: 'cp-creation', tabindex: 1 }).appendTo($creationContainer);
|
|
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
// Title
|
|
|
|
var colorClass = 'cp-icon-color-'+type;
|
|
|
|
//var colorClass = 'cp-icon-color-'+type;
|
|
|
|
$creation.append(h('h2.cp-creation-title', Messages.newButtonTitle));
|
|
|
|
//$creation.append(h('h2.cp-creation-title', Messages.newButtonTitle));
|
|
|
|
|
|
|
|
$creation.append(h('h3.cp-creation-title', Messages['button_new'+type]));
|
|
|
|
//$creation.append(h('h2.cp-creation-title.'+colorClass, Messages.newButtonTitle));
|
|
|
|
//$creation.append(h('h2.cp-creation-title.'+colorClass, Messages.newButtonTitle));
|
|
|
|
|
|
|
|
|
|
|
|
// Deleted pad warning
|
|
|
|
// Deleted pad warning
|
|
|
@ -1874,10 +1869,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var origin = common.getMetadataMgr().getPrivateData().origin;
|
|
|
|
var origin = common.getMetadataMgr().getPrivateData().origin;
|
|
|
|
var createHelper = function (href, text) {
|
|
|
|
var createHelper = function (href, text) {
|
|
|
|
var q = h('a.cp-creation-help.fa.fa-question', {
|
|
|
|
var q = h('a.cp-creation-help.fa.fa-question-circle', {
|
|
|
|
title: text,
|
|
|
|
title: text,
|
|
|
|
href: origin + href,
|
|
|
|
href: origin + href,
|
|
|
|
target: "_blank"
|
|
|
|
target: "_blank",
|
|
|
|
|
|
|
|
'data-tippy-placement': "right"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return q;
|
|
|
|
return q;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -1885,30 +1881,14 @@ define([
|
|
|
|
// Owned pads
|
|
|
|
// Owned pads
|
|
|
|
// Default is Owned pad
|
|
|
|
// Default is Owned pad
|
|
|
|
var owned = h('div.cp-creation-owned', [
|
|
|
|
var owned = h('div.cp-creation-owned', [
|
|
|
|
h('label.cp-checkmark', [
|
|
|
|
UI.createCheckbox('cp-creation-owned', Messages.creation_owned, true),
|
|
|
|
h('input', {
|
|
|
|
|
|
|
|
type: 'checkbox',
|
|
|
|
|
|
|
|
id: 'cp-creation-owned',
|
|
|
|
|
|
|
|
checked: 'checked'
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
h('span.cp-checkmark-mark'),
|
|
|
|
|
|
|
|
Messages.creation_owned
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
createHelper('/faq.html#keywords-owned', Messages.creation_owned1)
|
|
|
|
createHelper('/faq.html#keywords-owned', Messages.creation_owned1)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
// Life time
|
|
|
|
// Life time
|
|
|
|
var expire = h('div.cp-creation-expire', [
|
|
|
|
var expire = h('div.cp-creation-expire', [
|
|
|
|
h('label.cp-checkmark', [
|
|
|
|
UI.createCheckbox('cp-creation-expire', Messages.creation_expire, false),
|
|
|
|
h('input', {
|
|
|
|
h('span.cp-creation-expire-picker.cp-creation-slider', [
|
|
|
|
type: 'checkbox',
|
|
|
|
|
|
|
|
id: 'cp-creation-expire'
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
h('span.cp-checkmark-mark'),
|
|
|
|
|
|
|
|
Messages.creation_expire
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
createHelper('/faq.html#keywords-expiring', Messages.creation_expire2),
|
|
|
|
|
|
|
|
h('div.cp-creation-expire-picker.cp-creation-slider', [
|
|
|
|
|
|
|
|
h('input#cp-creation-expire-val', {
|
|
|
|
h('input#cp-creation-expire-val', {
|
|
|
|
type: "number",
|
|
|
|
type: "number",
|
|
|
|
min: 1,
|
|
|
|
min: 1,
|
|
|
@ -1923,60 +1903,73 @@ define([
|
|
|
|
selected: 'selected'
|
|
|
|
selected: 'selected'
|
|
|
|
}, Messages.creation_expireMonths)
|
|
|
|
}, Messages.creation_expireMonths)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]),
|
|
|
|
|
|
|
|
createHelper('/faq.html#keywords-expiring', Messages.creation_expire2),
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
var createDiv = h('div.cp-creation-create');
|
|
|
|
var right = h('span.fa.fa-chevron-right.cp-creation-template-more');
|
|
|
|
var $create = $(createDiv);
|
|
|
|
var left = h('span.fa.fa-chevron-left.cp-creation-template-more');
|
|
|
|
|
|
|
|
|
|
|
|
var templates = h('div.cp-creation-template', [
|
|
|
|
var templates = h('div.cp-creation-template', [
|
|
|
|
h('h3.cp-creation-title.'+colorClass, Messages['button_new'+type]),
|
|
|
|
left,
|
|
|
|
h('div.cp-creation-template-container', [
|
|
|
|
h('div.cp-creation-template-container', [
|
|
|
|
h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')
|
|
|
|
h('span.fa.fa-circle-o-notch.fa-spin.fa-4x.fa-fw')
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
createDiv
|
|
|
|
right
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
var settings = h('div.cp-creation-remember', [
|
|
|
|
var settings = h('div.cp-creation-remember', [
|
|
|
|
h('label.cp-checkmark', [
|
|
|
|
UI.createCheckbox('cp-creation-remember', Messages.creation_saveSettings, false),
|
|
|
|
h('input', {
|
|
|
|
|
|
|
|
type: 'checkbox',
|
|
|
|
|
|
|
|
id: 'cp-creation-remember'
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
h('span.cp-checkmark-mark'),
|
|
|
|
|
|
|
|
Messages.creation_saveSettings
|
|
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
createHelper('/settings/#creation', Messages.creation_settings),
|
|
|
|
createHelper('/settings/#creation', Messages.creation_settings),
|
|
|
|
h('div.cp-creation-remember-help.cp-creation-slider', Messages.creation_rememberHelp)
|
|
|
|
h('div.cp-creation-remember-help.cp-creation-slider', [
|
|
|
|
|
|
|
|
h('span.fa.fa-exclamation-circle.cp-creation-warning'),
|
|
|
|
|
|
|
|
Messages.creation_rememberHelp
|
|
|
|
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createDiv = h('div.cp-creation-create');
|
|
|
|
|
|
|
|
var $create = $(createDiv);
|
|
|
|
|
|
|
|
|
|
|
|
$(h('div#cp-creation-form', [
|
|
|
|
$(h('div#cp-creation-form', [
|
|
|
|
owned,
|
|
|
|
owned,
|
|
|
|
expire,
|
|
|
|
expire,
|
|
|
|
settings,
|
|
|
|
settings,
|
|
|
|
templates
|
|
|
|
templates,
|
|
|
|
|
|
|
|
createDiv
|
|
|
|
])).appendTo($creation);
|
|
|
|
])).appendTo($creation);
|
|
|
|
|
|
|
|
|
|
|
|
// Display templates
|
|
|
|
// Display templates
|
|
|
|
var selected = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var selected = 0; // Selected template in the list (highlighted)
|
|
|
|
|
|
|
|
var TEMPLATES_DISPLAYED = 4; // Max templates displayed per page
|
|
|
|
|
|
|
|
var next = function () {}; // Function called when pressing tab to highlight the next template
|
|
|
|
|
|
|
|
var i = 0; // Index of the first template displayed in the current page
|
|
|
|
sframeChan.query("Q_CREATE_TEMPLATES", type, function (err, res) {
|
|
|
|
sframeChan.query("Q_CREATE_TEMPLATES", type, function (err, res) {
|
|
|
|
if (!res.data || !Array.isArray(res.data)) {
|
|
|
|
if (!res.data || !Array.isArray(res.data)) {
|
|
|
|
return void console.error("Error: get the templates list");
|
|
|
|
return void console.error("Error: get the templates list");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var data = res.data.slice().sort(function (a, b) {
|
|
|
|
var allData = res.data.slice().sort(function (a, b) {
|
|
|
|
|
|
|
|
if (a.used === b.used) {
|
|
|
|
|
|
|
|
// Sort by name
|
|
|
|
if (a.name === b.name) { return 0; }
|
|
|
|
if (a.name === b.name) { return 0; }
|
|
|
|
return a.name < b.name ? -1 : 1;
|
|
|
|
return a.name < b.name ? -1 : 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return b.used - a.used;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
data.unshift({
|
|
|
|
allData.unshift({
|
|
|
|
name: Messages.creation_noTemplate,
|
|
|
|
|
|
|
|
id: 0,
|
|
|
|
|
|
|
|
icon: h('span.fa.fa-file')
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
data.push({
|
|
|
|
|
|
|
|
name: Messages.creation_newTemplate,
|
|
|
|
name: Messages.creation_newTemplate,
|
|
|
|
id: -1,
|
|
|
|
id: -1,
|
|
|
|
icon: h('span.fa.fa-bookmark')
|
|
|
|
icon: h('span.fa.fa-bookmark')
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
allData.unshift({
|
|
|
|
|
|
|
|
name: Messages.creation_noTemplate,
|
|
|
|
|
|
|
|
id: 0,
|
|
|
|
|
|
|
|
icon: h('span.fa.fa-file')
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var redraw = function (index) {
|
|
|
|
|
|
|
|
if (index < 0) { i = 0; }
|
|
|
|
|
|
|
|
else if (index > allData.length - 1) { return; }
|
|
|
|
|
|
|
|
else { i = index; }
|
|
|
|
|
|
|
|
var data = allData.slice(i, i + TEMPLATES_DISPLAYED);
|
|
|
|
var $container = $(templates).find('.cp-creation-template-container').html('');
|
|
|
|
var $container = $(templates).find('.cp-creation-template-container').html('');
|
|
|
|
data.forEach(function (obj, idx) {
|
|
|
|
data.forEach(function (obj, idx) {
|
|
|
|
var name = obj.name;
|
|
|
|
var name = obj.name;
|
|
|
@ -1985,7 +1978,7 @@ define([
|
|
|
|
'title': name,
|
|
|
|
'title': name,
|
|
|
|
}).appendTo($container);
|
|
|
|
}).appendTo($container);
|
|
|
|
$span.data('id', obj.id);
|
|
|
|
$span.data('id', obj.id);
|
|
|
|
if (idx === 0) { $span.addClass('cp-creation-template-selected'); }
|
|
|
|
if (idx === selected) { $span.addClass('cp-creation-template-selected'); }
|
|
|
|
$span.append(obj.icon || UI.getFileIcon({type: type}));
|
|
|
|
$span.append(obj.icon || UI.getFileIcon({type: type}));
|
|
|
|
$('<span>', {'class': 'cp-creation-template-element-name'}).text(name)
|
|
|
|
$('<span>', {'class': 'cp-creation-template-element-name'}).text(name)
|
|
|
|
.appendTo($span);
|
|
|
|
.appendTo($span);
|
|
|
@ -2001,28 +1994,51 @@ define([
|
|
|
|
common.addThumbnail(obj.thumbnail, $span, function () {});
|
|
|
|
common.addThumbnail(obj.thumbnail, $span, function () {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(right).off('click').removeClass('hidden').click(function () {
|
|
|
|
|
|
|
|
selected = 0;
|
|
|
|
|
|
|
|
redraw(i + TEMPLATES_DISPLAYED);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (i >= allData.length - TEMPLATES_DISPLAYED ) { $(right).addClass('hidden'); }
|
|
|
|
|
|
|
|
$(left).off('click').removeClass('hidden').click(function () {
|
|
|
|
|
|
|
|
selected = TEMPLATES_DISPLAYED - 1;
|
|
|
|
|
|
|
|
redraw(i - TEMPLATES_DISPLAYED);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (i < TEMPLATES_DISPLAYED) { $(left).addClass('hidden'); }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
redraw(0);
|
|
|
|
|
|
|
|
|
|
|
|
// Change template selection when Tab is pressed
|
|
|
|
// Change template selection when Tab is pressed
|
|
|
|
var next = function (revert) {
|
|
|
|
next = function (revert) {
|
|
|
|
var max = $creation.find('.cp-creation-template-element').length;
|
|
|
|
var max = $creation.find('.cp-creation-template-element').length;
|
|
|
|
|
|
|
|
if (selected + 1 === max && !revert) {
|
|
|
|
|
|
|
|
selected = i + TEMPLATES_DISPLAYED < allData.length ? 0 : max;
|
|
|
|
|
|
|
|
return void redraw(i + TEMPLATES_DISPLAYED);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selected === 0 && revert) {
|
|
|
|
|
|
|
|
selected = i - TEMPLATES_DISPLAYED >= 0 ? TEMPLATES_DISPLAYED - 1 : 0;
|
|
|
|
|
|
|
|
return void redraw(i - TEMPLATES_DISPLAYED);
|
|
|
|
|
|
|
|
}
|
|
|
|
selected = revert ?
|
|
|
|
selected = revert ?
|
|
|
|
(--selected < 0 ? max-1 : selected) :
|
|
|
|
(--selected < 0 ? 0 : selected) :
|
|
|
|
++selected % max;
|
|
|
|
++selected >= max ? max-1 : selected;
|
|
|
|
$creation.find('.cp-creation-template-element')
|
|
|
|
$creation.find('.cp-creation-template-element')
|
|
|
|
.removeClass('cp-creation-template-selected');
|
|
|
|
.removeClass('cp-creation-template-selected');
|
|
|
|
$($creation.find('.cp-creation-template-element').get(selected))
|
|
|
|
$($creation.find('.cp-creation-template-element').get(selected))
|
|
|
|
.addClass('cp-creation-template-selected');
|
|
|
|
.addClass('cp-creation-template-selected');
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Display expiration form when checkbox checked
|
|
|
|
// Display expiration form when checkbox checked
|
|
|
|
$creation.find('#cp-creation-expire').on('change', function () {
|
|
|
|
$creation.find('#cp-creation-expire').on('change', function () {
|
|
|
|
if ($(this).is(':checked')) {
|
|
|
|
if ($(this).is(':checked')) {
|
|
|
|
$creation.find('.cp-creation-expire-picker:not(.active)').addClass('active');
|
|
|
|
$creation.find('.cp-creation-expire-picker:not(.active)').addClass('active');
|
|
|
|
|
|
|
|
$creation.find('.cp-creation-expire:not(.active)').addClass('active');
|
|
|
|
$creation.find('#cp-creation-expire-val').focus();
|
|
|
|
$creation.find('#cp-creation-expire-val').focus();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$creation.find('.cp-creation-expire-picker').removeClass('active');
|
|
|
|
$creation.find('.cp-creation-expire-picker').removeClass('active');
|
|
|
|
|
|
|
|
$creation.find('.cp-creation-expire').removeClass('active');
|
|
|
|
$creation.focus();
|
|
|
|
$creation.focus();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|