diff options
author | dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> | 2019-11-13 12:05:10 +0000 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-12-19 11:55:33 +0100 |
commit | ec01e0a790448fff38364f629a4de4edb5d465bf (patch) | |
tree | 8fb5369e3d6f9f805025802e12feaa4dfaef1e03 /core/src | |
parent | 5d9fd7ba0cced84f1d07627b0860ac5490de164d (diff) | |
download | nextcloud-server-ec01e0a790448fff38364f629a4de4edb5d465bf.tar.gz nextcloud-server-ec01e0a790448fff38364f629a4de4edb5d465bf.zip |
Bump eslint-config-nextcloud from 0.0.6 to 0.1.0
Bumps [eslint-config-nextcloud](https://github.com/nextcloud/eslint-config-nextcloud) from 0.0.6 to 0.1.0.
- [Release notes](https://github.com/nextcloud/eslint-config-nextcloud/releases)
- [Commits](https://github.com/nextcloud/eslint-config-nextcloud/compare/v0.0.6...v0.1.0)
Co-authored-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src')
46 files changed, 267 insertions, 266 deletions
diff --git a/core/src/OC/apps.js b/core/src/OC/apps.js index f94059a4212..f55a5d03dcc 100644 --- a/core/src/OC/apps.js +++ b/core/src/OC/apps.js @@ -10,12 +10,12 @@ import $ from 'jquery' -var dynamicSlideToggleEnabled = false +let dynamicSlideToggleEnabled = false const Apps = { enableDynamicSlideToggle: function() { dynamicSlideToggleEnabled = true - } + }, } /** @@ -24,7 +24,7 @@ const Apps = { * @param {Object} [$el] sidebar element to show, defaults to $('#app-sidebar') */ Apps.showAppSidebar = function($el) { - var $appSidebar = $el || $('#app-sidebar') + const $appSidebar = $el || $('#app-sidebar') $appSidebar.removeClass('disappear').show() $('#app-content').trigger(new $.Event('appresized')) } @@ -36,7 +36,7 @@ Apps.showAppSidebar = function($el) { * @param {Object} [$el] sidebar element to hide, defaults to $('#app-sidebar') */ Apps.hideAppSidebar = function($el) { - var $appSidebar = $el || $('#app-sidebar') + const $appSidebar = $el || $('#app-sidebar') $appSidebar.hide().addClass('disappear') $('#app-content').trigger(new $.Event('appresized')) } @@ -51,7 +51,7 @@ Apps.hideAppSidebar = function($el) { * <div class=".slide-area" class="hidden">I'm sliding up</div> */ export const registerAppsSlideToggle = () => { - var buttons = $('[data-apps-slide-toggle]') + let buttons = $('[data-apps-slide-toggle]') if (buttons.length === 0) { $('#app-navigation').addClass('without-app-settings') @@ -65,8 +65,8 @@ export const registerAppsSlideToggle = () => { buttons.each(function(index, button) { - var areaSelector = $(button).data('apps-slide-toggle') - var area = $(areaSelector) + const areaSelector = $(button).data('apps-slide-toggle') + const area = $(areaSelector) function hideArea() { area.slideUp(OC.menuSpeed * 4, function() { @@ -82,7 +82,7 @@ export const registerAppsSlideToggle = () => { }) area.addClass('opened') $(button).addClass('opened') - var input = $(areaSelector + ' [autofocus]') + const input = $(areaSelector + ' [autofocus]') if (input.length === 1) { input.focus() } @@ -102,7 +102,7 @@ export const registerAppsSlideToggle = () => { // all other areas that have not been clicked but are open // should be slid up } else { - var closest = $(event.target).closest(areaSelector) + const closest = $(event.target).closest(areaSelector) if (area.is(':visible') && closest[0] !== area[0]) { hideArea() } diff --git a/core/src/OC/backbone.js b/core/src/OC/backbone.js index 38bfc046501..86e98ec1b41 100644 --- a/core/src/OC/backbone.js +++ b/core/src/OC/backbone.js @@ -27,7 +27,7 @@ const Backbone = VendorBackbone.noConflict() // Patch Backbone for DAV Object.assign(Backbone, { davCall, - davSync: davSync(Backbone) + davSync: davSync(Backbone), }) export default Backbone diff --git a/core/src/OC/currentuser.js b/core/src/OC/currentuser.js index c8f9d59c1eb..061abba89d6 100644 --- a/core/src/OC/currentuser.js +++ b/core/src/OC/currentuser.js @@ -31,6 +31,6 @@ export const currentUser = rawUid !== undefined ? rawUid : false export const getCurrentUser = () => { return { uid: currentUser, - displayName + displayName, } } diff --git a/core/src/OC/get_set.js b/core/src/OC/get_set.js index bf45ce85fc7..12f9aab56eb 100644 --- a/core/src/OC/get_set.js +++ b/core/src/OC/get_set.js @@ -28,7 +28,7 @@ export const get = context => name => { const namespaces = name.split('.') const tail = namespaces.pop() - for (var i = 0; i < namespaces.length; i++) { + for (let i = 0; i < namespaces.length; i++) { context = context[namespaces[i]] if (!context) { return false diff --git a/core/src/OC/index.js b/core/src/OC/index.js index 2a43d95eade..9ecb3e60f6f 100644 --- a/core/src/OC/index.js +++ b/core/src/OC/index.js @@ -25,7 +25,7 @@ import { addScript, addStyle } from './legacy-loader' import { ajaxConnectionLostHandler, processAjaxError, - registerXHRForErrorProcessing + registerXHRForErrorProcessing, } from './xhr-error' import Apps from './apps' import { AppConfig, appConfig } from './appconfig' @@ -37,11 +37,11 @@ import { dirname, encodePath, isSamePath, - joinPaths + joinPaths, } from '@nextcloud/paths' import { build as buildQueryString, - parse as parseQueryString + parse as parseQueryString, } from './query-string' import Config from './config' import { @@ -54,7 +54,7 @@ import { PERMISSION_READ, PERMISSION_SHARE, PERMISSION_UPDATE, - TAG_FAVORITE + TAG_FAVORITE, } from './constants' import ContactsMenu from './contactsmenu' import { currentUser, getCurrentUser } from './currentuser' @@ -66,22 +66,22 @@ import { getHost, getHostName, getPort, - getProtocol + getProtocol, } from './host' import { - getToken as getRequestToken + getToken as getRequestToken, } from './requesttoken' import { hideMenus, registerMenu, showMenu, - unregisterMenu + unregisterMenu, } from './menu' import { isUserAdmin } from './admin' import L10N, { getCanonicalLocale, getLanguage, - getLocale + getLocale, } from './l10n' import { @@ -92,7 +92,7 @@ import { linkTo, linkToOCS, linkToRemote, - linkToRemoteBase + linkToRemoteBase, } from './routing' import msg from './msg' import Notification from './notification' @@ -270,7 +270,7 @@ export default { * @deprecated since 8.2, use OC.getRootPath() instead * @see OC#getRootPath */ - webroot + webroot, } // Keep the request token prop in sync diff --git a/core/src/OC/l10n-registry.js b/core/src/OC/l10n-registry.js index 44dc6f91be5..dc353902337 100644 --- a/core/src/OC/l10n-registry.js +++ b/core/src/OC/l10n-registry.js @@ -83,6 +83,6 @@ export const hasAppTranslations = appId => { export const getAppTranslations = appId => { return { translations: window._oc_l10n_registry_translations[appId] || {}, - pluralFunction: window._oc_l10n_registry_plural_functions[appId] + pluralFunction: window._oc_l10n_registry_plural_functions[appId], } } diff --git a/core/src/OC/l10n.js b/core/src/OC/l10n.js index ebb2c032b6a..5ada257d858 100644 --- a/core/src/OC/l10n.js +++ b/core/src/OC/l10n.js @@ -19,7 +19,7 @@ import { getAppTranslations, hasAppTranslations, registerAppTranslations, - unregisterAppTranslations + unregisterAppTranslations, } from './l10n-registry' /** @@ -40,15 +40,15 @@ const L10n = { load: function(appName, callback) { // already available ? if (hasAppTranslations(appName) || OC.getLocale() === 'en') { - var deferred = $.Deferred() - var promise = deferred.promise() + const deferred = $.Deferred() + const promise = deferred.promise() promise.then(callback) deferred.resolve() return promise } - var self = this - var url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json') + const self = this + const url = OC.filePath(appName, 'l10n', OC.getLocale() + '.json') // load JSON translation bundle per AJAX return $.get(url) @@ -87,19 +87,19 @@ const L10n = { * @returns {string} */ translate: function(app, text, vars, count, options) { - var defaultOptions = { - escape: true + const defaultOptions = { + escape: true, } - var allOptions = options || {} + const allOptions = options || {} _.defaults(allOptions, defaultOptions) // TODO: cache this function to avoid inline recreation // of the same function over and over again in case // translate() is used in a loop - var _build = function(text, vars, count) { + const _build = function(text, vars, count) { return text.replace(/%n/g, count).replace(/{([^{}]*)}/g, function(a, b) { - var r = vars[b] + const r = vars[b] if (typeof r === 'string' || typeof r === 'number') { if (allOptions.escape) { return DOMPurify.sanitize(escapeHTML(r)) @@ -112,9 +112,9 @@ const L10n = { } ) } - var translation = text - var bundle = getAppTranslations(app) - var value = bundle.translations[text] + let translation = text + const bundle = getAppTranslations(app) + const value = bundle.translations[text] if (typeof (value) !== 'undefined') { translation = value } @@ -142,9 +142,9 @@ const L10n = { const bundle = getAppTranslations(app) const value = bundle.translations[identifier] if (typeof (value) !== 'undefined') { - var translation = value + const translation = value if ($.isArray(translation)) { - var plural = bundle.pluralFunction(count) + const plural = bundle.pluralFunction(count) return this.translate(app, translation[plural], vars, count, options) } } @@ -164,7 +164,7 @@ const L10n = { * @private */ _getPlural: function(number) { - var language = OC.getLanguage() + let language = OC.getLanguage() if (language === 'pt_BR') { // temporary set a locale for brazilian language = 'xbr' @@ -315,7 +315,7 @@ const L10n = { default: return 0 } - } + }, } export default L10n diff --git a/core/src/OC/msg.js b/core/src/OC/msg.js index e210f32bb14..744bd795b6c 100644 --- a/core/src/OC/msg.js +++ b/core/src/OC/msg.js @@ -113,5 +113,5 @@ export default { .addClass('error') .removeClass('success') .show() - } + }, } diff --git a/core/src/OC/notification.js b/core/src/OC/notification.js index b56fb6b14de..4e95476b69b 100644 --- a/core/src/OC/notification.js +++ b/core/src/OC/notification.js @@ -156,5 +156,5 @@ export default { */ isHidden: function() { return !$('#content').find('.toastify').length - } + }, } diff --git a/core/src/OC/password-confirmation.js b/core/src/OC/password-confirmation.js index e303d70bf5d..f708217fc84 100644 --- a/core/src/OC/password-confirmation.js +++ b/core/src/OC/password-confirmation.js @@ -39,8 +39,8 @@ export default { }, requiresPasswordConfirmation: function() { - var serverTimeDiff = this.pageLoadTime - (window.nc_pageLoad * 1000) - var timeSinceLogin = moment.now() - (serverTimeDiff + (window.nc_lastLogin * 1000)) + const serverTimeDiff = this.pageLoadTime - (window.nc_pageLoad * 1000) + const timeSinceLogin = moment.now() - (serverTimeDiff + (window.nc_lastLogin * 1000)) // if timeSinceLogin > 30 minutes and user backend allows password confirmation return (window.backendAllowsPasswordConfirmation && timeSinceLogin > 30 * 60 * 1000) @@ -53,7 +53,7 @@ export default { */ requirePasswordConfirmation: function(callback, options, rejectCallback) { options = typeof options !== 'undefined' ? options : {} - var defaults = { + const defaults = { title: t('core', 'Authentication required'), text: t( 'core', @@ -61,12 +61,12 @@ export default { ), confirm: t('core', 'Confirm'), label: t('core', 'Password'), - error: '' + error: '', } - var config = _.extend(defaults, options) + const config = _.extend(defaults, options) - var self = this + const self = this if (this.requiresPasswordConfirmation()) { OC.dialogs.prompt( @@ -83,16 +83,16 @@ export default { config.label, true ).then(function() { - var $dialog = $('.oc-dialog:visible') + const $dialog = $('.oc-dialog:visible') $dialog.find('.ui-icon').remove() $dialog.addClass('password-confirmation') if (config.error !== '') { - var $error = $('<p></p>').addClass('msg warning').text(config.error) + const $error = $('<p></p>').addClass('msg warning').text(config.error) + $dialog.find('.oc-dialog-content').append($error) } - $dialog.find('.oc-dialog-content').append($error) $dialog.find('.oc-dialog-buttonrow').addClass('aside') - var $buttons = $dialog.find('button') + const $buttons = $dialog.find('button') $buttons.eq(0).hide() $buttons.eq(1).text(config.confirm) }) @@ -102,12 +102,12 @@ export default { }, _confirmPassword: function(password, config) { - var self = this + const self = this $.ajax({ url: OC.generateUrl('/login/confirm'), data: { - password: password + password: password, }, type: 'POST', success: function(response) { @@ -120,7 +120,7 @@ export default { error: function() { config.error = t('core', 'Failed to authenticate, try again') OC.PasswordConfirmation.requirePasswordConfirmation(self.callback, config) - } + }, }) - } + }, } diff --git a/core/src/OC/plugins.js b/core/src/OC/plugins.js index 124116b9a59..1c9b59c7419 100644 --- a/core/src/OC/plugins.js +++ b/core/src/OC/plugins.js @@ -36,7 +36,7 @@ export default { * @param {OC.Plugin} plugin plugin */ register: function(targetName, plugin) { - var plugins = this._plugins[targetName] + let plugins = this._plugins[targetName] if (!plugins) { plugins = this._plugins[targetName] = [] } @@ -62,8 +62,8 @@ export default { * @param {Object} [options] options */ attach: function(targetName, targetObject, options) { - var plugins = this.getPlugins(targetName) - for (var i = 0; i < plugins.length; i++) { + const plugins = this.getPlugins(targetName) + for (let i = 0; i < plugins.length; i++) { if (plugins[i].attach) { plugins[i].attach(targetObject, options) } @@ -78,12 +78,12 @@ export default { * @param {Object} [options] options */ detach: function(targetName, targetObject, options) { - var plugins = this.getPlugins(targetName) - for (var i = 0; i < plugins.length; i++) { + const plugins = this.getPlugins(targetName) + for (let i = 0; i < plugins.length; i++) { if (plugins[i].detach) { plugins[i].detach(targetObject, options) } } - } + }, } diff --git a/core/src/OC/query-string.js b/core/src/OC/query-string.js index a8141777905..502fa15e474 100644 --- a/core/src/OC/query-string.js +++ b/core/src/OC/query-string.js @@ -25,10 +25,9 @@ * @returns {Object.<string, string>} map containing key/values matching the URL parameters */ export const parse = queryString => { - let parts let pos let components - let result = {} + const result = {} let key if (!queryString) { return null @@ -37,15 +36,15 @@ export const parse = queryString => { if (pos >= 0) { queryString = queryString.substr(pos + 1) } - parts = queryString.replace(/\+/g, '%20').split('&') + const parts = queryString.replace(/\+/g, '%20').split('&') for (let i = 0; i < parts.length; i++) { // split on first equal sign - var part = parts[i] + const part = parts[i] pos = part.indexOf('=') if (pos >= 0) { components = [ part.substr(0, pos), - part.substr(pos + 1) + part.substr(pos + 1), ] } else { // key only @@ -79,7 +78,7 @@ export const build = params => { return '' } return $.map(params, function(value, key) { - var s = encodeURIComponent(key) + let s = encodeURIComponent(key) if (value !== null && typeof (value) !== 'undefined') { s += '=' + encodeURIComponent(value) } diff --git a/core/src/OC/requesttoken.js b/core/src/OC/requesttoken.js index 91b18069d75..b25fdafd5b4 100644 --- a/core/src/OC/requesttoken.js +++ b/core/src/OC/requesttoken.js @@ -35,6 +35,6 @@ export const setToken = newToken => { token = newToken emit('csrf-token-update', { - token + token, }) } diff --git a/core/src/OC/routing.js b/core/src/OC/routing.js index 36fd0009032..9244212286d 100644 --- a/core/src/OC/routing.js +++ b/core/src/OC/routing.js @@ -68,7 +68,7 @@ export const linkToOCS = (service, version) => { */ export const generateUrl = (url, params, options) => { const defaultOptions = { - escape: true + escape: true, } const allOptions = options || {} _.defaults(allOptions, defaultOptions) @@ -77,7 +77,7 @@ export const generateUrl = (url, params, options) => { vars = vars || [] return text.replace(/{([^{}]*)}/g, function(a, b) { - var r = (vars[b]) + const r = (vars[b]) if (allOptions.escape) { return (typeof r === 'string' || typeof r === 'number') ? encodeURIComponent(r) : encodeURIComponent(a) } else { diff --git a/core/src/OC/util-history.js b/core/src/OC/util-history.js index dfb5117c27e..61fe3fec098 100644 --- a/core/src/OC/util-history.js +++ b/core/src/OC/util-history.js @@ -46,7 +46,7 @@ export default { * @param {boolean} [replace=false] whether to replace instead of pushing */ _pushState: function(params, url, replace) { - var strParams + let strParams if (typeof (params) === 'string') { strParams = params } else { @@ -57,10 +57,10 @@ export default { url = url || location.pathname + '?' + strParams // Workaround for bug with SVG and window.history.pushState on Firefox < 51 // https://bugzilla.mozilla.org/show_bug.cgi?id=652991 - var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 + const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 if (isFirefox && parseInt(navigator.userAgent.split('/').pop()) < 51) { - var patterns = document.querySelectorAll('[fill^="url(#"], [stroke^="url(#"], [filter^="url(#invert"]') - for (var i = 0, ii = patterns.length, pattern; i < ii; i++) { + const patterns = document.querySelectorAll('[fill^="url(#"], [stroke^="url(#"], [filter^="url(#invert"]') + for (let i = 0, ii = patterns.length, pattern; i < ii; i++) { pattern = patterns[i] // eslint-disable-next-line no-self-assign pattern.style.fill = pattern.style.fill @@ -127,8 +127,8 @@ export default { * @returns {string} */ _parseHashQuery: function() { - var hash = window.location.hash - var pos = hash.indexOf('?') + const hash = window.location.hash + const pos = hash.indexOf('?') if (pos >= 0) { return hash.substr(pos + 1) } @@ -150,8 +150,8 @@ export default { * @returns {Object} map of parameters */ parseUrlQuery: function() { - var query = this._parseHashQuery() - var params + const query = this._parseHashQuery() + let params // try and parse from URL hash first if (query) { params = OC.parseQueryString(this._decodeQuery(query)) @@ -166,7 +166,7 @@ export default { this._cancelPop = false return } - var params + let params if (!this._handlers.length) { return } @@ -176,8 +176,8 @@ export default { } else if (!params) { params = this.parseUrlQuery() || {} } - for (var i = 0; i < this._handlers.length; i++) { + for (let i = 0; i < this._handlers.length; i++) { this._handlers[i](params) } - } + }, } diff --git a/core/src/OC/util.js b/core/src/OC/util.js index 7c4a44b77d9..1bb4ae9ead0 100644 --- a/core/src/OC/util.js +++ b/core/src/OC/util.js @@ -28,7 +28,7 @@ import humanFileSize from '../Util/human-file-size' function chunkify(t) { // Adapted from http://my.opera.com/GreyWyvern/blog/show.dml/1671288 - let tz = [] + const tz = [] let x = 0 let y = -1 let n = 0 @@ -37,7 +37,7 @@ function chunkify(t) { while (x < t.length) { c = t.charAt(x) // only include the dot in strings - var m = ((!n && c === '.') || (c >= '0' && c <= '9')) + const m = ((!n && c === '.') || (c >= '0' && c <= '9')) if (m !== n) { // next chunk y++ @@ -75,10 +75,10 @@ export default { return null } - var s = string.toLowerCase().trim() - var bytes = null + const s = string.toLowerCase().trim() + let bytes = null - var bytesArray = { + const bytesArray = { 'b': 1, 'k': 1024, 'kb': 1024, @@ -89,10 +89,10 @@ export default { 'tb': 1024 * 1024 * 1024 * 1024, 't': 1024 * 1024 * 1024 * 1024, 'pb': 1024 * 1024 * 1024 * 1024 * 1024, - 'p': 1024 * 1024 * 1024 * 1024 * 1024 + 'p': 1024 * 1024 * 1024 * 1024 * 1024, } - var matches = s.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i) + const matches = s.match(/^[\s+]?([0-9]*)(\.([0-9]+))?( +)?([kmgtp]?b?)$/i) if (matches !== null) { bytes = parseFloat(s) if (!isFinite(bytes)) { @@ -124,7 +124,7 @@ export default { * @returns {string} human readable difference from now */ relativeModifiedDate: function(timestamp) { - var diff = moment().diff(moment(timestamp)) + const diff = moment().diff(moment(timestamp)) if (diff >= 0 && diff < 45000) { return t('core', 'seconds ago') } @@ -150,11 +150,11 @@ export default { return this._scrollBarWidth } - var inner = document.createElement('p') + const inner = document.createElement('p') inner.style.width = '100%' inner.style.height = '200px' - var outer = document.createElement('div') + const outer = document.createElement('div') outer.style.position = 'absolute' outer.style.top = '0px' outer.style.left = '0px' @@ -165,9 +165,9 @@ export default { outer.appendChild(inner) document.body.appendChild(outer) - var w1 = inner.offsetWidth + const w1 = inner.offsetWidth outer.style.overflow = 'scroll' - var w2 = inner.offsetWidth + let w2 = inner.offsetWidth if (w1 === w2) { w2 = outer.clientWidth } @@ -199,13 +199,13 @@ export default { * or 0 if the strings are identical */ naturalSortCompare: function(a, b) { - var x - var aa = chunkify(a) - var bb = chunkify(b) + let x + const aa = chunkify(a) + const bb = chunkify(b) for (x = 0; aa[x] && bb[x]; x++) { if (aa[x] !== bb[x]) { - var aNum = Number(aa[x]); var bNum = Number(bb[x]) + const aNum = Number(aa[x]); const bNum = Number(bb[x]) // note: == is correct here /* eslint-disable-next-line */ if (aNum == aa[x] && bNum == bb[x]) { @@ -226,7 +226,7 @@ export default { * @param {integer} interval in milliseconds */ waitFor: function(callback, interval) { - var internalCallback = function() { + const internalCallback = function() { if (callback() !== true) { setTimeout(internalCallback, interval) } @@ -242,13 +242,13 @@ export default { * @returns {boolean} true if the cookie with the given name has the given value */ isCookieSetToValue: function(name, value) { - var cookies = document.cookie.split(';') - for (var i = 0; i < cookies.length; i++) { - var cookie = cookies[i].split('=') + const cookies = document.cookie.split(';') + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i].split('=') if (cookie[0].trim() === name && cookie[1].trim() === value) { return true } } return false - } + }, } diff --git a/core/src/OC/webroot.js b/core/src/OC/webroot.js index cf9da346f92..89c04a6bb07 100644 --- a/core/src/OC/webroot.js +++ b/core/src/OC/webroot.js @@ -23,7 +23,7 @@ let webroot = window._oc_webroot if (typeof webroot === 'undefined') { webroot = location.pathname - var pos = webroot.indexOf('/index.php/') + const pos = webroot.indexOf('/index.php/') if (pos !== -1) { webroot = webroot.substr(0, pos) } else { diff --git a/core/src/OCP/appconfig.js b/core/src/OCP/appconfig.js index f4213419aab..d7aaf12ddeb 100644 --- a/core/src/OCP/appconfig.js +++ b/core/src/OCP/appconfig.js @@ -43,7 +43,7 @@ function call(method, endpoint, options) { url: OC.linkToOCS('apps/provisioning_api/api/v1', 2) + 'config/apps' + endpoint, data: options.data || {}, success: options.success, - error: options.error + error: options.error, }) } @@ -79,7 +79,7 @@ export function getKeys(app, options) { export function getValue(app, key, defaultValue, options) { options = options || {} options.data = { - defaultValue: defaultValue + defaultValue: defaultValue, } call('get', '/' + app + '/' + key, options) @@ -97,7 +97,7 @@ export function getValue(app, key, defaultValue, options) { export function setValue(app, key, value, options) { options = options || {} options.data = { - value: value + value: value, } call('post', '/' + app + '/' + key, options) diff --git a/core/src/OCP/collaboration.js b/core/src/OCP/collaboration.js index 4eea517f3aa..cfb307a0a3f 100644 --- a/core/src/OCP/collaboration.js +++ b/core/src/OCP/collaboration.js @@ -30,7 +30,7 @@ /** * @type {TypeDefinition[]} **/ -let types = {} +const types = {} /** * Those translations will be used by the vue component but they should be shipped with the server @@ -47,7 +47,7 @@ export const l10nProjects = () => { t('core', 'Failed to create a project'), t('core', 'Failed to add the item to the project'), t('core', 'Connect items to a project to make them easier to find'), - t('core', 'Type to search for existing projects') + t('core', 'Type to search for existing projects'), ] } @@ -75,5 +75,5 @@ export default { getLink(type, id) { /* TODO: Allow action to be executed instead of href as well */ return typeof types[type] !== 'undefined' ? types[type].link(id) : '' - } + }, } diff --git a/core/src/OCP/index.js b/core/src/OCP/index.js index 3309e3fe047..d8640b1ff0c 100644 --- a/core/src/OCP/index.js +++ b/core/src/OCP/index.js @@ -18,9 +18,9 @@ export default { /** * @deprecated 18.0.0 add https://www.npmjs.com/package/@nextcloud/initial-state to your app */ - loadState + loadState, }, Loader, Toast, - WhatsNew + WhatsNew, } diff --git a/core/src/OCP/loader.js b/core/src/OCP/loader.js index 7f72c47ca64..293af9bbec2 100644 --- a/core/src/OCP/loader.js +++ b/core/src/OCP/loader.js @@ -20,8 +20,8 @@ * */ -let loadedScripts = {} -let loadedStylesheets = {} +const loadedScripts = {} +const loadedStylesheets = {} /** * @namespace OCP * @class Loader @@ -42,8 +42,8 @@ export default { } loadedScripts[key] = true return new Promise(function(resolve, reject) { - var scriptPath = OC.filePath(app, 'js', file) - var script = document.createElement('script') + const scriptPath = OC.filePath(app, 'js', file) + const script = document.createElement('script') script.src = scriptPath script.setAttribute('nonce', btoa(OC.requestToken)) script.onload = () => resolve() @@ -66,8 +66,8 @@ export default { } loadedStylesheets[key] = true return new Promise(function(resolve, reject) { - var stylePath = OC.filePath(app, 'css', file) - var link = document.createElement('link') + const stylePath = OC.filePath(app, 'css', file) + const link = document.createElement('link') link.href = stylePath link.type = 'text/css' link.rel = 'stylesheet' @@ -75,5 +75,5 @@ export default { link.onerror = () => reject(new Error(`Failed to load stylesheet from ${stylePath}`)) document.head.appendChild(link) }) - } + }, } diff --git a/core/src/OCP/toast.js b/core/src/OCP/toast.js index 58f98d93480..6bb3b130287 100644 --- a/core/src/OCP/toast.js +++ b/core/src/OCP/toast.js @@ -27,7 +27,7 @@ const TOAST_TYPE_CLASES = { info: 'toast-info', warning: 'toast-warning', success: 'toast-success', - permanent: 'permanent' + permanent: 'permanent', } const Toast = { @@ -59,7 +59,7 @@ const Toast = { isHTML: false, type: undefined, close: true, - callback: () => {} + callback: () => {}, }) if (!options.isHTML) { text = $('<div/>').text(text).html() @@ -78,12 +78,12 @@ const Toast = { selector: !window.TESTING ? 'content' : 'testArea', positionLeft: false, backgroundColor: '', - className: 'toast ' + classes + className: 'toast ' + classes, }) toast.showToast() // add toastify object to the element for reference in legacy OC.Notification toast.toastElement.toastify = toast return toast - } + }, } export default Toast diff --git a/core/src/OCP/whatsnew.js b/core/src/OCP/whatsnew.js index c2935c5e78c..c0df8af7b3f 100644 --- a/core/src/OCP/whatsnew.js +++ b/core/src/OCP/whatsnew.js @@ -14,14 +14,14 @@ import OC from '../OC/index' export function query(options) { options = options || {} - var dismissOptions = options.dismiss || {} + const dismissOptions = options.dismiss || {} $.ajax({ type: 'GET', url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json', success: options.success || function(data, statusText, xhr) { onQuerySuccess(data, statusText, xhr, dismissOptions) }, - error: options.error || onQueryError + error: options.error || onQueryError, }) } @@ -32,7 +32,7 @@ export function dismiss(version, options) { url: options.url || OC.linkToOCS('core', 2) + 'whatsnew', data: { version: encodeURIComponent(version) }, success: options.success || onDismissSuccess, - error: options.error || onDismissError + error: options.error || onDismissError, }) // remove element immediately $('.whatsNewPopover').remove() @@ -46,12 +46,12 @@ function onQuerySuccess(data, statusText, xhr, dismissOptions) { return } - var item, menuItem, text, icon + let item, menuItem, text, icon - var div = document.createElement('div') + const div = document.createElement('div') div.classList.add('popovermenu', 'open', 'whatsNewPopover', 'menu-left') - var list = document.createElement('ul') + const list = document.createElement('ul') // header item = document.createElement('li') @@ -74,8 +74,8 @@ function onQuerySuccess(data, statusText, xhr, dismissOptions) { list.appendChild(item) // Highlights - for (var i in data['ocs']['data']['whatsNew']['regular']) { - var whatsNewTextItem = data['ocs']['data']['whatsNew']['regular'][i] + for (const i in data['ocs']['data']['whatsNew']['regular']) { + const whatsNewTextItem = data['ocs']['data']['whatsNew']['regular'][i] item = document.createElement('li') menuItem = document.createElement('span') diff --git a/core/src/Polyfill/closest.js b/core/src/Polyfill/closest.js index 1c608646127..6af05d526a7 100644 --- a/core/src/Polyfill/closest.js +++ b/core/src/Polyfill/closest.js @@ -8,7 +8,7 @@ if (!Element.prototype.matches) { if (!Element.prototype.closest) { Element.prototype.closest = function(s) { - var el = this + let el = this do { if (el.matches(s)) return el diff --git a/core/src/Polyfill/console.js b/core/src/Polyfill/console.js index faa32c457c6..0d60fe6f20d 100644 --- a/core/src/Polyfill/console.js +++ b/core/src/Polyfill/console.js @@ -26,7 +26,7 @@ if (typeof console === 'undefined' || typeof console.log === 'undefined') { } const noOp = () => {} const methods = ['log', 'debug', 'warn', 'info', 'error', 'assert', 'time', 'timeEnd'] - for (var i = 0; i < methods.length; i++) { + for (let i = 0; i < methods.length; i++) { console[methods[i]] = noOp } } diff --git a/core/src/Util/human-file-size.js b/core/src/Util/human-file-size.js index 586ef0e9267..7f9eb7ab61d 100644 --- a/core/src/Util/human-file-size.js +++ b/core/src/Util/human-file-size.js @@ -26,13 +26,13 @@ * @returns {string} */ export default function humanFileSize(size, skipSmallSizes) { - var humanList = ['B', 'KB', 'MB', 'GB', 'TB'] + const humanList = ['B', 'KB', 'MB', 'GB', 'TB'] // Calculate Log with base 1024: size = 1024 ** order - var order = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0 + let order = size > 0 ? Math.floor(Math.log(size) / Math.log(1024)) : 0 // Stay in range of the byte sizes that are defined order = Math.min(humanList.length - 1, order) - var readableFormat = humanList[order] - var relativeSize = (size / Math.pow(1024, order)).toFixed(1) + const readableFormat = humanList[order] + let relativeSize = (size / Math.pow(1024, order)).toFixed(1) if (skipSmallSizes === true && order === 0) { if (relativeSize !== '0.0') { return '< 1 KB' diff --git a/core/src/components/ContactsMenu.js b/core/src/components/ContactsMenu.js index 661b6d8e7c6..0791fe83b0c 100644 --- a/core/src/components/ContactsMenu.js +++ b/core/src/components/ContactsMenu.js @@ -29,6 +29,6 @@ export const setUp = () => { // eslint-disable-next-line no-new new OC.ContactsMenu({ el: $('#contactsmenu .menu'), - trigger: $('#contactsmenu .menutoggle') + trigger: $('#contactsmenu .menutoggle'), }) } diff --git a/core/src/components/login/LoginForm.vue b/core/src/components/login/LoginForm.vue index 32821f37ed6..687896ceb54 100644 --- a/core/src/components/login/LoginForm.vue +++ b/core/src/components/login/LoginForm.vue @@ -141,34 +141,34 @@ export default { props: { username: { type: String, - default: '' + default: '', }, redirectUrl: { - type: String + type: String, }, errors: { type: Array, - default: () => [] + default: () => [], }, messages: { type: Array, - default: () => [] + default: () => [], }, throttleDelay: { - type: Number + type: Number, }, invertedColors: { type: Boolean, - default: false + default: false, }, autoCompleteAllowed: { type: Boolean, - default: true + default: true, }, directLogin: { type: Boolean, - default: false - } + default: false, + }, }, data() { return { @@ -177,7 +177,7 @@ export default { timezoneOffset: (-new Date().getTimezoneOffset() / 60), user: this.username, password: '', - passwordInputType: 'password' + passwordInputType: 'password', } }, computed: { @@ -192,7 +192,7 @@ export default { }, userDisabled() { return this.errors.indexOf('userdisabled') !== -1 - } + }, }, mounted() { if (this.username === '') { @@ -215,8 +215,8 @@ export default { submit() { this.loading = true this.$emit('submit') - } - } + }, + }, } </script> diff --git a/core/src/components/login/ResetPassword.vue b/core/src/components/login/ResetPassword.vue index 829320eec85..3a6d49a9025 100644 --- a/core/src/components/login/ResetPassword.vue +++ b/core/src/components/login/ResetPassword.vue @@ -82,29 +82,29 @@ export default { props: { username: { type: String, - required: true + required: true, }, resetPasswordLink: { type: String, - required: true + required: true, }, invertedColors: { type: Boolean, - default: false - } + default: false, + }, }, data() { return { error: false, loading: false, message: undefined, - user: this.username + user: this.username, } }, watch: { username(value) { this.user = value - } + }, }, methods: { updateUsername() { @@ -117,7 +117,7 @@ export default { const url = generateUrl('/lostpassword/email') const data = { - user: this.user + user: this.user, } return axios.post(url, data) @@ -136,8 +136,8 @@ export default { this.message = 'send-error' }) .then(() => { this.loading = false }) - } - } + }, + }, } </script> diff --git a/core/src/components/login/UpdatePassword.vue b/core/src/components/login/UpdatePassword.vue index 0da2221c4c0..3fa3c60773c 100644 --- a/core/src/components/login/UpdatePassword.vue +++ b/core/src/components/login/UpdatePassword.vue @@ -74,16 +74,16 @@ export default { props: { username: { type: String, - required: true + required: true, }, resetPasswordTarget: { type: String, - required: true + required: true, }, invertedColors: { type: Boolean, - default: false - } + default: false, + }, }, data() { return { @@ -93,13 +93,13 @@ export default { user: this.username, password: '', encrypted: false, - proceed: false + proceed: false, } }, watch: { username(value) { this.user = value - } + }, }, methods: { async submit() { @@ -110,7 +110,7 @@ export default { try { const { data } = await Axios.post(this.resetPasswordTarget, { password: this.password, - proceed: this.proceed + proceed: this.proceed, }) if (data && data.status === 'success') { this.message = 'send-success' @@ -129,8 +129,8 @@ export default { } finally { this.loading = false } - } - } + }, + }, } </script> diff --git a/core/src/components/setup/RecommendedApps.vue b/core/src/components/setup/RecommendedApps.vue index 5dfe6fb4d27..79c3aae9e6a 100644 --- a/core/src/components/setup/RecommendedApps.vue +++ b/core/src/components/setup/RecommendedApps.vue @@ -51,7 +51,9 @@ </p> </div> </div> - <p class="text-center"><a :href="defaultPageUrl">{{ t('core', 'Cancel') }}</a></p> + <p class="text-center"> + <a :href="defaultPageUrl">{{ t('core', 'Cancel') }}</a> + </p> </div> </template> @@ -67,19 +69,19 @@ import logger from '../../logger' const recommended = { calendar: { description: t('core', 'Schedule work & meetings, synced with all your devices.'), - icon: imagePath('core', 'places/calendar.svg') + icon: imagePath('core', 'places/calendar.svg'), }, contacts: { description: t('core', 'Keep your colleagues and friends in one place without leaking their private info.'), - icon: imagePath('core', 'places/contacts.svg') + icon: imagePath('core', 'places/contacts.svg'), }, mail: { description: t('core', 'Simple email app nicely integrated with Files, Contacts and Calendar.'), - icon: imagePath('core', 'actions/mail.svg') + icon: imagePath('core', 'actions/mail.svg'), }, talk: { - description: t('core', 'Screensharing, online meetings and web conferencing – on desktop and with mobile apps.') - } + description: t('core', 'Screensharing, online meetings and web conferencing – on desktop and with mobile apps.'), + }, } const recommendedIds = Object.keys(recommended) const defaultPageUrl = loadState('core', 'defaultPageUrl') @@ -91,13 +93,13 @@ export default { loadingApps: true, loadingAppsError: false, apps: [], - defaultPageUrl + defaultPageUrl, } }, computed: { recommendedApps() { return this.apps.filter(app => recommendedIds.includes(app.id)) - } + }, }, mounted() { return axios.get(generateUrl('settings/apps/list')) @@ -159,8 +161,8 @@ export default { return '' } return recommended[appId].description - } - } + }, + }, } </script> diff --git a/core/src/globals.js b/core/src/globals.js index cd8dcc5e241..e6930cd3dbc 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -99,7 +99,7 @@ const setDeprecatedProp = (global, cb, msg) => { } return cb() - } + }, }) } diff --git a/core/src/init.js b/core/src/init.js index ee232e8fdbf..f0102fdde40 100644 --- a/core/src/init.js +++ b/core/src/init.js @@ -127,7 +127,7 @@ export const initCore = () => { watch: true, // set edge < 16 as incompatible onlyLegacy: !(/Edge\/([0-9]{2})\./i.test(navigator.userAgent) - && parseInt(/Edge\/([0-9]{2})\./i.exec(navigator.userAgent)[1]) < 16) + && parseInt(/Edge\/([0-9]{2})\./i.exec(navigator.userAgent)[1]) < 16), }) } @@ -212,7 +212,7 @@ export const initCore = () => { element: document.getElementById('app-content'), disable: 'right', maxPosition: 300, // $navigation-width - minDragDistance: 100 + minDragDistance: 100, }) $('#app-content').prepend('<div id="app-navigation-toggle" class="icon-menu" style="display:none" tabindex="0"></div>') diff --git a/core/src/jquery/avatar.js b/core/src/jquery/avatar.js index eaedce1461b..24cef392d34 100644 --- a/core/src/jquery/avatar.js +++ b/core/src/jquery/avatar.js @@ -65,7 +65,7 @@ import OC from '../OC' */ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { - var setAvatarForUnknownUser = function(target) { + const setAvatarForUnknownUser = function(target) { target.imageplaceholder('?') target.css('background-color', '#b9b9b9') } @@ -102,8 +102,8 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { // sanitize user = String(user).replace(/\//g, '') - var $div = this - var url + const $div = this + let url // If this is our own avatar we have to use the version attribute if (user === OC.getCurrentUser().uid) { @@ -112,18 +112,18 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) { { user: user, size: Math.ceil(size * window.devicePixelRatio), - version: oc_userconfig.avatar.version + version: oc_userconfig.avatar.version, }) } else { url = OC.generateUrl( '/avatar/{user}/{size}', { user: user, - size: Math.ceil(size * window.devicePixelRatio) + size: Math.ceil(size * window.devicePixelRatio), }) } - var img = new Image() + const img = new Image() // If the new image loads successfully set it. img.onload = function() { diff --git a/core/src/jquery/contactsmenu.js b/core/src/jquery/contactsmenu.js index 389c8809be0..ee708dcf982 100644 --- a/core/src/jquery/contactsmenu.js +++ b/core/src/jquery/contactsmenu.js @@ -38,14 +38,14 @@ const entryTemplate = require('./contactsmenu/jquery_entry.handlebars') $.fn.contactsMenu = function(shareWith, shareType, appendTo) { // 0 - user, 4 - email, 6 - remote - var allowedTypes = [0, 4, 6] + const allowedTypes = [0, 4, 6] if (allowedTypes.indexOf(shareType) === -1) { return } - var $div = this + const $div = this appendTo.append(LIST) - var $list = appendTo.find('div.contactsmenu-popover') + const $list = appendTo.find('div.contactsmenu-popover') $div.click(function() { if (!$list.hasClass('hidden')) { @@ -66,46 +66,46 @@ $.fn.contactsMenu = function(shareWith, shareType, appendTo) { method: 'POST', data: { shareType: shareType, - shareWith: shareWith - } + shareWith: shareWith, + }, }).then(function(data) { $list.find('ul').find('li').addClass('hidden') - var actions + let actions if (!data.topAction) { actions = [{ hyperlink: '#', - title: t('core', 'No action available') + title: t('core', 'No action available'), }] } else { actions = [data.topAction].concat(data.actions) } actions.forEach(function(action) { - var template = entryTemplate + const template = entryTemplate $list.find('ul').append(template(action)) }) }, function(jqXHR) { $list.find('ul').find('li').addClass('hidden') - var title + let title if (jqXHR.status === 404) { title = t('core', 'No action available') } else { title = t('core', 'Error fetching contact actions') } - var template = entryTemplate + const template = entryTemplate $list.find('ul').append(template({ hyperlink: '#', - title: title + title: title, })) }) }) $(document).click(function(event) { - var clickedList = ($list.has(event.target).length > 0) - var clickedTarget = ($div.has(event.target).length > 0) + const clickedList = ($list.has(event.target).length > 0) + let clickedTarget = ($div.has(event.target).length > 0) $div.each(function() { if ($(this).is(event.target)) { diff --git a/core/src/jquery/index.js b/core/src/jquery/index.js index d131ae5245a..c0145cb948f 100644 --- a/core/src/jquery/index.js +++ b/core/src/jquery/index.js @@ -48,8 +48,8 @@ import './css/jquery.ocdialog.scss' */ $.ajaxSetup({ contents: { - script: false - } + script: false, + }, }) /** diff --git a/core/src/jquery/ocdialog.js b/core/src/jquery/ocdialog.js index 68384311531..518a28f75d3 100644 --- a/core/src/jquery/ocdialog.js +++ b/core/src/jquery/ocdialog.js @@ -27,15 +27,15 @@ $.widget('oc.ocdialog', { height: 'auto', closeButton: true, closeOnEscape: true, - modal: false + modal: false, }, _create: function() { - var self = this + const self = this this.originalCss = { display: this.element[0].style.display, width: this.element[0].style.width, - height: this.element[0].style.height + height: this.element[0].style.height, } this.originalTitle = this.element.attr('title') @@ -45,7 +45,7 @@ $.widget('oc.ocdialog', { .attr({ // Setting tabIndex makes the div focusable tabIndex: -1, - role: 'dialog' + role: 'dialog', }) .insertBefore(this.element) this.$dialog.append(this.element.detach()) @@ -53,7 +53,7 @@ $.widget('oc.ocdialog', { this.$dialog.css({ display: 'inline-block', - position: 'fixed' + position: 'fixed', }) this.enterCallback = null @@ -92,7 +92,7 @@ $.widget('oc.ocdialog', { self.$buttonrow && self.$buttonrow.find($(event.target)).length === 0 ) { - var $button = self.$buttonrow.find('button.primary') + const $button = self.$buttonrow.find('button.primary') if ($button && !$button.prop('disabled')) { $button.trigger('click') } @@ -111,13 +111,13 @@ $.widget('oc.ocdialog', { this._trigger('open') }, _setOption: function(key, value) { - var self = this + const self = this switch (key) { case 'title': if (this.$title) { this.$title.text(value) } else { - var $title = $('<h2 class="oc-dialog-title">' + const $title = $('<h2 class="oc-dialog-title">' + value + '</h2>') this.$title = $title.prependTo(this.$dialog) @@ -128,7 +128,7 @@ $.widget('oc.ocdialog', { if (this.$buttonrow) { this.$buttonrow.empty() } else { - var $buttonrow = $('<div class="oc-dialog-buttonrow" />') + const $buttonrow = $('<div class="oc-dialog-buttonrow" />') this.$buttonrow = $buttonrow.appendTo(this.$dialog) } if (value.length === 1) { @@ -139,7 +139,7 @@ $.widget('oc.ocdialog', { this.$buttonrow.addClass('threebuttons') } $.each(value, function(idx, val) { - var $button = $('<button>').text(val.text) + const $button = $('<button>').text(val.text) if (val.classes) { $button.addClass(val.classes) } @@ -166,7 +166,7 @@ $.widget('oc.ocdialog', { break case 'closeButton': if (value) { - var $closeButton = $('<a class="oc-dialog-close"></a>') + const $closeButton = $('<a class="oc-dialog-close"></a>') this.$dialog.prepend($closeButton) $closeButton.on('click', function() { self.close() @@ -193,7 +193,7 @@ $.widget('oc.ocdialog', { $.Widget.prototype._setOptions.apply(this, arguments) }, _setSizes: function() { - var lessHeight = 0 + let lessHeight = 0 if (this.$title) { lessHeight += this.$title.outerHeight(true) } @@ -201,7 +201,7 @@ $.widget('oc.ocdialog', { lessHeight += this.$buttonrow.outerHeight(true) } this.element.css({ - 'height': 'calc(100% - ' + lessHeight + 'px)' + 'height': 'calc(100% - ' + lessHeight + 'px)', }) }, _createOverlay: function() { @@ -209,7 +209,7 @@ $.widget('oc.ocdialog', { return } - var self = this + const self = this this.overlay = $('<div>') .addClass('oc-dialog-dim') .appendTo($('#content')) @@ -243,7 +243,7 @@ $.widget('oc.ocdialog', { }, close: function() { this._destroyOverlay() - var self = this + const self = this // Ugly hack to catch remaining keyup events. setTimeout(function() { self._trigger('close', self) @@ -266,5 +266,5 @@ $.widget('oc.ocdialog', { this.element.removeClass('oc-dialog-content') .css(this.originalCss).detach().insertBefore(this.$dialog) this.$dialog.remove() - } + }, }) diff --git a/core/src/jquery/octemplate.js b/core/src/jquery/octemplate.js index a8502b7b796..27b2dff970b 100644 --- a/core/src/jquery/octemplate.js +++ b/core/src/jquery/octemplate.js @@ -62,27 +62,27 @@ const Template = { this.options = $.extend({}, this.options, options) this.elem = elem - var self = this + const self = this if (typeof this.options.escapeFunction === 'function') { - var keys = Object.keys(this.vars) - for (var key = 0; key < keys.length; key++) { + const keys = Object.keys(this.vars) + for (let key = 0; key < keys.length; key++) { if (typeof this.vars[keys[key]] === 'string') { this.vars[keys[key]] = self.options.escapeFunction(this.vars[keys[key]]) } } } - var _html = this._build(this.vars) + const _html = this._build(this.vars) return $(_html) }, // From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript _build: function(o) { - var data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML + const data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML try { return data.replace(/{([^{}]*)}/g, function(a, b) { - var r = o[b] + const r = o[b] return typeof r === 'string' || typeof r === 'number' ? r : a } ) @@ -91,14 +91,14 @@ const Template = { } }, options: { - escapeFunction: escapeHTML - } + escapeFunction: escapeHTML, + }, } $.fn.octemplate = function(vars, options) { vars = vars || {} if (this.length) { - var _template = Object.create(Template) + const _template = Object.create(Template) return _template.init(vars, options, this) } } diff --git a/core/src/jquery/selectrange.js b/core/src/jquery/selectrange.js index b53bac4fc02..3076726024a 100644 --- a/core/src/jquery/selectrange.js +++ b/core/src/jquery/selectrange.js @@ -34,7 +34,7 @@ $.fn.selectRange = function(start, end) { this.focus() this.setSelectionRange(start, end) } else if (this.createTextRange) { - var range = this.createTextRange() + const range = this.createTextRange() range.collapse(true) range.moveEnd('character', end) range.moveStart('character', start) diff --git a/core/src/jquery/showpassword.js b/core/src/jquery/showpassword.js index a9857f4d6d4..393ecac08b5 100644 --- a/core/src/jquery/showpassword.js +++ b/core/src/jquery/showpassword.js @@ -39,15 +39,15 @@ $.fn.extend({ showPassword: function(c) { // Setup callback object - var callback = { 'fn': null, 'args': {} } + const callback = { 'fn': null, 'args': {} } callback.fn = c // Clones passwords and turn the clones into text inputs - var cloneElement = function(element) { + const cloneElement = function(element) { - var $element = $(element) + const $element = $(element) - var $clone = $('<input />') + const $clone = $('<input />') // Name added for JQuery Validation compatibility // Element name is required to avoid script warning. @@ -58,7 +58,7 @@ $.fn.extend({ 'size': $element.attr('size'), 'name': $element.attr('name') + '-clone', 'tabindex': $element.attr('tabindex'), - 'autocomplete': 'off' + 'autocomplete': 'off', }) if ($element.attr('placeholder') !== undefined) { @@ -70,12 +70,12 @@ $.fn.extend({ } // Transfers values between two elements - var update = function(a, b) { + const update = function(a, b) { b.val(a.val()) } // Shows a or b depending on checkbox - var setState = function(checkbox, a, b) { + const setState = function(checkbox, a, b) { if (checkbox.is(':checked')) { update(a, b) @@ -91,11 +91,11 @@ $.fn.extend({ return this.each(function() { - var $input = $(this) - var $checkbox = $($input.data('typetoggle')) + const $input = $(this) + const $checkbox = $($input.data('typetoggle')) // Create clone - var $clone = cloneElement($input) + const $clone = cloneElement($input) $clone.insertAfter($input) // Set callback arguments @@ -144,5 +144,5 @@ $.fn.extend({ } }) - } + }, }) diff --git a/core/src/jquery/tipsy.js b/core/src/jquery/tipsy.js index 75e90b1c060..0ae6ec83af0 100644 --- a/core/src/jquery/tipsy.js +++ b/core/src/jquery/tipsy.js @@ -32,12 +32,12 @@ $.fn.tipsy = function(argument) { if (typeof argument === 'object' && argument !== null) { // tipsy defaults - var options = { + const options = { placement: 'bottom', delay: { 'show': 0, 'hide': 0 }, trigger: 'hover', html: false, - container: 'body' + container: 'body', } if (argument.gravity) { switch (argument.gravity) { diff --git a/core/src/jquery/ui-fixes.js b/core/src/jquery/ui-fixes.js index fb5ce4d7ba8..d70c5579f94 100644 --- a/core/src/jquery/ui-fixes.js +++ b/core/src/jquery/ui-fixes.js @@ -3,6 +3,6 @@ import $ from 'jquery' // Set autocomplete width the same as the related input // See http://stackoverflow.com/a/11845718 $.ui.autocomplete.prototype._resizeMenu = function() { - var ul = this.menu.element + const ul = this.menu.element ul.outerWidth(this.element.outerWidth()) } diff --git a/core/src/login.js b/core/src/login.js index 4624a609651..7270442c83e 100644 --- a/core/src/login.js +++ b/core/src/login.js @@ -63,6 +63,6 @@ new View({ autoCompleteAllowed: fromStateOr('loginAutocomplete', true), resetPasswordTarget: fromStateOr('resetPasswordTarget', ''), resetPasswordUser: fromStateOr('resetPasswordUser', ''), - directLogin: query.direct === '1' - } + directLogin: query.direct === '1', + }, }).$mount('#login') diff --git a/core/src/mixins/Nextcloud.js b/core/src/mixins/Nextcloud.js index 53c30b297ce..3ca755b3052 100644 --- a/core/src/mixins/Nextcloud.js +++ b/core/src/mixins/Nextcloud.js @@ -25,11 +25,11 @@ import OC from '../OC/index' export default { data() { return { - OC + OC, } }, methods: { t: L10n.translate.bind(L10n), - n: L10n.translatePlural.bind(L10n) - } + n: L10n.translatePlural.bind(L10n), + }, } diff --git a/core/src/recommendedapps.js b/core/src/recommendedapps.js index ac0afb99daa..aea105a8422 100644 --- a/core/src/recommendedapps.js +++ b/core/src/recommendedapps.js @@ -34,8 +34,8 @@ __webpack_public_path__ = generateFilePath('core', '', 'js/') Vue.mixin({ methods: { - t - } + t, + }, }) const View = Vue.extend(RecommendedApps) diff --git a/core/src/views/Login.vue b/core/src/views/Login.vue index c7958aac15b..410638497a0 100644 --- a/core/src/views/Login.vue +++ b/core/src/views/Login.vue @@ -77,62 +77,62 @@ export default { components: { LoginForm, ResetPassword, - UpdatePassword + UpdatePassword, }, props: { username: { type: String, - default: '' + default: '', }, redirectUrl: { - type: String + type: String, }, errors: { type: Array, - default: () => [] + default: () => [], }, messages: { type: Array, - default: () => [] + default: () => [], }, throttleDelay: { - type: Number + type: Number, }, canResetPassword: { type: Boolean, - default: false + default: false, }, resetPasswordLink: { - type: String + type: String, }, resetPasswordTarget: { - type: String + type: String, }, invertedColors: { type: Boolean, - default: false + default: false, }, autoCompleteAllowed: { type: Boolean, - default: true + default: true, }, directLogin: { type: Boolean, - default: false - } + default: false, + }, }, data() { return { loading: false, user: this.username, - resetPassword: false + resetPassword: false, } }, methods: { passwordResetFinished() { this.resetPasswordTarget = '' - } - } + }, + }, } </script> |