Commit 1da65e16 authored by Siltaar's avatar Siltaar
Browse files

mostly doc

parent 9c76b2ee
......@@ -17,7 +17,12 @@ It's currently presented as plain JavaScript files. To use it simply include
the following files in your environnement :
```html
<script src="month_nb_json.js" type="text/javascript"></script>
<script src="js/month_nb/month_nb.json" type="text/json" id="mnb_json_elt"></script>
<script type="text/javascript">
(function() {
const month_nb_json = JSON.parse(document.getElementById("mnb_json_elt").innerText);
})();
</script>
<script src="month_nb.js" type="text/javascript"></script>
```
......@@ -74,7 +79,7 @@ errors. More information can be displayed changing the default value of
arguments of the `test()` function in the `test_month_nb.js` file.
== Who use it ?
== Who uses it ?
`month_nb` have been initially developped for https://www.meta-press.es/[Meta-Press.es].
......
......@@ -32,6 +32,6 @@ page.injectJs('month_nb.js');
const _json = fs.read('month_nb.json');
var _test = fs.read ('test_month_nb.js');
_test = _test.replace("'month_nb_json_obj_replace_token';",
`const json_obj = JSON.parse('${_json.replace(/[\n\r\t]/gi, '')}');`);
`const month_nb_json = JSON.parse('${_json.replace(/[\n\r]/g, "")}');`);
page.evaluateJavaScript (_test);
phantom.exit ();
......@@ -3,8 +3,8 @@
// Author: Simon 'Siltaar' Descarpentries ; siltaar § acoeuro ' com
// Version: 4
// Licence: GPLv3
/* globals json_obj */
function month_nb (a, json_obj, check_keys=false) {
json_obj = json_obj ? json_obj : month_nb_json;
var keys = [Object.keys(json_obj)];
var objs = [json_obj];
var o_ks = keys[keys.length-1];
......
......@@ -37,10 +37,10 @@ function unused_name (debug=true, display_months=false) {
for (let j = mns[i].length; j--; ) {
cur_mn = mns[i][j].textContent;
cur_mn = cur_mn.replace (/\(bulan\) /, '');
if (month_nb (cur_mn, json_obj) != j + 1) {
if (month_nb (cur_mn, month_nb_json) != j + 1) {
errors++;
str_lg += `\nerror : ${cur_mn} gave ${month_nb(cur_mn, json_obj)} instead of \
${(j+1)}`;
str_lg += `\nerror : ${cur_mn} gave ${month_nb(cur_mn, month_nb_json)} \
instead of ${(j+1)}`;
}
}
if (errors) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment