Skip to content

Commit

Permalink
Update jQuery to 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ahornace authored and Vladimir Kotal committed Oct 8, 2020
1 parent f0c7371 commit fe16c43
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
5 changes: 5 additions & 0 deletions opengrok-indexer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
<version>0.30</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

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

import org.webjars.WebJarAssetLocator;

/**
* A list-like container for javascripts in the page.
*
Expand All @@ -39,6 +41,7 @@
public class Scripts implements Iterable<Scripts.Script> {

private static final String DEBUG_SUFFIX = "-debug";
private static final String WEBJAR_PATH_PREFIX = "META-INF/resources/";

enum Type {
MINIFIED, DEBUG
Expand Down Expand Up @@ -86,27 +89,27 @@ public FileScript(String script, int priority) {

@Override
public String toHtml() {
StringBuilder builder = new StringBuilder();
builder.append("\t<script type=\"text/javascript\" src=\"");
builder.append(this.getScriptData());
builder.append("\" data-priority=\"");
builder.append(this.getPriority());
builder.append("\"></script>\n");
return builder.toString();
return "\t<script type=\"text/javascript\" src=\"" +
this.getScriptData() +
"\" data-priority=\"" +
this.getPriority() +
"\"></script>\n";
}

}

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

private static final WebJarAssetLocator assetLocator = new WebJarAssetLocator();

/**
* Aliases for the page scripts. The path in the FileScript is relatively to
* the request's context path.
*
* @see HttpServletRequest#getContextPath()
*/
static {
putjs("jquery", "js/jquery-3.4.1", 10);
putFromWebJar("jquery", "jquery.min.js", 10);
putjs("jquery-ui", "js/jquery-ui-1.12.1-custom", 11);
putjs("jquery-tablesorter", "js/jquery-tablesorter-2.31.3", 12);
putjs("tablesorter-parsers", "js/tablesorter-parsers-0.0.2", 13, true);
Expand All @@ -128,6 +131,14 @@ private static void putjs(String key, String pathPrefix, int priority, boolean d
}
}

private static void putFromWebJar(String key, String fileName, int priority) {
String path = assetLocator.getFullPath(fileName);
if (path.startsWith(WEBJAR_PATH_PREFIX)) {
path = path.substring(WEBJAR_PATH_PREFIX.length());
}
SCRIPTS.put(key, new FileScript(path, priority));
}

private static final Comparator<Script> SCRIPTS_COMPARATOR = Comparator
.comparingInt(Script::getPriority)
.thenComparing(Script::getScriptData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

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

Expand Down Expand Up @@ -80,6 +80,7 @@ public String toString() {
return messageLevelString;
}

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

Expand Down
5 changes: 5 additions & 0 deletions opengrok-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
Expand Down
2 changes: 0 additions & 2 deletions opengrok-web/src/main/webapp/js/jquery-3.4.1.min.js

This file was deleted.

0 comments on commit fe16c43

Please sign in to comment.