Move 'use strict' to file level
Change-Id: I1f0dae4aa168e77c112bcd3688c98b84e4ce5f36
diff --git a/Changes b/Changes
index 73d083d..bfc13aa 100755
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.40 2020-10-20
+0.40 2020-11-10
- Modernize ES and fix in-loops.
- add roll() method to state object.
- Fix wrong hint-mirror behaviour in Firefox.
@@ -7,6 +7,7 @@
- Improve JS test coverage for Datepicker.
- Fix character errors in hint helper at position 0.
- Improve JS test coverage for tutorial.
+ - Move "use strict" to file level.
0.39 2020-10-07
- Add information on secret file to Readme.
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index 8eeedf4..75a4e68 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -1,5 +1,6 @@
+"use strict";
+
define(['util'], function () {
- "use strict";
// TODO:
// - https://github.com/honza/140medley/blob/master/140medley.js
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 7c8d8c6..0ea1d38 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -1,5 +1,6 @@
+"use strict";
+
define(['buttongroup/menu','menu/item','util'], function (treeMenuClass, defaultItemClass) {
- "use strict";
return {
/**
diff --git a/dev/js/src/buttongroup/menu.js b/dev/js/src/buttongroup/menu.js
index 3ee7ec3..da34584 100644
--- a/dev/js/src/buttongroup/menu.js
+++ b/dev/js/src/buttongroup/menu.js
@@ -1,8 +1,8 @@
- /**
- * Menu to choose from in a button group.
- */
+/**
+ * Menu to choose from in a button group.
+ */
+"use strict";
define(['menu'], function (menuClass) {
- "use strict";
return {
diff --git a/dev/js/src/datepicker.js b/dev/js/src/datepicker.js
index 8d79bdb..61f6a8b 100644
--- a/dev/js/src/datepicker.js
+++ b/dev/js/src/datepicker.js
@@ -4,9 +4,9 @@
*
* @author Nils Diewald
*/
-define(['util'], function () {
+"use strict";
- "use strict";
+define(['util'], function () {
KorAP._validDateMatchRE = new RegExp("^(?:[lg]?eq|ne)$");
KorAP._validDateRE = new RegExp("^(?:\\d{4})(?:-\\d\\d(?:-\\d\\d)?)?$");
diff --git a/dev/js/src/hint/foundries/mate.js b/dev/js/src/hint/foundries/mate.js
index c7cd2e9..e022664 100644
--- a/dev/js/src/hint/foundries/mate.js
+++ b/dev/js/src/hint/foundries/mate.js
@@ -1,10 +1,12 @@
+"use strict";
+
define(["hint/foundries","hint/foundries/stts"], function (ah, sttsArray) {
- var mateSttsArray = sttsArray.slice(0);
+ let mateSttsArray = sttsArray.slice(0);
mateSttsArray.push(
["<root-POS>","<root-POS>","Root Part of Speech"]
);
- var ah = KorAP.annotationHelper = KorAP.annotationHelper || { "-" : [] };
+ let ah = KorAP.annotationHelper = KorAP.annotationHelper || { "-" : [] };
ah["-"].push(
["Mate", "mate/", "Lemma, Morphology, Part-of-Speech"]
diff --git a/dev/js/src/hint/foundries/schreibgebrauch.js b/dev/js/src/hint/foundries/schreibgebrauch.js
index 29eed70..297840a 100644
--- a/dev/js/src/hint/foundries/schreibgebrauch.js
+++ b/dev/js/src/hint/foundries/schreibgebrauch.js
@@ -1,5 +1,5 @@
define(["hint/foundries","hint/foundries/stts"], function (ah, sttsArray) {
- var sgbrSttsArray = sttsArray.slice(0);
+ let sgbrSttsArray = sttsArray.slice(0);
// Push specific information for Schreibgebrauch
sgbrSttsArray.push(
diff --git a/dev/js/src/hint/item.js b/dev/js/src/hint/item.js
index 80ac78b..2fcecee 100644
--- a/dev/js/src/hint/item.js
+++ b/dev/js/src/hint/item.js
@@ -1,6 +1,8 @@
/**
* Hint menu item based on MenuItem
*/
+"use strict";
+
define(['menu/item', 'util'], function (itemClass) {
return {
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index df56b80..58c6472 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -15,6 +15,7 @@
* - obj.alignment() // toggle
*/
+"use strict";
define([
'match',
'hint',
diff --git a/dev/js/src/loc/de.js b/dev/js/src/loc/de.js
index d42af7f..21bf629 100644
--- a/dev/js/src/loc/de.js
+++ b/dev/js/src/loc/de.js
@@ -1,3 +1,5 @@
+"use strict";
+
define(function () {
const loc = KorAP.Locale;
loc.OR = 'oder';
diff --git a/dev/js/src/loc/dereko.js b/dev/js/src/loc/dereko.js
index 9f08470..2cdae7d 100644
--- a/dev/js/src/loc/dereko.js
+++ b/dev/js/src/loc/dereko.js
@@ -4,6 +4,8 @@
* @author Helge Stallkamp
*/
+"use strict";
+
define(['vc', 'vc/doc'], function (vcClass, docClass) {
const loc = KorAP.Locale;
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 761b916..52dffce 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -9,6 +9,8 @@
* - Scroll to match vertically per default
* - A click on a table field and a tree node should at the field description to the fragments list.
*/
+
+"use strict";
define([
'buttongroup',
'panel/match',
diff --git a/dev/js/src/match/attachement.js b/dev/js/src/match/attachement.js
index 9211728..70a2a20 100644
--- a/dev/js/src/match/attachement.js
+++ b/dev/js/src/match/attachement.js
@@ -9,9 +9,9 @@
*
* @author Nils Diewald
*/
-define(function () {
+"use strict";
- "use strict";
+define(function () {
const uriRE = new RegExp("^data: *([^;,]*?(?: *; *[^,;]+?)*) *, *(.+)$");
const mapRE = new RegExp("^ *([^=]+?) *= *(.+?) *$");
diff --git a/dev/js/src/match/corpusByMatch.js b/dev/js/src/match/corpusByMatch.js
index 6d5baa5..cc2ae2f 100644
--- a/dev/js/src/match/corpusByMatch.js
+++ b/dev/js/src/match/corpusByMatch.js
@@ -1,6 +1,6 @@
-define(['vc/fragment', 'util'], function (vcFragmentClass) {
+"use strict";
- "use strict";
+define(['vc/fragment', 'util'], function (vcFragmentClass) {
return {
diff --git a/dev/js/src/match/infolayer.js b/dev/js/src/match/infolayer.js
index 8d28286..88404d5 100644
--- a/dev/js/src/match/infolayer.js
+++ b/dev/js/src/match/infolayer.js
@@ -2,8 +2,9 @@
* Object representing information
* about a match's layer annotation.
*/
+"use strict";
+
define(function () {
- "use strict";
const _AvailableRE =
new RegExp("^([^\/]+?)\/([^=]+?)(?:=(spans|rels|tokens))?$");
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 9c4dfb1..2df6a58 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -1,6 +1,6 @@
-define(['match/corpusByMatch','match/attachement','util'], function (cbmClass, attClass) {
+"use strict";
- "use strict";
+define(['match/corpusByMatch','match/attachement','util'], function (cbmClass, attClass) {
// Localization values
const loc = KorAP.Locale;
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index bfb6f09..b7d54fc 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -5,8 +5,9 @@
*
* @author Nils Diewald
*/
+"use strict";
+
define(['util'], function () {
- "use strict";
/*
* TODO:
diff --git a/dev/js/src/match/table.js b/dev/js/src/match/table.js
index 285e615..9481728 100644
--- a/dev/js/src/match/table.js
+++ b/dev/js/src/match/table.js
@@ -2,11 +2,12 @@
* Table representation of token-based
* annotations of a match.
*/
+"use strict";
+
define([
'match/querycreator',
"util"
], function (matchQueryCreator) {
- "use strict";
/*
* TODO:
diff --git a/dev/js/src/match/treearc.js b/dev/js/src/match/treearc.js
index 6e7c01c..117936c 100644
--- a/dev/js/src/match/treearc.js
+++ b/dev/js/src/match/treearc.js
@@ -3,9 +3,9 @@
*
* @author Nils Diewald
*/
+"use strict";
define([], function () {
- "use strict";
const svgNS = "http://www.w3.org/2000/svg";
const _TermRE = new RegExp("^(?:([^\/]+?)\/)?([^:]+?):(.+?)$");
diff --git a/dev/js/src/match/treehierarchy.js b/dev/js/src/match/treehierarchy.js
index e54ef29..5273089 100644
--- a/dev/js/src/match/treehierarchy.js
+++ b/dev/js/src/match/treehierarchy.js
@@ -4,8 +4,9 @@
*
* This should be lazy loaded!
*/
+"use strict";
+
define(['lib/dagre'], function (dagre) {
- "use strict";
const d = document;
const svgNS = "http://www.w3.org/2000/svg";
diff --git a/dev/js/src/match/treeitem.js b/dev/js/src/match/treeitem.js
index 422f3d7..0d36724 100644
--- a/dev/js/src/match/treeitem.js
+++ b/dev/js/src/match/treeitem.js
@@ -1,5 +1,6 @@
+"use strict";
+
define(['menu/item'], function (itemClass) {
- "use strict";
/**
* Menu item for tree view choice.
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index ecce23b..9d3c44e 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -14,6 +14,8 @@
* TODO: Add static header (for title, sortation fields, but also for menu points like "fragments" and "history".
* TODO: Support space separated list of prefixes so "co no" will highlight "common noun"
*/
+
+"use strict";
define([
'menu/item',
'menu/prefix',
@@ -25,8 +27,6 @@
defaultLengthFieldClass,
sliderClass) {
- "use strict";
-
// Default maximum number of menu items
const menuLimit = 8;
diff --git a/dev/js/src/plugin/client.js b/dev/js/src/plugin/client.js
index 2f34c4e..6d55d25 100644
--- a/dev/js/src/plugin/client.js
+++ b/dev/js/src/plugin/client.js
@@ -23,11 +23,11 @@
* demand using integrity check:
* https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
*/
+"use strict";
-var cs = document.currentScript;
+const cs = document.currentScript;
(function () {
- "use strict";
// Similar to randomID in server, but a bit cheaper
function randomID () {
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 96b5cb7..19f8c5f 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -7,9 +7,9 @@
*
* @author Nils Diewald
*/
+"use strict";
define(['plugin/widget', 'plugin/service', 'state', 'util'], function (widgetClass, serviceClass, stateClass) {
- "use strict";
KorAP.Panel = KorAP.Panel || {};
diff --git a/dev/js/src/plugin/service.js b/dev/js/src/plugin/service.js
index 3a39c4d..a76b2e4 100644
--- a/dev/js/src/plugin/service.js
+++ b/dev/js/src/plugin/service.js
@@ -1,5 +1,6 @@
+"use strict";
+
define(function () {
- "use strict";
// Limit the supported sandbox permissions, especially
// to disallow 'same-origin'.
diff --git a/dev/js/src/plugin/widget.js b/dev/js/src/plugin/widget.js
index 546cd1b..5f8ca9a 100644
--- a/dev/js/src/plugin/widget.js
+++ b/dev/js/src/plugin/widget.js
@@ -7,9 +7,9 @@
*
* @author Nils Diewald
*/
+"use strict";
define(["view","plugin/service","util"], function (viewClass, serviceClass) {
- "use strict";
return {
diff --git a/dev/js/src/selectMenu/item.js b/dev/js/src/selectMenu/item.js
index 3bd1406..b2ac071 100644
--- a/dev/js/src/selectMenu/item.js
+++ b/dev/js/src/selectMenu/item.js
@@ -1,3 +1,5 @@
+"use strict";
+
define(['menu/item'], function (itemClass) {
/**
* Menu item for select menus.
diff --git a/dev/js/src/tour/tours.js b/dev/js/src/tour/tours.js
index 808165b..4193f28 100644
--- a/dev/js/src/tour/tours.js
+++ b/dev/js/src/tour/tours.js
@@ -3,9 +3,10 @@
*
* @author Helge Stallkamp
*/
+"use strict";
-
-define(['lib/intro', 'vc', 'hint', 'menu', 'vc/doc', 'vc/docgroup'], function(introClass, vcClass, hintClass, menuClass, docClass, docGroup) {
+define(['lib/intro', 'vc', 'hint', 'menu', 'vc/doc', 'vc/docgroup'],
+ function(introClass, vcClass, hintClass, menuClass, docClass, docGroup) {
//needed for localization of labels and contents of the tour
const loc = KorAP.Locale;
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index 8e40c12..0fea33f 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -1,3 +1,5 @@
+"use strict";
+
window.KorAP = window.KorAP || {};
// Don't let events bubble up
diff --git a/dev/js/src/vc/docgroupref.js b/dev/js/src/vc/docgroupref.js
index 83ac244..9f1401a 100644
--- a/dev/js/src/vc/docgroupref.js
+++ b/dev/js/src/vc/docgroupref.js
@@ -2,6 +2,8 @@
* A reference to another VC.
* Inherits everything from jsonld
*/
+"use strict";
+
define([
'vc/jsonld',
'vc/rewritelist',
diff --git a/dev/js/src/view/match/relations.js b/dev/js/src/view/match/relations.js
index 1c9bdad..7e874fc 100644
--- a/dev/js/src/view/match/relations.js
+++ b/dev/js/src/view/match/relations.js
@@ -1,3 +1,5 @@
+"use strict";
+
define([
'view',
'match/treehierarchy',
diff --git a/dev/js/src/view/vc/corpstatv.js b/dev/js/src/view/vc/corpstatv.js
index e4aacb0..612c295 100644
--- a/dev/js/src/view/vc/corpstatv.js
+++ b/dev/js/src/view/vc/corpstatv.js
@@ -3,8 +3,8 @@
*
* @author Helge Stallkamp
*/
-
-define([ 'view', 'vc/statistic', 'buttongroup' ], function (viewClass, statClass, buttonGroup) {
+define(['view', 'vc/statistic', 'buttongroup'],
+ function (viewClass, statClass, buttonGroup) {
// Localization values
const loc = KorAP.Locale;
diff --git a/package.json b/package.json
index d158502..703962a 100755
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
"license": "BSD-2-Clause",
- "version": "0.40.2",
+ "version": "0.40.3",
"pluginVersion": "0.2.2",
"engines": {
"node": ">=6.0.0"