public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/js/presets/rspamd.js
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
var rspamd_presetsElem = document.getElementById("rspamd_presets");
3
if (rspamd_presetsElem) {
4
$.ajax({
5
dataType: 'json',
6
url: '/api/v1/get/presets/rspamd',
7
jsonp: false,
8
complete: function (data) {
9
if (data.responseText !== '{}') {
10
var rspamdPresets = JSON.parse(data.responseText);
12
if (rspamdPresets) {
13
rspamd_presetsElem.innerHTML = '';
14
rspamdPresets.forEach(function (item, index) {
15
var elemID = 'rspamd_preset_' + index;
16
rspamd_presetsElem.innerHTML += '<li><a href="#" class="small" id="' + elemID + '">' + lang.rsettings_insert_preset.replace('%s', item.headline) + '</a></li>';
18
/*
19
we need to define 0-timeout here, to prevent dom not be ready.
20
*/
21
setTimeout(function () {
22
document.getElementById(elemID).addEventListener('click', function (e) {
23
e.preventDefault();
24
document.querySelector('form[data-id=rsetting] #adminRspamdSettingsDesc').value = item.headline;
25
document.querySelector('form[data-id=rsetting] #adminRspamdSettingsContent').value = item.content;
26
return true;
27
});
28
}, 0);
29
});
30
}
31
}
32
}
33
});
34
}