-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththymol-pre.js
84 lines (77 loc) · 3.18 KB
/
thymol-pre.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*-------------------- Thymol - the flavour of Thymeleaf --------------------*
Thymol version 2.0.1-pre.7 Copyright (C) 2012-2020 James J. Benson
jjbenson .AT. users.sf.net (http://www.thymoljs.org/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
See the License for the specific language governing permissions and
limitations under the License.
*---------------------------------------------------------------------------*/
(function() {
var thymolConfiguration = {
thScriptName: "thymol-pre-full.js",
thJQuerySource: "https://cdn.jsdelivr.net/jquery/latest/jquery.min.js",
thDefaultPrefix: "th",
thDefaultDataPrefix: "data",
thDefaultPrecision: 10,
thDefaultProtocol: "file:///",
thDefaultLocale: "en",
thDefaultPrecedence: 2e4,
// IntelliJ IDEA server path
thDefaultMessagePath: "./i18n/",
thDefaultResourcePath: "",
thDefaultMessagesBaseName: "messages",
thDefaultRelativeRootPath: "/",
thDefaultExtendedMapping: false,
thDefaultLocalMessages: true,
thDefaultDisableMessages: false,
thDefaultTemplateSuffix: ".html",
thDefaultInlineQuote: "'"
};
thymol = function(conf) {
conf.ready = function(func) {
if (typeof thymolDeferredFunctions === "undefined" || thymolDeferredFunctions === null) {
thymolDeferredFunctions = [];
}
thymolDeferredFunctions.push(func);
};
return conf;
}(thymolConfiguration);
thymol.thWindow = window;
var toc = 0;
var loadScript = function(script, params) {
var el = document.createElement("script");
el.async = false;
if (typeof script !== "undefined" && script !== null) {
el.src = script;
}
if (typeof params !== "undefined" && params !== null) {
el.src += params.charAt(0) === "?" ? params : "?" + params;
}
el.type = "text/javascript";
(document.getElementsByTagName("HEAD")[0] || document.body).appendChild(el);
};
var scripts = document.getElementsByTagName("script");
var script = document.currentScript || scripts[scripts.length - 1];
var scriptSrc = script.getAttribute("src");
var pathEnd = scriptSrc.lastIndexOf("/");
if (pathEnd >= 0) {
thymol.thLocation = scriptSrc.substring(0, 1 + pathEnd);
}
var thymolSrc = script.getAttribute("data-thymol-src");
if (!!thymolSrc) {
thymol.thScriptName = thymolSrc;
}
var parameters = null;
for (var i = 0, iLimit = scripts.length; i < iLimit; i++) {
parameters = scripts[i].getAttribute("data-thymol-parameters");
if (!!parameters) {
break;
}
}
loadScript(thymol.thLocation + thymol.thScriptName, parameters);
})();