Skip to content

Commit 72b7d22

Browse files
author
Sven Fehler
authored
Merge pull request #143 from Sv443/wip/2.2.1
2 parents d8848db + 156082d commit 72b7d22

File tree

10 files changed

+148
-74
lines changed

10 files changed

+148
-74
lines changed

.vscode/settings.json

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,78 @@
11
{
22
"highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
3-
"(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
4-
{
5-
"color": "orange",
6-
"fontStyle": "italic",
7-
"outline": "1px solid orange"
8-
}
9-
],
10-
"(jsl\\.unused\\([a-zA-Z_\\\",\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
3+
"(jsl\\.unused\\([a-zA-Z_,\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
114
{
125
"backgroundColor": "rgba(0, 0, 0, 0.2)",
136
"color": "#f88"
147
}
158
],
16-
"(#MARKER)": [ //#MARKER test
9+
"(#MARKER)": [ // #MARKER test
1710
{
1811
"backgroundColor": "#f41",
1912
"color": "#fff",
2013
"isWholeLine": true,
2114
"overviewRulerColor": "#f41"
2215
}
2316
],
24-
"(#SECTION [a-zA-Z0-9_-,]+)": [ //#SECTION test, foo bar
17+
"(#SECTION ([^\\S\\r\\n]*\\w+)*[:]*)": [ // #SECTION test
2518
{
2619
"backgroundColor": "#44f",
2720
"color": "white",
2821
"overviewRulerColor": "#44f"
2922
}
3023
],
31-
"(#DEBUG)": [ //#DEBUG
24+
"(#DEBUG#)": [ // #DEBUG#
3225
{
3326
"backgroundColor": "#ff0",
3427
"color": "blue",
3528
"overviewRulerColor": "#ff0"
3629
}
37-
],
38-
"(?<!\\w)(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|rgba?\\s*\\([^)]*?\\)|hsla?\\s*\\([^)]*?\\)|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyanaqua|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|tan|teal|thistle|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)(?!\\w)": [
39-
{
40-
"rangeBehavior": 1,
41-
"borderWidth": "1px",
42-
"borderColor": "$1",
43-
"borderStyle": "solid"
44-
}
4530
]
4631
},
32+
// "highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
33+
// "(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
34+
// {
35+
// "color": "orange",
36+
// "fontStyle": "italic",
37+
// "outline": "1px solid orange"
38+
// }
39+
// ],
40+
// "(jsl\\.unused\\([a-zA-Z_\\\",\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
41+
// {
42+
// "backgroundColor": "rgba(0, 0, 0, 0.2)",
43+
// "color": "#f88"
44+
// }
45+
// ],
46+
// "(#MARKER)": [ //#MARKER test
47+
// {
48+
// "backgroundColor": "#f41",
49+
// "color": "#fff",
50+
// "isWholeLine": true,
51+
// "overviewRulerColor": "#f41"
52+
// }
53+
// ],
54+
// "(#SECTION [a-zA-Z0-9_-,]+)": [ //#SECTION test, foo bar
55+
// {
56+
// "backgroundColor": "#44f",
57+
// "color": "white",
58+
// "overviewRulerColor": "#44f"
59+
// }
60+
// ],
61+
// "(#DEBUG)": [ //#DEBUG
62+
// {
63+
// "backgroundColor": "#ff0",
64+
// "color": "blue",
65+
// "overviewRulerColor": "#ff0"
66+
// }
67+
// ],
68+
// "(?<!\\w)(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|rgba?\\s*\\([^)]*?\\)|hsla?\\s*\\([^)]*?\\)|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyanaqua|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|tan|teal|thistle|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)(?!\\w)": [
69+
// {
70+
// "rangeBehavior": 1,
71+
// "borderWidth": "1px",
72+
// "borderColor": "$1",
73+
// "borderStyle": "solid"
74+
// }
75+
// ]
76+
// },
4777
"npm-scripts.showStartNotification": false
4878
}

changelog.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@
1111
- Serve docs with nginx to speed up page load times (issue #118)
1212

1313

14-
[CURRENT: 2.2.0]
14+
[CURRENT: 2.2.1] - Version 2.2 Hotfix
15+
- Added the Czech translation (PR #137) - provided by @ThatCopy (https://github.com/ThatCopy) - thanks :)
16+
- Added a missing conversion mapping when using format `txt` and the `amount` parameter on endpoint `/joke` (issue #138)
17+
- Fixed wrong URLs in the documentation's JavaScript
18+
- Fixed crash when a client asks for a translation that doesn't exist
19+
- Slightly improved the documentation
20+
- Applied a few security patches
21+
22+
23+
[2.2.0]
1524
- Added joke category "Pun" (issue #105)
1625
- Added "?amount" parameter to joke endpoint so multiple jokes can be fetched at once (issue #126)
1726
- Added support for jokes and error messages of different languages (issue #75)

docs/raw/index.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,6 @@ textarea {
932932
}
933933

934934
#tryItFormLatency {
935-
margin-top: 5px;
936935
font-size: 90%;
937936
}
938937

@@ -988,6 +987,12 @@ input[disabled]+label {
988987
#urlBuilderWrapper {
989988
display: inline-block;
990989
margin-bottom: 12px;
990+
font-size: 16px;
991+
}
992+
993+
#urlBuilderWrapper button {
994+
font-size: 17px;
995+
padding: 3px 8px 3px 8px;
991996
}
992997

993998
#urlBuilderUrl {

docs/raw/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<link rel="icon" type="image/png" href="./favicon.ico">
3939

4040
<!-- IE detection -->
41-
<script src="https://sv443.net/cdn/jokeapi/isIE.js" integrity="sha512-SibQCccl2OYEcFF7u++aXdsyBuL0syy24w+arsjj9sPdtvRUKVJHVUq5gGT/AjvDXrNlWZ2tZq9GbVelt2c7eQ==" crossorigin="anonymous"></script>
41+
<script src="https://sv443.net/cdn/jokeapi/isIE.js"></script>
4242

4343
<!-- #MARKER dependencies -->
4444
<!-- Have to do it like this because the page doesn't always have a trailing slash and that *somehow* makes it redirect to the page root: -->
4545
<!-- <link rel="stylesheet" href="<!--%#INSERT:DOCSURL#%--><!--/static/index.css"-->
4646
<link rel="stylesheet" href="static/index.css">
4747

48-
<script src="https://cdn.jsdelivr.net/gh/Sv443/jslib@1.5.0/jslib.js" integrity="sha512-jTdPVbIEUKKGdPFXb9+713FOD/Twcf9h9MeeKF/psBbpSzseYH8KmJuCsQ3qQHWQcA93UVQGG51651pB/h44ew==" crossorigin="anonymous"></script>
48+
<script src="https://cdn.jsdelivr.net/gh/Sv443/jslib@1.5.0/jslib.js"></script>
4949

5050
<!-- Have to do it like this because the page doesn't always have a trailing slash and that *somehow* makes it redirect to the page root: -->
5151
<!-- <script src="<!--%#INSERT:DOCSURL#%--><!--/static/index.js"></script-->
@@ -318,12 +318,13 @@ <h2 style="color: orangered;">By using this website and API you are agreeing to
318318
<br><br><br><br>
319319
<div id="urlBuilderWrapper" class="flexItem">
320320
URL: <span id="urlBuilderUrl">(Loading...)</span><br>
321-
<button onclick="resetTryItForm()">Reset Form</button> <button onclick="sendTryItRequest()">Send Request &gt;</button>
321+
<button onclick="resetTryItForm(true)">Reset Form</button> <button onclick="sendTryItRequest()">Send Request &gt;</button>
322322
</div>
323323
<code id="urlBuilderPrettyprint" class="lang-json flexItem r"><span class="nocode codeheader">Result:</span>
324324
<div class="actualCode" id="tryItResult">(Set parameters and click "Send Request" above)</div>
325325
</code>
326-
<span id="tryItFormLatency"></span>
326+
<br>
327+
<span id="tryItFormLatency"></span>
327328
</div>
328329

329330

docs/raw/index.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use strict";
22

33
var settings = {
4-
// baseURL: "<!--%#INSERT:DOCSURL#%-->",
5-
baseURL: "http://127.0.0.1:8076/", // DEBUG
4+
baseURL: "<!--%#INSERT:DOCSURL#%-->",
5+
// baseURL: "http://127.0.0.1:8076/", // DEBUG
66
jokeEndpoint: "joke",
77
anyCategoryName: "Any",
88
defaultFormat: "json",
9-
// submitUrl: "<!--%#INSERT:DOCSURL#%-->/submit",
10-
submitUrl: "http://127.0.0.1:8076/submit",
9+
submitUrl: "<!--%#INSERT:DOCSURL#%-->/submit",
10+
// submitUrl: "http://127.0.0.1:8076/submit",
1111
defaultLang: "en",
1212
formatVersion: 3
1313
};
@@ -753,8 +753,11 @@ function sendTryItRequest()
753753
}
754754

755755
//#MARKER interactive elements
756-
function resetTryItForm()
756+
function resetTryItForm(confirmation)
757757
{
758+
if(confirmation === true && !confirm("Do you really want to reset the form?"))
759+
return;
760+
758761
["cat-cb1", "cat-cb2", "cat-cb3", "cat-cb4"].forEach(function(cat) {
759762
gebid(cat).checked = false;
760763
});
@@ -778,6 +781,8 @@ function resetTryItForm()
778781

779782
gebid("jokesAmountInput").value = 1;
780783

784+
gebid("lcodeSelect").value = settings.defaultLang;
785+
781786
reRender();
782787
}
783788

@@ -796,7 +801,16 @@ function submitJoke()
796801
xhr.onreadystatechange = function() {
797802
if(xhr.readyState == 4)
798803
{
799-
var res = JSON.parse(xhr.responseText);
804+
var res;
805+
try
806+
{
807+
res = JSON.parse(xhr.responseText);
808+
}
809+
catch(err)
810+
{
811+
alert("Error " + res.status + " while sending your submission:\n" + res.message + (res.additionalInfo ? "\n\nAdditional info:\n" + res.additionalInfo : ""));
812+
return;
813+
}
800814

801815
if(xhr.status < 300)
802816
{

package-lock.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)