Lint JS files using eslint and normalize JS indentation (#9280)

* Lint JS using eslint

* Fix "comma-spacing"

* Fix "semi"

* Fix indent to unified 4 spaces as for PHP

* ignore symlinked public_html/* files
This commit is contained in:
Michael Voříšek
2023-12-23 17:08:32 +01:00
committed by GitHub
parent 3e458fa5fd
commit 740267fac0
22 changed files with 15834 additions and 15563 deletions

262
.eslintrc.js Normal file
View File

@@ -0,0 +1,262 @@
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
'airbnb-base',
'plugin:unicorn/recommended',
],
parserOptions: {
ecmaVersion: '2020',
sourceType: 'module',
},
ignorePatterns: [
'!.*',
'/vendor',
'/public_html',
'/plugins/jqueryui/js',
],
rules: {
'class-methods-use-this': 'off',
'comma-dangle': ['error', {
arrays: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
imports: 'always-multiline',
objects: 'always-multiline',
}],
'consistent-return': 'off',
curly: ['error', 'all'],
'default-case': 'off',
'func-names': 'off',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
indent: ['error', 4, {
SwitchCase: 1,
}],
'linebreak-style': ['error', 'unix'],
'max-len': 'off',
'no-console': 'off',
'no-continue': 'off',
'no-lonely-if': 'off',
'no-multi-spaces': ['error', {
exceptions: {
Property: true,
VariableDeclarator: true,
},
}],
'no-nested-ternary': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-restricted-syntax': 'off',
'no-underscore-dangle': 'off',
'no-unused-vars': 'off',
'object-shorthand': ['error', 'never'],
'padding-line-between-statements': ['error', {
blankLine: 'always',
next: ['continue', 'break', 'export', 'return', 'throw'],
prev: '*',
}],
'prefer-destructuring': 'off',
'prefer-template': 'off',
'spaced-comment': ['error', 'always', {
block: {
balanced: true,
exceptions: ['*'],
markers: ['!'],
},
line: {
exceptions: ['-', '+'],
markers: ['/'],
},
}],
strict: 'off',
'unicorn/catch-error-name': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-lonely-if': 'off',
'unicorn/no-negated-condition': 'off',
'unicorn/no-null': 'off',
'unicorn/no-this-assignment': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-array-find': 'off',
'unicorn/prefer-array-some': 'off', // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2007
'unicorn/prefer-module': 'off',
'unicorn/prevent-abbreviations': 'off',
'wrap-iife': ['error', 'inside'],
// TODO rules to be removed/fixed later as fixes are not compatible with IE11
'guard-for-in': 'off', // refactor to "for of"
'no-restricted-globals': 'off',
'no-restricted-properties': 'off',
'no-var': 'off',
'one-var': 'off',
'prefer-const': 'off',
'prefer-exponentiation-operator': 'off',
'prefer-rest-params': 'off',
'prefer-spread': 'off',
'semi-style': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-for-loop': 'off', // autofixes to "for of"
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-includes': 'off',
'unicorn/prefer-node-protocol': 'off', // needs Node 14+
'unicorn/prefer-number-properties': 'off',
'unicorn/prefer-optional-catch-binding': 'off',
'unicorn/prefer-prototype-methods': 'off',
'unicorn/prefer-reflect-apply': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prefer-top-level-await': 'off', // needs Node 14+
'vars-on-top': 'off',
// TODO
'space-infix-ops': 'off',
'quotes': 'off',
'no-tabs': 'off',
'space-before-function-paren': 'off',
'no-undef': 'off',
'no-shadow': 'off',
'key-spacing': 'off',
'block-spacing': 'off',
'camelcase': 'off',
'object-curly-spacing': 'off',
'unicorn/prevent-abbreviations': 'off', // eslint-disable-line no-dupe-keys
'no-var': 'off', // eslint-disable-line no-dupe-keys
'one-var-declaration-per-line': 'off',
'curly': 'off', // eslint-disable-line no-dupe-keys
'space-in-parens': 'off',
'space-before-blocks': 'off',
'nonblock-statement-body-position': 'off',
'brace-style': 'off',
'eqeqeq': 'off',
'array-bracket-spacing': 'off',
'one-var': 'off', // eslint-disable-line no-dupe-keys
'keyword-spacing': 'off',
'yoda': 'off',
'no-unused-expressions': 'off',
'padding-line-between-statements': 'off', // eslint-disable-line no-dupe-keys
'no-use-before-define': 'off',
'prefer-arrow-callback': 'off',
'no-sequences': 'off',
'vars-on-top': 'off', // eslint-disable-line no-dupe-keys
'unicorn/no-null': 'off', // eslint-disable-line no-dupe-keys
'block-scoped-var': 'off',
'object-curly-newline': 'off',
'no-return-assign': 'off',
'unicorn/explicit-length-check': 'off',
'unicorn/switch-case-braces': 'off',
'no-mixed-operators': 'off',
'no-cond-assign': 'off',
'padded-blocks': 'off',
'switch-colon-spacing': 'off',
'comma-dangle': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-module': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-number-properties': 'off', // eslint-disable-line no-dupe-keys
'strict': 'off', // eslint-disable-line no-dupe-keys
'no-redeclare': 'off',
'no-extra-semi': 'off',
'function-paren-newline': 'off',
'unicorn/no-this-assignment': 'off', // eslint-disable-line no-dupe-keys
'unicorn/no-nested-ternary': 'off',
'unicorn/no-negated-condition': 'off', // eslint-disable-line no-dupe-keys
'computed-property-spacing': 'off',
'no-restricted-globals': 'off', // eslint-disable-line no-dupe-keys
'quote-props': 'off',
'no-multiple-empty-lines': 'off',
'wrap-iife': 'off', // eslint-disable-line no-dupe-keys
'no-multi-assign': 'off',
'no-multi-spaces': 'off', // eslint-disable-line no-dupe-keys
'newline-per-chained-call': 'off',
'unicorn/prefer-query-selector': 'off',
'unicorn/better-regex': 'off',
'unicorn/prefer-string-replace-all': 'off',
'no-void': 'off',
'prefer-rest-params': 'off', // eslint-disable-line no-dupe-keys
'no-bitwise': 'off',
'spaced-comment': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-string-slice': 'off',
'unicorn/catch-error-name': 'off', // eslint-disable-line no-dupe-keys
'no-useless-escape': 'off',
'guard-for-in': 'off', // eslint-disable-line no-dupe-keys
'object-property-newline': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/prefer-regexp-test': 'off',
'unicorn/prefer-optional-catch-binding': 'off', // eslint-disable-line no-dupe-keys
'dot-notation': 'off',
'unicorn/prefer-includes': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-spread': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-reflect-apply': 'off', // eslint-disable-line no-dupe-keys
'unicorn/no-array-callback-reference': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-dom-node-append': 'off',
'unicorn/numeric-separators-style': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-add-event-listener': 'off',
'unicorn/no-lonely-if': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-date-now': 'off',
'unicorn/prefer-code-point': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-logical-operator-over-ternary': 'off',
'no-unneeded-ternary': 'off',
'no-empty': 'off',
'new-cap': 'off',
'function-call-argument-newline': 'off',
'unicorn/filename-case': 'off',
'no-else-return': 'off',
'unicorn/prefer-ternary': 'off',
'new-parens': 'off',
'no-fallthrough': 'off',
'operator-linebreak': 'off',
'space-unary-ops': 'off',
'radix': 'off',
'unicorn/no-array-method-this-argument': 'off',
'no-floating-decimal': 'off',
'array-callback-return': 'off',
'prefer-spread': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-string-starts-ends-with': 'off',
'unicorn/require-array-join-separator': 'off',
'unicorn/prefer-at': 'off',
'unicorn/no-typeof-undefined': 'off',
'unicorn/prefer-dom-node-remove': 'off',
'no-throw-literal': 'off',
'no-loop-func': 'off',
'prefer-exponentiation-operator': 'off', // eslint-disable-line no-dupe-keys
'no-restricted-properties': 'off', // eslint-disable-line no-dupe-keys
'operator-assignment': 'off',
'no-alert': 'off',
'unicorn/escape-case': 'off',
'unicorn/prefer-dom-node-dataset': 'off',
'unicorn/empty-brace-spaces': 'off',
'unicorn/no-for-loop': 'off', // eslint-disable-line no-dupe-keys
'lines-around-directive': 'off',
'unicorn/no-hex-escape': 'off',
'no-script-url': 'off',
'no-extend-native': 'off',
'no-shadow-restricted-names': 'off',
'unicorn/prefer-math-trunc': 'off',
'no-labels': 'off',
'unicorn/prefer-modern-math-apis': 'off',
'no-eval': 'off',
'unicorn/new-for-builtins': 'off',
'unicorn/no-array-for-each': 'off', // eslint-disable-line no-dupe-keys
'unicorn/prefer-modern-dom-apis': 'off',
'no-extra-boolean-cast': 'off',
'no-control-regex': 'off',
'no-label-var': 'off',
'global-require': 'off',
'prefer-regex-literals': 'off',
'no-array-constructor': 'off',
'eol-last': 'off',
'unicorn/no-new-array': 'off',
'no-debugger': 'off',
'no-whitespace-before-property': 'off',
'no-constant-condition': 'off',
'no-implied-eval': 'off',
'unicorn/no-document-cookie': 'off',
'unicorn/prefer-default-parameters': 'off',
'unicorn/prefer-negative-index': 'off',
'no-regex-spaces': 'off',
'unicorn/no-useless-undefined': 'off',
},
reportUnusedDisableDirectives: true,
globals: {
jQuery: true,
},
};

View File

@@ -33,12 +33,17 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Check Coding Style
- name: Check Coding Style - PHP
run: vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --verbose
- name: Check composer.json format
run: composer validate --strict --no-check-lock && composer normalize --dry-run --no-check-lock
- name: Check Coding Style - JS
run: |
npm add -D eslint eslint-plugin-import eslint-config-airbnb-base eslint-plugin-unicorn
npx eslint --ext .js .
phpstan:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"

5
.gitignore vendored
View File

@@ -22,6 +22,11 @@ program/js/jstz.min.js
program/js/publickey.js
program/js/tinymce/
# eslint dependencies
/node_modules
/package.json
/package-lock.json
# skin customization files
skins/elastic/styles/_styles.less
skins/elastic/styles/_variables.less

View File

@@ -5,7 +5,6 @@ $finder = PhpCsFixer\Finder::create()
->exclude(['vendor'])
->ignoreDotFiles(false)
->name('*.php.dist')
->name('*.dist.php')
->name('*.sh');
return (new PhpCsFixer\Config())

View File

@@ -15,34 +15,34 @@
function toggleblock(id, link)
{
var block = document.getElementById(id);
var block = document.getElementById(id);
return false;
return false;
}
function addhostfield()
{
var container = document.getElementById('defaulthostlist');
var row = document.createElement('div');
var input = document.createElement('input');
var link = document.createElement('a');
var container = document.getElementById('defaulthostlist');
var row = document.createElement('div');
var input = document.createElement('input');
var link = document.createElement('a');
input.name = '_imap_host[]';
input.size = '30';
link.href = '#';
link.onclick = function() { removehostfield(this.parentNode); return false };
link.className = 'removelink';
link.innerHTML = 'remove';
input.name = '_imap_host[]';
input.size = '30';
link.href = '#';
link.onclick = function() { removehostfield(this.parentNode); return false; };
link.className = 'removelink';
link.innerHTML = 'remove';
row.appendChild(input);
row.appendChild(link);
container.appendChild(row);
row.appendChild(input);
row.appendChild(link);
container.appendChild(row);
}
function removehostfield(row)
{
var container = document.getElementById('defaulthostlist');
container.removeChild(row);
var container = document.getElementById('defaulthostlist');
container.removeChild(row);
}

View File

@@ -51,7 +51,7 @@ if (window.rcmail) {
rcube_webmail.prototype.acl_create = function()
{
this.acl_init_form();
}
};
// Display ACL edit form
rcube_webmail.prototype.acl_edit = function()
@@ -60,7 +60,7 @@ rcube_webmail.prototype.acl_edit = function()
var id = this.acl_list.get_single_selection();
if (id)
this.acl_init_form(id);
}
};
// ACL entry delete
rcube_webmail.prototype.acl_delete = function()
@@ -76,7 +76,7 @@ rcube_webmail.prototype.acl_delete = function()
}, ref.set_busy(true, 'acl.deleting'));
});
}
}
};
// Save ACL data
rcube_webmail.prototype.acl_save = function()
@@ -107,21 +107,21 @@ rcube_webmail.prototype.acl_save = function()
_user: user,
_acl: rights,
_mbox: this.env.mailbox
}
};
if (this.acl_id) {
data._old = this.acl_id;
}
this.http_post('settings/plugin.acl', data, this.set_busy(true, 'acl.saving'));
}
};
// Cancel/Hide form
rcube_webmail.prototype.acl_cancel = function()
{
this.ksearch_blur();
this.acl_popup.dialog('close');
}
};
// Update data after save (and hide form)
rcube_webmail.prototype.acl_update = function(o)
@@ -139,7 +139,7 @@ rcube_webmail.prototype.acl_update = function(o)
this.ksearch_blur();
// hide form
this.acl_popup.dialog('close');
}
};
// Switch table display mode
rcube_webmail.prototype.acl_mode_switch = function(elem)
@@ -149,8 +149,8 @@ rcube_webmail.prototype.acl_mode_switch = function(elem)
this.http_request('settings/plugin.acl', '_act=list'
+ '&_mode='+(this.env.acl_advanced ? 'advanced' : 'simple')
+ '&_mbox='+urlencode(this.env.mailbox),
this.set_busy(true, 'loading'));
}
this.set_busy(true, 'loading'));
};
// ACL table initialization
rcube_webmail.prototype.acl_list_init = function()
@@ -166,7 +166,7 @@ rcube_webmail.prototype.acl_list_init = function()
.addEventListener('dblclick', function(o) { rcmail.acl_list_dblclick(o); })
.addEventListener('keypress', function(o) { rcmail.acl_list_keypress(o); })
.init();
}
};
// ACL table row selection handler
rcube_webmail.prototype.acl_list_select = function(list)
@@ -174,13 +174,13 @@ rcube_webmail.prototype.acl_list_select = function(list)
rcmail.enable_command('acl-delete', list.get_selection().length > 0);
rcmail.enable_command('acl-edit', list.get_selection().length == 1);
list.focus();
}
};
// ACL table double-click handler
rcube_webmail.prototype.acl_list_dblclick = function(list)
{
this.acl_edit();
}
};
// ACL table keypress handler
rcube_webmail.prototype.acl_list_keypress = function(list)
@@ -190,14 +190,14 @@ rcube_webmail.prototype.acl_list_keypress = function(list)
else if (list.key_pressed == list.DELETE_KEY || list.key_pressed == list.BACKSPACE_KEY)
if (!this.acl_form || !this.acl_form.is(':visible'))
this.command('acl-delete');
}
};
// Reloads ACL table
rcube_webmail.prototype.acl_list_update = function(html)
{
$(this.gui_objects.acltable).html(html);
this.acl_list_init();
}
};
// Returns names of users in selected rows
rcube_webmail.prototype.acl_get_usernames = function()
@@ -216,7 +216,7 @@ rcube_webmail.prototype.acl_get_usernames = function()
}
return users;
}
};
// Removes ACL table row
rcube_webmail.prototype.acl_remove_row = function(id)
@@ -232,7 +232,7 @@ rcube_webmail.prototype.acl_remove_row = function(id)
this.enable_command('acl-delete', list.get_selection().length > 0);
this.enable_command('acl-edit', list.get_selection().length == 1);
}
};
// Adds ACL table row
rcube_webmail.prototype.acl_add_row = function(o, sel)
@@ -295,7 +295,7 @@ rcube_webmail.prototype.acl_add_row = function(o, sel)
if (sel)
list.select_row(o.id);
}
};
// Initializes and shows ACL create/edit form
rcube_webmail.prototype.acl_init_form = function(id)
@@ -377,7 +377,7 @@ rcube_webmail.prototype.acl_init_form = function(id)
name_input.focus();
else
$('input:checked', type_list).focus();
}
};
// Returns class name according to ACL comparison result
rcube_webmail.prototype.acl_class = function(acl1, acl2)
@@ -397,4 +397,4 @@ rcube_webmail.prototype.acl_class = function(acl1, acl2)
return 'partial';
return 'disabled';
}
};

View File

@@ -17,65 +17,65 @@
function rcmail_archive(prop)
{
if (rcmail_is_archive())
return;
if (rcmail_is_archive())
return;
var post_data = rcmail.selection_post_data();
var post_data = rcmail.selection_post_data();
// exit if selection is empty
if (!post_data._uid)
return;
// exit if selection is empty
if (!post_data._uid)
return;
// Disable message command buttons until a message is selected
rcmail.enable_command(rcmail.env.message_commands, false);
rcmail.enable_command('plugin.archive', false);
// Disable message command buttons until a message is selected
rcmail.enable_command(rcmail.env.message_commands, false);
rcmail.enable_command('plugin.archive', false);
// let the server sort the messages to the according subfolders
rcmail.with_selected_messages('move', post_data, null, 'plugin.move2archive');
// let the server sort the messages to the according subfolders
rcmail.with_selected_messages('move', post_data, null, 'plugin.move2archive');
// Reset preview (must be after with_selected_messages() call)
rcmail.show_contentframe(false);
// Reset preview (must be after with_selected_messages() call)
rcmail.show_contentframe(false);
}
function rcmail_is_archive()
{
// check if current folder is an archive folder or one of its children
return rcmail.env.mailbox == rcmail.env.archive_folder
// check if current folder is an archive folder or one of its children
return rcmail.env.mailbox == rcmail.env.archive_folder
|| rcmail.env.mailbox.startsWith(rcmail.env.archive_folder + rcmail.env.delimiter);
}
// callback for app-onload event
if (window.rcmail) {
rcmail.addEventListener('init', function(evt) {
rcmail.addEventListener('init', function(evt) {
// register command (directly enable in message view mode)
rcmail.register_command('plugin.archive', rcmail_archive, rcmail.env.uid && !rcmail_is_archive());
rcmail.register_command('plugin.archive', rcmail_archive, rcmail.env.uid && !rcmail_is_archive());
// add event-listener to message list
if (rcmail.message_list)
rcmail.message_list.addEventListener('select', function(list) {
rcmail.enable_command('plugin.archive', list.get_selection().length > 0 && !rcmail_is_archive());
});
// add event-listener to message list
if (rcmail.message_list)
rcmail.message_list.addEventListener('select', function(list) {
rcmail.enable_command('plugin.archive', list.get_selection().length > 0 && !rcmail_is_archive());
});
// set css style for archive folder
var li;
if (rcmail.env.archive_folder) {
// in Settings > Folders
if (rcmail.subscription_list)
li = rcmail.subscription_list.get_item(rcmail.env.archive_folder);
// in folders list
else
li = rcmail.get_folder_li(rcmail.env.archive_folder, '', true);
// set css style for archive folder
var li;
if (rcmail.env.archive_folder) {
// in Settings > Folders
if (rcmail.subscription_list)
li = rcmail.subscription_list.get_item(rcmail.env.archive_folder);
// in folders list
else
li = rcmail.get_folder_li(rcmail.env.archive_folder, '', true);
if (li)
$(li).addClass('archive');
if (li)
$(li).addClass('archive');
// in folder selector popup
rcmail.addEventListener('menu-open', function(p) {
if (p.name == 'folder-selector') {
var search = rcmail.env.archive_folder;
$('a', p.obj).filter(function() { return $(this).data('id') == search; }).parent().addClass('archive');
// in folder selector popup
rcmail.addEventListener('menu-open', function(p) {
if (p.name == 'folder-selector') {
var search = rcmail.env.archive_folder;
$('a', p.obj).filter(function() { return $(this).data('id') == search; }).parent().addClass('archive');
}
});
}
});
}
});
});
}

View File

@@ -17,71 +17,71 @@
function rcmail_get_compose_message()
{
var msg = rcmail.editor.get_content({ nosig: true });
var msg = rcmail.editor.get_content({ nosig: true });
if (rcmail.editor.is_html()) {
if (rcmail.editor.is_html()) {
// Remove quoted content, all HTML tags, and some entities
msg = msg.replace(/<blockquote[^>]*>(.|[\r\n])*<\/blockquote>/gmi, '')
.replace(/<[^>]+>/gm, ' ')
.replace(/&nbsp;/g, ' ');
}
else {
msg = msg.replace(/<blockquote[^>]*>(.|[\r\n])*<\/blockquote>/gmi, '')
.replace(/<[^>]+>/gm, ' ')
.replace(/&nbsp;/g, ' ');
}
else {
// Remove quoted content
msg = msg.replace(/^>.*$/gmi, '');
}
msg = msg.replace(/^>.*$/gmi, '');
}
return msg;
return msg;
};
function rcmail_check_message(msg)
{
var i, rx, keywords = rcmail.get_label('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]);
var i, rx, keywords = rcmail.get_label('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]);
keywords = $.map(keywords, function(n) { return RegExp.escape(n); });
rx = new RegExp('(' + keywords.join('|') + ')', 'i');
keywords = $.map(keywords, function(n) { return RegExp.escape(n); });
rx = new RegExp('(' + keywords.join('|') + ')', 'i');
return msg.search(rx) != -1;
return msg.search(rx) != -1;
};
function rcmail_have_attachments()
{
return rcmail.env.attachments && $('li', rcmail.gui_objects.attachmentlist).length;
return rcmail.env.attachments && $('li', rcmail.gui_objects.attachmentlist).length;
};
function rcmail_attachment_reminder_dialog()
{
var buttons = {};
var buttons = {};
buttons[rcmail.get_label('addattachment')] = function() {
$(this).remove();
$('#messagetoolbar a.attach, .toolbar a.attach').first().click();
};
buttons[rcmail.get_label('send')] = function(e) {
$(this).remove();
rcmail.env.attachment_reminder = true;
rcmail.command('send', '', e);
};
buttons[rcmail.get_label('addattachment')] = function() {
$(this).remove();
$('#messagetoolbar a.attach, .toolbar a.attach').first().click();
};
buttons[rcmail.get_label('send')] = function(e) {
$(this).remove();
rcmail.env.attachment_reminder = true;
rcmail.command('send', '', e);
};
rcmail.env.attachment_reminder = false;
rcmail.show_popup_dialog(
rcmail.get_label('attachment_reminder.forgotattachment'),
rcmail.get_label('attachment_reminder.missingattachment'),
buttons,
{button_classes: ['mainaction attach', 'send']}
);
rcmail.env.attachment_reminder = false;
rcmail.show_popup_dialog(
rcmail.get_label('attachment_reminder.forgotattachment'),
rcmail.get_label('attachment_reminder.missingattachment'),
buttons,
{button_classes: ['mainaction attach', 'send']}
);
};
if (window.rcmail) {
rcmail.addEventListener('beforesend', function(evt) {
var msg = rcmail_get_compose_message(),
subject = $('#compose-subject').val();
rcmail.addEventListener('beforesend', function(evt) {
var msg = rcmail_get_compose_message(),
subject = $('#compose-subject').val();
if (!rcmail.env.attachment_reminder && !rcmail_have_attachments()
if (!rcmail.env.attachment_reminder && !rcmail_have_attachments()
&& (rcmail_check_message(msg) || rcmail_check_message(subject))
) {
rcmail_attachment_reminder_dialog();
return false;
}
});
) {
rcmail_attachment_reminder_dialog();
return false;
}
});
}

View File

@@ -198,10 +198,10 @@ rcube_webmail.prototype.enigma_key_create_save = function()
openpgp.generateKey(options).then(function(keypair) {
// success
var post = {
_a: 'import',
_keys: keypair.privateKey,
_generated: 1,
_passwd: password
_a: 'import',
_keys: keypair.privateKey,
_generated: 1,
_passwd: password
};
// send request to server
@@ -306,7 +306,7 @@ rcube_webmail.prototype.enigma_export_submit = function(data)
var id = 'keyexport-' + new Date().getTime(),
form = $('<form>').attr({target: id, method: 'post', style: 'display:none',
action: '?_action=plugin.enigmakeys&_task=settings&_a=export'}),
iframe = $('<iframe>').attr({name: id, style: 'display:none'})
iframe = $('<iframe>').attr({name: id, style: 'display:none'});
form.append($('<input>').attr({name: '_token', value: this.env.request_token}));
$.each(data, function(i, v) {
@@ -392,9 +392,9 @@ rcube_webmail.prototype.enigma_search = function(props)
if (props || this.env.search_request) {
var params = {'_a': 'search', '_q': props},
lock = this.set_busy(true, 'searching');
// if (this.gui_objects.search_filter)
// addurl += '&_filter=' + this.gui_objects.search_filter.value;
lock = this.set_busy(true, 'searching');
// if (this.gui_objects.search_filter)
// addurl += '&_filter=' + this.gui_objects.search_filter.value;
this.env.current_page = 1;
this.enigma_loadframe();
this.enigma_clear_list();
@@ -428,7 +428,7 @@ rcube_webmail.prototype.enigma_list = function(page, reset_frame)
return parent.rcmail.enigma_list(page, reset_frame);
var params = {'_a': 'list'},
lock = this.set_busy(true, 'loading');
lock = this.set_busy(true, 'loading');
this.env.current_page = page ? page : 1;
@@ -611,7 +611,7 @@ rcube_webmail.prototype.enigma_password_submit = function(data)
else if (this.env.action == 'plugin.enigmakeys' && (form = this.gui_objects.importform)) {
if (!$('input[name="_keyid"]', form).length) {
$(form).append($('<input>').attr({type: 'hidden', name: '_keyid', value: data.key}))
.append($('<input>').attr({type: 'hidden', name: '_passwd', value: data.password}))
.append($('<input>').attr({type: 'hidden', name: '_passwd', value: data.password}));
}
return this.enigma_import();
@@ -628,7 +628,7 @@ rcube_webmail.prototype.enigma_password_submit = function(data)
// Additional form fields for request parameters
$.each(data, function(i, v) {
if (i.indexOf('input') == 0)
form.append($('<input>').attr({type: 'hidden', name: i.substring(5), value: v}))
form.append($('<input>').attr({type: 'hidden', name: i.substring(5), value: v}));
});
if (data.iframe) {

View File

@@ -16,54 +16,54 @@
*/
if (window.rcmail)
rcmail.addEventListener('init', function() { hide_blockquote(); });
rcmail.addEventListener('init', function() { hide_blockquote(); });
function hide_blockquote()
{
var limit = rcmail.env.blockquote_limit;
var limit = rcmail.env.blockquote_limit;
if (limit <= 0)
return;
$('div.message-part div.pre > blockquote', $('#messagebody')).each(function() {
var res, text, div, link, q = $(this);
// Add new-line character before each blockquote
// This fixes counting lines of text, it also prevents
// from merging lines from different quoting level
$('blockquote').before(document.createTextNode("\n"));
text = q.text().trim();
res = text.split(/\n/);
if (res.length <= limit) {
// there can be also a block with very long wrapped line
// assume line height = 15px
if (q.height() <= limit * 15)
if (limit <= 0)
return;
}
div = $('<blockquote class="blockquote-header">')
.css({'white-space': 'nowrap', overflow: 'hidden', position: 'relative'})
.text(res[0]);
$('div.message-part div.pre > blockquote', $('#messagebody')).each(function() {
var res, text, div, link, q = $(this);
link = $('<span class="blockquote-link"></span>')
.css({position: 'absolute', 'z-Index': 2})
.text(rcmail.get_label('hide_blockquote.show'))
.data('parent', div)
.click(function() {
var t = $(this), parent = t.data('parent'), visible = parent.is(':visible');
// Add new-line character before each blockquote
// This fixes counting lines of text, it also prevents
// from merging lines from different quoting level
$('blockquote').before(document.createTextNode("\n"));
t.text(rcmail.get_label(visible ? 'hide' : 'show', 'hide_blockquote'))
.detach().appendTo(visible ? q : parent).toggleClass('collapsed');
text = q.text().trim();
res = text.split(/\n/);
parent[visible ? 'hide' : 'show']();
q[visible ? 'show' : 'hide']();
});
if (res.length <= limit) {
// there can be also a block with very long wrapped line
// assume line height = 15px
if (q.height() <= limit * 15)
return;
}
link.appendTo(div);
div = $('<blockquote class="blockquote-header">')
.css({'white-space': 'nowrap', overflow: 'hidden', position: 'relative'})
.text(res[0]);
// Modify blockquote
q.hide().css({position: 'relative'}).before(div);
});
link = $('<span class="blockquote-link"></span>')
.css({position: 'absolute', 'z-Index': 2})
.text(rcmail.get_label('hide_blockquote.show'))
.data('parent', div)
.click(function() {
var t = $(this), parent = t.data('parent'), visible = parent.is(':visible');
t.text(rcmail.get_label(visible ? 'hide' : 'show', 'hide_blockquote'))
.detach().appendTo(visible ? q : parent).toggleClass('collapsed');
parent[visible ? 'hide' : 'show']();
q[visible ? 'show' : 'hide']();
});
link.appendTo(div);
// Modify blockquote
q.hide().css({position: 'relative'}).before(div);
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ rcube_webmail.prototype.markasjunk_mark = function(is_spam) {
var lock = this.set_busy(true, 'loading');
this.http_post('plugin.markasjunk.' + (is_spam ? 'junk' : 'not_junk'), this.selection_post_data({_uid: uids}), lock);
}
};
rcube_webmail.prototype.markasjunk_move = function(mbox, uids) {
var prev_uid = this.env.uid;
@@ -39,7 +39,7 @@ rcube_webmail.prototype.markasjunk_move = function(mbox, uids) {
this.delete_messages();
this.env.uid = prev_uid;
}
};
rcube_webmail.prototype.markasjunk_toggle_button = function() {
var spamobj = $('a.junk'),
@@ -86,11 +86,11 @@ rcube_webmail.prototype.markasjunk_toggle_button = function() {
cur_hamobj.insertAfter(cur_spamobj);
}
});
}
};
rcube_webmail.prototype.markasjunk_is_spam_mbox = function() {
return !this.is_multifolder_listing() && this.env.mailbox == this.env.markasjunk_spam_mailbox;
}
};
if (window.rcmail) {
rcmail.addEventListener('init', function() {

View File

@@ -29,33 +29,33 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
input_newpasswd = rcube_find_object('_newpasswd'),
input_confpasswd = rcube_find_object('_confpasswd');
if (input_curpasswd && input_curpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nocurpassword', 'password'), function() {
input_curpasswd.focus();
return true;
if (input_curpasswd && input_curpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nocurpassword', 'password'), function() {
input_curpasswd.focus();
return true;
});
}
else if (input_newpasswd && input_newpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_newpasswd.focus();
return true;
}
else if (input_newpasswd && input_newpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_newpasswd.focus();
return true;
});
}
else if (input_confpasswd && input_confpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_confpasswd.focus();
return true;
}
else if (input_confpasswd && input_confpasswd.value == '') {
rcmail.alert_dialog(rcmail.get_label('nopassword', 'password'), function() {
input_confpasswd.focus();
return true;
});
}
else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) {
rcmail.alert_dialog(rcmail.get_label('passwordinconsistency', 'password'), function() {
input_newpasswd.focus();
return true;
}
else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) {
rcmail.alert_dialog(rcmail.get_label('passwordinconsistency', 'password'), function() {
input_newpasswd.focus();
return true;
});
}
else {
rcmail.gui_objects.passform.submit();
}
}
else {
rcmail.gui_objects.passform.submit();
}
}, true);
$('input:not(:hidden)').first().focus();

View File

@@ -17,125 +17,125 @@
function plugin_vcard_import(mime_id)
{
if (!mime_id) {
var content = [];
if (!mime_id) {
var content = [];
$.each(rcmail.env.vcards, function (id, contact) {
var chbox = $('<input>').attr({type: 'checkbox', value: id, checked: true, 'class': 'pretty-checkbox'}),
label = $('<label>').text(' ' + contact);
$.each(rcmail.env.vcards, function (id, contact) {
var chbox = $('<input>').attr({type: 'checkbox', value: id, checked: true, 'class': 'pretty-checkbox'}),
label = $('<label>').text(' ' + contact);
content.push($('<div>').append(label.prepend(chbox)));
});
var dialog,
action = function(e, a) {
var contacts = []
dialog.find('input:checked').each(function() {
contacts.push(this.value);
content.push($('<div>').append(label.prepend(chbox)));
});
if (contacts.length) {
plugin_vcard_import(contacts.join());
return true; // close the dialog
}
},
props = {
button: 'import',
height: content.length > 4 ? 250 : 100
};
var dialog,
action = function(e, a) {
var contacts = [];
dialog = rcmail.simple_dialog(content, 'vcard_attachments.addvcardmsg', action, props);
dialog.find('input:checked').each(function() {
contacts.push(this.value);
});
if (contacts.length) {
plugin_vcard_import(contacts.join());
return true; // close the dialog
}
},
props = {
button: 'import',
height: content.length > 4 ? 250 : 100
};
dialog = rcmail.simple_dialog(content, 'vcard_attachments.addvcardmsg', action, props);
return false;
}
rcmail.http_post(
'plugin.savevcard',
{ _uid: rcmail.env.uid, _mbox: rcmail.env.mailbox, _part: mime_id },
rcmail.set_busy(true, 'loading')
);
return false;
}
rcmail.http_post(
'plugin.savevcard',
{ _uid: rcmail.env.uid, _mbox: rcmail.env.mailbox, _part: mime_id },
rcmail.set_busy(true, 'loading')
);
return false;
}
function plugin_vcard_insertrow(data)
{
if (data.row.ctype.match(/^(text\/vcard|text\/x-vcard|text\/directory)$/i)) {
$(data.row.obj).find('.attachment > .attachment').addClass('vcard');
}
if (data.row.ctype.match(/^(text\/vcard|text\/x-vcard|text\/directory)$/i)) {
$(data.row.obj).find('.attachment > .attachment').addClass('vcard');
}
}
function plugin_vcard_attach()
{
var id, n, contacts = [],
ts = new Date().getTime(),
args = {_uploadid: ts, _id: rcmail.env.compose_id || null},
selection = rcmail.contact_list.get_selection();
var id, n, contacts = [],
ts = new Date().getTime(),
args = {_uploadid: ts, _id: rcmail.env.compose_id || null},
selection = rcmail.contact_list.get_selection();
for (n=0; n < selection.length; n++) {
if (rcmail.env.task == 'addressbook') {
id = selection[n];
contacts.push(rcmail.env.source + '-' + id + '-0');
}
else {
id = selection[n];
if (id && id.charAt(0) != 'E' && rcmail.env.contactdata[id])
contacts.push(id);
}
}
if (!contacts.length)
return false;
args._uri = 'vcard://' + contacts.join(',');
for (n=0; n < selection.length; n++) {
if (rcmail.env.task == 'addressbook') {
id = selection[n];
contacts.push(rcmail.env.source + '-' + id + '-0');
args._attach_vcard = 1;
rcmail.open_compose_step(args);
}
else {
id = selection[n];
if (id && id.charAt(0) != 'E' && rcmail.env.contactdata[id])
contacts.push(id);
}
}
if (!contacts.length)
return false;
args._uri = 'vcard://' + contacts.join(',');
if (rcmail.env.task == 'addressbook') {
args._attach_vcard = 1;
rcmail.open_compose_step(args);
}
else {
// add to attachments list
if (!rcmail.add2attachment_list(ts, {name: '', html: rcmail.get_label('attaching'), classname: 'uploading', complete: false}))
rcmail.file_upload_id = rcmail.set_busy(true, 'attaching');
if (!rcmail.add2attachment_list(ts, {name: '', html: rcmail.get_label('attaching'), classname: 'uploading', complete: false}))
rcmail.file_upload_id = rcmail.set_busy(true, 'attaching');
rcmail.http_post('upload', args);
}
rcmail.http_post('upload', args);
}
}
window.rcmail && rcmail.addEventListener('init', function(evt) {
if (rcmail.gui_objects.messagelist)
rcmail.addEventListener('insertrow', function(data, evt) { plugin_vcard_insertrow(data); });
if (rcmail.gui_objects.messagelist)
rcmail.addEventListener('insertrow', function(data, evt) { plugin_vcard_insertrow(data); });
if ((rcmail.env.action == 'compose' || (rcmail.env.task == 'addressbook' && rcmail.env.action == '')) && rcmail.gui_objects.contactslist) {
if (rcmail.env.action == 'compose') {
rcmail.env.compose_commands.push('attach-vcard');
if ((rcmail.env.action == 'compose' || (rcmail.env.task == 'addressbook' && rcmail.env.action == '')) && rcmail.gui_objects.contactslist) {
if (rcmail.env.action == 'compose') {
rcmail.env.compose_commands.push('attach-vcard');
// Elastic: add "Attach vCard" button to the attachments widget
if (window.UI && UI.recipient_selector) {
var button, form = $('#compose-attachments > div');
button = $('<button class="btn btn-secondary attach vcard">')
.attr({type: 'button', tabindex: $('button,input', form).first().attr('tabindex') || 0})
.text(rcmail.gettext('vcard_attachments.attachvcard'))
.appendTo(form)
.click(function() {
UI.recipient_selector('', {
title: 'vcard_attachments.attachvcard',
button: 'vcard_attachments.attachvcard',
button_class: 'attach',
focus: button,
multiselect: false,
action: function() { rcmail.command('attach-vcard'); }
});
});
}
// Elastic: add "Attach vCard" button to the attachments widget
if (window.UI && UI.recipient_selector) {
var button, form = $('#compose-attachments > div');
button = $('<button class="btn btn-secondary attach vcard">')
.attr({type: 'button', tabindex: $('button,input', form).first().attr('tabindex') || 0})
.text(rcmail.gettext('vcard_attachments.attachvcard'))
.appendTo(form)
.click(function() {
UI.recipient_selector('', {
title: 'vcard_attachments.attachvcard',
button: 'vcard_attachments.attachvcard',
button_class: 'attach',
focus: button,
multiselect: false,
action: function() { rcmail.command('attach-vcard'); }
});
});
}
}
rcmail.register_command('attach-vcard', function() { plugin_vcard_attach(); });
rcmail.contact_list.addEventListener('select', function(list) {
// TODO: support attaching more than one at once
var selection = list.get_selection();
rcmail.enable_command('attach-vcard', selection.length == 1 && selection[0].charAt(0) != 'E');
});
}
rcmail.register_command('attach-vcard', function() { plugin_vcard_attach(); });
rcmail.contact_list.addEventListener('select', function(list) {
// TODO: support attaching more than one at once
var selection = list.get_selection();
rcmail.enable_command('attach-vcard', selection.length == 1 && selection[0].charAt(0) != 'E');
});
}
});

View File

@@ -65,19 +65,19 @@ function rcmail_zipdownload(mode)
id = 'zipdownload-' + new Date().getTime(),
iframe = $('<iframe>').attr({name: id, style: 'display:none'}),
form = $('<form>').attr({
target: id,
style: 'display: none',
method: 'post',
action: rcmail.url('mail/plugin.zipdownload.messages')
});
target: id,
style: 'display: none',
method: 'post',
action: rcmail.url('mail/plugin.zipdownload.messages')
});
post._mode = mode;
post._token = rcmail.env.request_token;
$.each(post, function(k, v) {
if (typeof v == 'object' && v.length > 1) {
for (var j=0; j < v.length; j++)
inputs.push($('<input>').attr({type: 'hidden', name: k+'[]', value: v[j]}));
for (var j=0; j < v.length; j++)
inputs.push($('<input>').attr({type: 'hidden', name: k+'[]', value: v[j]}));
}
else {
inputs.push($('<input>').attr({type: 'hidden', name: k, value: v}));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -297,9 +297,9 @@ function rcube_elastic_ui()
parent = $(this).parent('li'),
re = /(large|big|small|phone|lbs)/g;
while (m = re.exec(v)) {
$(parent.length ? parent : this).addClass('hidden-' + m[1]);
}
while (m = re.exec(v)) {
$(parent.length ? parent : this).addClass('hidden-' + m[1]);
}
});
// Modify normal checkboxes on lists so they are different
@@ -332,8 +332,8 @@ function rcube_elastic_ui()
// Set .notree class on treelist widget update
$('.treelist').each(function() {
var list = this, callback = function() {
$(list)[$('.treetoggle', list).length > 0 ? 'removeClass' : 'addClass']('notree');
};
$(list)[$('.treetoggle', list).length > 0 ? 'removeClass' : 'addClass']('notree');
};
if (window.MutationObserver) {
(new MutationObserver(callback)).observe(list, {childList: true, subtree: true});
@@ -390,7 +390,7 @@ function rcube_elastic_ui()
btn_class = target[0].className + (add_class ? ' ' + add_class : '');
if (!menu_button) {
btn_class = btn_class.replace('btn-primary', 'primary').replace(/(btn[a-z-]*|button|disabled)/g, '').trim()
btn_class = btn_class.replace('btn-primary', 'primary').replace(/(btn[a-z-]*|button|disabled)/g, '').trim();
btn_class += ' button' + (!always_active ? ' disabled' : '');
}
else if (popup = target.data('popup')) {
@@ -666,13 +666,13 @@ function rcube_elastic_ui()
};
rcmail.addEventListener('fileappended', function(e) {
if (e.attachment.complete) {
attachmentmenu_append(e.item);
if (e.attachment.mimetype == 'text/vcard' && rcmail.commands['attach-vcard']) {
phone_confirmation('vcard_attachments.vcardattached');
}
if (e.attachment.complete) {
attachmentmenu_append(e.item);
if (e.attachment.mimetype == 'text/vcard' && rcmail.commands['attach-vcard']) {
phone_confirmation('vcard_attachments.vcardattached');
}
})
}
})
.addEventListener('managesieve.insertrow', function(o) { bootstrap_style(o.obj); })
.addEventListener('add-recipient', function() { phone_confirmation('recipientsadded'); });
@@ -1065,17 +1065,17 @@ function rcube_elastic_ui()
$(this).addClass('custom-file-input').wrap('<div class="custom-file">');
$(this).on('change', function() {
var text = label_text;
if (this.files.length) {
text = this.files[0].name;
if (this.files.length > 1) {
text += ', ...';
}
var text = label_text;
if (this.files.length) {
text = this.files[0].name;
if (this.files.length > 1) {
text += ', ...';
}
}
// Note: We don't use label variable to allow cloning of the input
$(this).next().text(text);
})
// Note: We don't use label variable to allow cloning of the input
$(this).next().text(text);
})
.parent().append(label);
});
@@ -1396,7 +1396,7 @@ function rcube_elastic_ui()
$('#compose-subject').focus();
floating = false;
}
toolbar.css({position: 'relative', top: 0, width: 'auto'})
toolbar.css({position: 'relative', top: 0, width: 'auto'});
}
});
@@ -1590,22 +1590,22 @@ function rcube_elastic_ui()
if (rcmail.task == 'mail') {
switch (args.command) {
case 'reply-list':
if (rcmail.env.reply_all_mode == 1) {
var label = rcmail.gettext(args.status ? 'replylist' : 'replyall');
$('.toolbar a.reply-all').attr('title', label).find('.inner').text(label);
}
break;
case 'reply-list':
if (rcmail.env.reply_all_mode == 1) {
var label = rcmail.gettext(args.status ? 'replylist' : 'replyall');
$('.toolbar a.reply-all').attr('title', label).find('.inner').text(label);
}
break;
case 'compose-encrypted':
case 'compose-encrypted':
// show the toolbar button for Mailvelope
$('.toolbar a.encrypt').parent().show();
break;
$('.toolbar a.encrypt').parent().show();
break;
case 'compose-encrypted-signed':
case 'compose-encrypted-signed':
// enable selector for encrypt and sign
$('#encryption-menu-button').show();
break;
$('#encryption-menu-button').show();
break;
}
}
};
@@ -1663,7 +1663,7 @@ function rcube_elastic_ui()
// Hide content frame buttons on small devices (with frame toolbar in parent window)
$.each(content_buttons, function() { $(this)[mobile ? 'hide' : 'show'](); });
rcmail.triggerEvent('skin-resize', { mode: mode })
rcmail.triggerEvent('skin-resize', { mode: mode });
};
function screen_resize()
@@ -2306,10 +2306,10 @@ function rcube_elastic_ui()
};
$(item).attr({
'aria-haspopup': 'true',
'aria-expanded': 'false',
'aria-owns': popup_id,
})
'aria-haspopup': 'true',
'aria-expanded': 'false',
'aria-owns': popup_id,
})
.popover({
content: content_element,
trigger: $(item).data('popup-trigger') || 'click',
@@ -2338,9 +2338,9 @@ function rcube_elastic_ui()
// Stop propagation on menu items that have popups
// to make a click on them not hide their parent menu(s)
.find('[aria-haspopup="true"]')
.data('level', level + 1)
.off('click.popup')
.on('click.popup', function(e) { e.stopPropagation(); });
.data('level', level + 1)
.off('click.popup')
.on('click.popup', function(e) { e.stopPropagation(); });
if (!is_mobile()) {
// Set popup height so it is less than the window height
@@ -2465,16 +2465,16 @@ function rcube_elastic_ui()
.on('keydown', function(e) {
if (e.originalEvent) {
switch (e.originalEvent.which) {
case 13:
case 32:
case 13:
case 32:
// Open the popup on ENTER or SPACE
e.preventDefault();
$(this).data('event', 'key').popover('toggle');
break;
case 27:
e.preventDefault();
$(this).data('event', 'key').popover('toggle');
break;
case 27:
// Close the popup on ESC key
$(this).popover('hide');
break;
$(this).popover('hide');
break;
}
}
});
@@ -2558,13 +2558,13 @@ function rcube_elastic_ui()
// create a fake element to position drag menu on the cursor position
pos = rcube_event.get_mouse_pos(p.originalEvent);
target = $('<a>').css({
position: 'absolute',
left: pos.x,
top: pos.y,
height: '1px',
width: '1px',
visibility: 'hidden'
})
position: 'absolute',
left: pos.x,
top: pos.y,
height: '1px',
width: '1px',
visibility: 'hidden'
})
.appendTo(document.body).get(0);
}
@@ -2613,7 +2613,7 @@ function rcube_elastic_ui()
// setTimeout fixes Shift + drag'n'drop menu in Chrome (#8107)
setTimeout(function() { $(target).popover('show'); }, 1);
}
};
fn();
}
@@ -2839,7 +2839,7 @@ function rcube_elastic_ui()
}
$(obj).find('.proplist > li > a.dropdown').on('click', function() {
var list = $(this).next()
var list = $(this).next();
list[list.is('.d-none') ? 'removeClass' : 'addClass']('d-none');
});
}
@@ -3044,11 +3044,11 @@ function rcube_elastic_ui()
fname = item.find('a.filename');
var button = $('<a>').attr({
href: '#',
tabindex: fname.attr('tabindex') || 0,
title: label,
'class': 'button icon dropdown skip-content'
})
href: '#',
tabindex: fname.attr('tabindex') || 0,
title: label,
'class': 'button icon dropdown skip-content'
})
.on('click', function(e) {
return attachmentmenu($('#attachmentmenu'), button, e);
})
@@ -3277,7 +3277,7 @@ function rcube_elastic_ui()
button_class: opts.button_class || 'insert recipient',
height: 600,
classes: {
'ui-dialog-content': 'p-0' // remove padding on dialog content
'ui-dialog-content': 'p-0' // remove padding on dialog content
},
open: function() {
// Don't want focus in the search field, we focus first contacts source record instead
@@ -3353,7 +3353,7 @@ function rcube_elastic_ui()
email_element.text((name ? email : '') + ',');
recipient.attr('title', name ? (name + email) : null)
.append([name_element, email_element, link])
.append([name_element, email_element, link]);
if (replace)
replace.replaceWith(recipient);
@@ -3584,21 +3584,21 @@ function rcube_elastic_ui()
content = $('<label>').text(rcmail.gettext('recipient')).append(input);
rcmail.simple_dialog(content, 'recipientedit', function() {
var result, value = input.val();
if (value) {
if (value != recipient) {
result = recipient_input_parser(value);
var result, value = input.val();
if (value) {
if (value != recipient) {
result = recipient_input_parser(value);
if (result.recipients.length != 1) {
return false;
}
callback(result.recipients[0].name, result.recipients[0].email, element);
if (result.recipients.length != 1) {
return false;
}
return true;
callback(result.recipients[0].name, result.recipients[0].email, element);
}
});
return true;
}
});
};
/**
@@ -3637,9 +3637,9 @@ function rcube_elastic_ui()
// custom 'loaded' event is expected to be triggered by plugins
// when using the loader not on an iframe
frame.on('load error loaded', function() {
// wait some time to make sure the iframe stopped loading
setTimeout(function() { loader.remove(); }, 500);
})
// wait some time to make sure the iframe stopped loading
setTimeout(function() { loader.remove(); }, 500);
})
.parent().append(loader);
// fix scrolling in iOS
@@ -3916,7 +3916,7 @@ function rcube_elastic_ui()
return false;
}
})
});
};
/**
@@ -4081,12 +4081,12 @@ function rcube_elastic_ui()
+ '</div>');
input = elem.find('input').attr({
value: value,
name: field.name + '[]',
size: $(field).data('size'),
title: field.title,
placeholder: field.placeholder
})
value: value,
name: field.name + '[]',
size: $(field).data('size'),
title: field.title,
placeholder: field.placeholder
})
.keydown(function(e) {
// element creation event (on Enter)
if (e.which == 13) {
@@ -4280,7 +4280,7 @@ function rcube_elastic_ui()
$(body).css({
color: $(document.body).css('color'),
backgroundColor: $(document.body).css('background-color')
})
});
};
var setColor = color_mode == 'dark' && /_task=mail/.test(url) && /_action=viewsource/.test(url);
@@ -4423,7 +4423,7 @@ if (window.rcmail) {
// just delegate the action to rcube_elastic_ui
return rcmail.triggerEvent(show === false ? 'menu-close' : 'menu-open', {name: name, obj: obj, props: prop, originalEvent: event});
}
};
/**
* Elastic version of hide_menu as we don't need e.g. menus stack handling
@@ -4432,7 +4432,7 @@ if (window.rcmail) {
{
// delegate to rcube_elastic_ui
return rcmail.triggerEvent('menu-close', {name: name, props: {menu: name}, originalEvent: event});
}
};
}
else {
// rcmail does not exists e.g. on the error template inside a frame