aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-10-16 14:06:49 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-10-16 22:11:59 +0200
commite8c1e2c611e6cc783e45abc036ee9d55d3a426d8 (patch)
tree6b4f1f6868a9734f9c589a058a9e716fecaef421 /core
parent5be832344eacb8328600d256c3090671c3f582d2 (diff)
downloadnextcloud-server-e8c1e2c611e6cc783e45abc036ee9d55d3a426d8.tar.gz
nextcloud-server-e8c1e2c611e6cc783e45abc036ee9d55d3a426d8.zip
fix(code-style): Adjust JS code to our code style
This resolves 68 ESLint warnings about invalid code style. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core')
-rw-r--r--core/js/tests/html-domparser.js21
-rw-r--r--core/src/OCP/loader.js6
-rw-r--r--core/src/install.js4
-rw-r--r--core/src/jquery/avatar.js10
-rw-r--r--core/src/services/UnifiedSearchService.js2
-rw-r--r--core/src/systemtags/systemtagmodel.js2
6 files changed, 22 insertions, 23 deletions
diff --git a/core/js/tests/html-domparser.js b/core/js/tests/html-domparser.js
index b0bb4e62718..945d4b1f441 100644
--- a/core/js/tests/html-domparser.js
+++ b/core/js/tests/html-domparser.js
@@ -16,10 +16,8 @@
(function(DOMParser) {
"use strict";
- var
- DOMParser_proto = DOMParser.prototype
- , real_parseFromString = DOMParser_proto.parseFromString
- ;
+ var DOMParser_proto = DOMParser.prototype;
+ var real_parseFromString = DOMParser_proto.parseFromString;
// Firefox/Opera/IE throw errors on unsupported types
try {
@@ -32,15 +30,12 @@
DOMParser_proto.parseFromString = function(markup, type) {
if (/^\s*text\/html\s*(?:;|$)/i.test(type)) {
- var
- doc = document.implementation.createHTMLDocument("")
- ;
- if (markup.toLowerCase().indexOf('<!doctype') > -1) {
- doc.documentElement.innerHTML = markup;
- }
- else {
- doc.body.innerHTML = markup;
- }
+ var doc = document.implementation.createHTMLDocument("");
+ if (markup.toLowerCase().indexOf('<!doctype') > -1) {
+ doc.documentElement.innerHTML = markup;
+ } else {
+ doc.body.innerHTML = markup;
+ }
return doc;
} else {
return real_parseFromString.apply(this, arguments);
diff --git a/core/src/OCP/loader.js b/core/src/OCP/loader.js
index 7b4e87dd9b4..d307eb27996 100644
--- a/core/src/OCP/loader.js
+++ b/core/src/OCP/loader.js
@@ -3,6 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+import { generateFilePath } from '@nextcloud/router'
+
const loadedScripts = {}
const loadedStylesheets = {}
/**
@@ -25,7 +27,7 @@ export default {
}
loadedScripts[key] = true
return new Promise(function(resolve, reject) {
- const scriptPath = OC.filePath(app, 'js', file)
+ const scriptPath = generateFilePath(app, 'js', file)
const script = document.createElement('script')
script.src = scriptPath
script.setAttribute('nonce', btoa(OC.requestToken))
@@ -49,7 +51,7 @@ export default {
}
loadedStylesheets[key] = true
return new Promise(function(resolve, reject) {
- const stylePath = OC.filePath(app, 'css', file)
+ const stylePath = generateFilePath(app, 'css', file)
const link = document.createElement('link')
link.href = stylePath
link.type = 'text/css'
diff --git a/core/src/install.js b/core/src/install.js
index 261cb4bedd7..ea2e2996a2a 100644
--- a/core/src/install.js
+++ b/core/src/install.js
@@ -5,6 +5,8 @@
import $ from 'jquery'
import { translate as t } from '@nextcloud/l10n'
+import { linkTo } from '@nextcloud/router'
+
import { getToken } from './OC/requesttoken.js'
import getURLParameter from './Util/get-url-parameter.js'
@@ -129,7 +131,7 @@ window.addEventListener('DOMContentLoaded', function() {
}
$('#adminpass').strengthify({
- zxcvbn: OC.linkTo('core', 'vendor/zxcvbn/dist/zxcvbn.js'),
+ zxcvbn: linkTo('core', 'vendor/zxcvbn/dist/zxcvbn.js'),
titles: [
t('core', 'Very weak password'),
t('core', 'Weak password'),
diff --git a/core/src/jquery/avatar.js b/core/src/jquery/avatar.js
index 826d94f7a08..3851a26ce31 100644
--- a/core/src/jquery/avatar.js
+++ b/core/src/jquery/avatar.js
@@ -3,10 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+import { getCurrentUser } from '@nextcloud/auth'
+import { generateUrl } from '@nextcloud/router'
import $ from 'jquery'
-import OC from '../OC/index.js'
-
/**
* This plugin inserts the right avatar for the user, depending on, whether a
* custom avatar is uploaded - which it uses then - or not, and display a
@@ -90,8 +90,8 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) {
let url
// If this is our own avatar we have to use the version attribute
- if (user === OC.getCurrentUser().uid) {
- url = OC.generateUrl(
+ if (user === getCurrentUser()?.uid) {
+ url = generateUrl(
'/avatar/{user}/{size}?v={version}',
{
user,
@@ -99,7 +99,7 @@ $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) {
version: oc_userconfig.avatar.version,
})
} else {
- url = OC.generateUrl(
+ url = generateUrl(
'/avatar/{user}/{size}',
{
user,
diff --git a/core/src/services/UnifiedSearchService.js b/core/src/services/UnifiedSearchService.js
index 1fa5cae8ef8..7067c994c90 100644
--- a/core/src/services/UnifiedSearchService.js
+++ b/core/src/services/UnifiedSearchService.js
@@ -82,7 +82,7 @@ export function search({ type, query, cursor, since, until, limit, person, extra
* Get the list of active contacts
*
* @param {object} filter filter contacts by string
- * @param filter.searchTerm
+ * @param {string} filter.searchTerm the query
* @return {object} {request: Promise}
*/
export async function getContacts({ searchTerm }) {
diff --git a/core/src/systemtags/systemtagmodel.js b/core/src/systemtags/systemtagmodel.js
index 349650e02be..1d2cd3ae57d 100644
--- a/core/src/systemtags/systemtagmodel.js
+++ b/core/src/systemtags/systemtagmodel.js
@@ -2,7 +2,7 @@
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
- * @param OC
+ * @param {object} OC The OC namespace
*/
(function(OC) {