1
window.contentSubmit = false;
2
$(document).ready(function () {
3
if(localStorage.getItem('addStoryName') !== null) {
4
$('#as_form_pseudonym').val(localStorage.getItem('addStoryName'));
5
}
6
if(localStorage.getItem('addStoryEmail') !== null) {
7
$('#as_form_email').val(localStorage.getItem('addStoryEmail'));
8
}
9
if(localStorage.getItem('addStoryEmailVisible') !== null) {
10
if(localStorage.getItem('addStoryEmailVisible') == 'true') {
11
$('input[name="as_form_showemail"][value="show"]').prop('checked', true);
12
}
13
if(localStorage.getItem('addStoryEmailVisible') == 'false') {
14
$('input[name="as_form_showemail"][value="hide"]').prop('checked', true);
15
}
16
}
17
$('#as_form_tags').select2({
18
ajax: {
19
url: '/api/filter?model=genres',
20
dataType: 'json',
21
processResults: function (data) {
22
let vals = [];
23
for(var i = 0; i < data.items.length; i++) {
24
vals.push({
25
id: data.items[i].code,
26
text: data.items[i].label
27
});
28
}
29
return {
30
results: vals
31
};
32
}
33
},
34
tags: true,
35
tokenSeparators: [',', '.', ':', ';'],
36
width: '100%',
37
createTag: function(params) {
38
let term = params.term.replace(/[^АаБбВвГгДдЕеЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯяAaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789 -]/gi, '');
39
return {
40
id: params.term,
...
</html>