Skip to content

Commit fe16c43

Browse files
ahornaceVladimir Kotal
authored andcommitted
Update jQuery to 3.5.1
1 parent f0c7371 commit fe16c43

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

opengrok-indexer/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
122122
<artifactId>jersey-hk2</artifactId>
123123
<version>${jersey.version}</version>
124124
</dependency>
125+
<dependency>
126+
<groupId>org.webjars</groupId>
127+
<artifactId>webjars-locator-core</artifactId>
128+
<version>0.30</version>
129+
</dependency>
125130
<dependency>
126131
<groupId>org.junit.jupiter</groupId>
127132
<artifactId>junit-jupiter-engine</artifactId>

opengrok-indexer/src/main/java/org/opengrok/indexer/web/Scripts.java

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.web;
@@ -31,6 +31,8 @@
3131
import java.util.TreeMap;
3232
import java.util.TreeSet;
3333

34+
import org.webjars.WebJarAssetLocator;
35+
3436
/**
3537
* A list-like container for javascripts in the page.
3638
*
@@ -39,6 +41,7 @@
3941
public class Scripts implements Iterable<Scripts.Script> {
4042

4143
private static final String DEBUG_SUFFIX = "-debug";
44+
private static final String WEBJAR_PATH_PREFIX = "META-INF/resources/";
4245

4346
enum Type {
4447
MINIFIED, DEBUG
@@ -86,27 +89,27 @@ public FileScript(String script, int priority) {
8689

8790
@Override
8891
public String toHtml() {
89-
StringBuilder builder = new StringBuilder();
90-
builder.append("\t<script type=\"text/javascript\" src=\"");
91-
builder.append(this.getScriptData());
92-
builder.append("\" data-priority=\"");
93-
builder.append(this.getPriority());
94-
builder.append("\"></script>\n");
95-
return builder.toString();
92+
return "\t<script type=\"text/javascript\" src=\"" +
93+
this.getScriptData() +
94+
"\" data-priority=\"" +
95+
this.getPriority() +
96+
"\"></script>\n";
9697
}
9798

9899
}
99100

100101
protected static final Map<String, Script> SCRIPTS = new TreeMap<>();
101102

103+
private static final WebJarAssetLocator assetLocator = new WebJarAssetLocator();
104+
102105
/**
103106
* Aliases for the page scripts. The path in the FileScript is relatively to
104107
* the request's context path.
105108
*
106109
* @see HttpServletRequest#getContextPath()
107110
*/
108111
static {
109-
putjs("jquery", "js/jquery-3.4.1", 10);
112+
putFromWebJar("jquery", "jquery.min.js", 10);
110113
putjs("jquery-ui", "js/jquery-ui-1.12.1-custom", 11);
111114
putjs("jquery-tablesorter", "js/jquery-tablesorter-2.31.3", 12);
112115
putjs("tablesorter-parsers", "js/tablesorter-parsers-0.0.2", 13, true);
@@ -128,6 +131,14 @@ private static void putjs(String key, String pathPrefix, int priority, boolean d
128131
}
129132
}
130133

134+
private static void putFromWebJar(String key, String fileName, int priority) {
135+
String path = assetLocator.getFullPath(fileName);
136+
if (path.startsWith(WEBJAR_PATH_PREFIX)) {
137+
path = path.substring(WEBJAR_PATH_PREFIX.length());
138+
}
139+
SCRIPTS.put(key, new FileScript(path, priority));
140+
}
141+
131142
private static final Comparator<Script> SCRIPTS_COMPARATOR = Comparator
132143
.comparingInt(Script::getPriority)
133144
.thenComparing(Script::getScriptData);

opengrok-indexer/src/main/java/org/opengrok/indexer/web/messages/Message.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.indexer.web.messages;
2424

@@ -80,6 +80,7 @@ public String toString() {
8080
return messageLevelString;
8181
}
8282

83+
@SuppressWarnings("rawtypes")
8384
public static final Comparator<MessageLevel> VALUE_COMPARATOR = Comparator.comparingInt(Enum::ordinal);
8485
}
8586

opengrok-web/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
115115
<artifactId>activation</artifactId>
116116
<version>1.1</version>
117117
</dependency>
118+
<dependency>
119+
<groupId>org.webjars</groupId>
120+
<artifactId>jquery</artifactId>
121+
<version>3.5.1</version>
122+
</dependency>
118123
<dependency>
119124
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
120125
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>

opengrok-web/src/main/webapp/js/jquery-3.4.1.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)