Skip to content

Commit

Permalink
Merge pull request #143 from Sv443/wip/2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fehler authored Aug 10, 2020
2 parents d8848db + 156082d commit 72b7d22
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 74 deletions.
68 changes: 49 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,78 @@
{
"highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
"(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
{
"color": "orange",
"fontStyle": "italic",
"outline": "1px solid orange"
}
],
"(jsl\\.unused\\([a-zA-Z_\\\",\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
"(jsl\\.unused\\([a-zA-Z_,\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
{
"backgroundColor": "rgba(0, 0, 0, 0.2)",
"color": "#f88"
}
],
"(#MARKER)": [ //#MARKER test
"(#MARKER)": [ // #MARKER test
{
"backgroundColor": "#f41",
"color": "#fff",
"isWholeLine": true,
"overviewRulerColor": "#f41"
}
],
"(#SECTION [a-zA-Z0-9_-,]+)": [ //#SECTION test, foo bar
"(#SECTION ([^\\S\\r\\n]*\\w+)*[:]*)": [ // #SECTION test
{
"backgroundColor": "#44f",
"color": "white",
"overviewRulerColor": "#44f"
}
],
"(#DEBUG)": [ //#DEBUG
"(#DEBUG#)": [ // #DEBUG#
{
"backgroundColor": "#ff0",
"color": "blue",
"overviewRulerColor": "#ff0"
}
],
"(?<!\\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)": [
{
"rangeBehavior": 1,
"borderWidth": "1px",
"borderColor": "$1",
"borderStyle": "solid"
}
]
},
// "highlight.regexes": { // REQUIRES EXTENSION: fabiospampinato.vscode-highlight
// "(<!--%#INSERT:[a-zA-Z0-9\\-]+#%-->|<!--%#INJECT:[a-zA-Z0-9\\-]+#%-->)": [ // <!--%#INSERT:TEST#%--> / <!--%#INJECT:TEST#%-->
// {
// "color": "orange",
// "fontStyle": "italic",
// "outline": "1px solid orange"
// }
// ],
// "(jsl\\.unused\\([a-zA-Z_\\\",\\[\\]\\s]+\\);*)": [ // jsl.unused([some_var, some_other_var]);
// {
// "backgroundColor": "rgba(0, 0, 0, 0.2)",
// "color": "#f88"
// }
// ],
// "(#MARKER)": [ //#MARKER test
// {
// "backgroundColor": "#f41",
// "color": "#fff",
// "isWholeLine": true,
// "overviewRulerColor": "#f41"
// }
// ],
// "(#SECTION [a-zA-Z0-9_-,]+)": [ //#SECTION test, foo bar
// {
// "backgroundColor": "#44f",
// "color": "white",
// "overviewRulerColor": "#44f"
// }
// ],
// "(#DEBUG)": [ //#DEBUG
// {
// "backgroundColor": "#ff0",
// "color": "blue",
// "overviewRulerColor": "#ff0"
// }
// ],
// "(?<!\\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)": [
// {
// "rangeBehavior": 1,
// "borderWidth": "1px",
// "borderColor": "$1",
// "borderStyle": "solid"
// }
// ]
// },
"npm-scripts.showStartNotification": false
}
11 changes: 10 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
- Serve docs with nginx to speed up page load times (issue #118)


[CURRENT: 2.2.0]
[CURRENT: 2.2.1] - Version 2.2 Hotfix
- Added the Czech translation (PR #137) - provided by @ThatCopy (https://github.com/ThatCopy) - thanks :)
- Added a missing conversion mapping when using format `txt` and the `amount` parameter on endpoint `/joke` (issue #138)
- Fixed wrong URLs in the documentation's JavaScript
- Fixed crash when a client asks for a translation that doesn't exist
- Slightly improved the documentation
- Applied a few security patches


[2.2.0]
- Added joke category "Pun" (issue #105)
- Added "?amount" parameter to joke endpoint so multiple jokes can be fetched at once (issue #126)
- Added support for jokes and error messages of different languages (issue #75)
Expand Down
7 changes: 6 additions & 1 deletion docs/raw/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,6 @@ textarea {
}

#tryItFormLatency {
margin-top: 5px;
font-size: 90%;
}

Expand Down Expand Up @@ -988,6 +987,12 @@ input[disabled]+label {
#urlBuilderWrapper {
display: inline-block;
margin-bottom: 12px;
font-size: 16px;
}

#urlBuilderWrapper button {
font-size: 17px;
padding: 3px 8px 3px 8px;
}

#urlBuilderUrl {
Expand Down
9 changes: 5 additions & 4 deletions docs/raw/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<link rel="icon" type="image/png" href="./favicon.ico">

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

<!-- #MARKER dependencies -->
<!-- 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: -->
<!-- <link rel="stylesheet" href="<!--%#INSERT:DOCSURL#%--><!--/static/index.css"-->
<link rel="stylesheet" href="static/index.css">

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

<!-- 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: -->
<!-- <script src="<!--%#INSERT:DOCSURL#%--><!--/static/index.js"></script-->
Expand Down Expand Up @@ -318,12 +318,13 @@ <h2 style="color: orangered;">By using this website and API you are agreeing to
<br><br><br><br>
<div id="urlBuilderWrapper" class="flexItem">
URL: <span id="urlBuilderUrl">(Loading...)</span><br>
<button onclick="resetTryItForm()">Reset Form</button> <button onclick="sendTryItRequest()">Send Request &gt;</button>
<button onclick="resetTryItForm(true)">Reset Form</button> <button onclick="sendTryItRequest()">Send Request &gt;</button>
</div>
<code id="urlBuilderPrettyprint" class="lang-json flexItem r"><span class="nocode codeheader">Result:</span>
<div class="actualCode" id="tryItResult">(Set parameters and click "Send Request" above)</div>
</code>
<span id="tryItFormLatency"></span>
<br>
<span id="tryItFormLatency"></span>
</div>


Expand Down
26 changes: 20 additions & 6 deletions docs/raw/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";

var settings = {
// baseURL: "<!--%#INSERT:DOCSURL#%-->",
baseURL: "http://127.0.0.1:8076/", // DEBUG
baseURL: "<!--%#INSERT:DOCSURL#%-->",
// baseURL: "http://127.0.0.1:8076/", // DEBUG
jokeEndpoint: "joke",
anyCategoryName: "Any",
defaultFormat: "json",
// submitUrl: "<!--%#INSERT:DOCSURL#%-->/submit",
submitUrl: "http://127.0.0.1:8076/submit",
submitUrl: "<!--%#INSERT:DOCSURL#%-->/submit",
// submitUrl: "http://127.0.0.1:8076/submit",
defaultLang: "en",
formatVersion: 3
};
Expand Down Expand Up @@ -753,8 +753,11 @@ function sendTryItRequest()
}

//#MARKER interactive elements
function resetTryItForm()
function resetTryItForm(confirmation)
{
if(confirmation === true && !confirm("Do you really want to reset the form?"))
return;

["cat-cb1", "cat-cb2", "cat-cb3", "cat-cb4"].forEach(function(cat) {
gebid(cat).checked = false;
});
Expand All @@ -778,6 +781,8 @@ function resetTryItForm()

gebid("jokesAmountInput").value = 1;

gebid("lcodeSelect").value = settings.defaultLang;

reRender();
}

Expand All @@ -796,7 +801,16 @@ function submitJoke()
xhr.onreadystatechange = function() {
if(xhr.readyState == 4)
{
var res = JSON.parse(xhr.responseText);
var res;
try
{
res = JSON.parse(xhr.responseText);
}
catch(err)
{
alert("Error " + res.status + " while sending your submission:\n" + res.message + (res.additionalInfo ? "\n\nAdditional info:\n" + res.additionalInfo : ""));
return;
}

if(xhr.status < 300)
{
Expand Down
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 72b7d22

Please sign in to comment.