From 24ceb94d00ffed05b8488fb75db89aaec8fcbedb Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 25 Nov 2017 23:28:37 +0100 Subject: Update everything --- app.js | 21 +++++++++++-- public/css/style.css | 60 ++++++++++++++++++++++++++++++++++++ public/img/ic_bad_black_48px.svg | 4 +++ public/img/ic_comment_black_48px.svg | 5 +++ public/img/ic_error_black_48px.svg | 5 +++ public/img/ic_good_black_48px.svg | 5 +++ public/img/ic_help_black_48px.svg | 5 +++ public/img/ic_info_black_48px.svg | 5 +++ public/index.html | 1 + public/js/qcm.js | 6 ++++ 10 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 public/img/ic_bad_black_48px.svg create mode 100644 public/img/ic_comment_black_48px.svg create mode 100644 public/img/ic_error_black_48px.svg create mode 100644 public/img/ic_good_black_48px.svg create mode 100644 public/img/ic_help_black_48px.svg create mode 100644 public/img/ic_info_black_48px.svg diff --git a/app.js b/app.js index f54770c..745c896 100644 --- a/app.js +++ b/app.js @@ -22,6 +22,8 @@ const kbd = require('remark-kbd'); const math = require('remark-math'); const mermaid = require('remark-mermaid-simple'); const highlight = require('remark-highlight.js'); +const sb = require('remark-special-box'); +const qcm = require('remark-qcm'); const useLandScript = " " @@ -39,6 +41,8 @@ app.get('/' + path + '/*', function(req, res) { .use(kbd) .use(math) .use(mermaid) + .use(sb) + .use(qcm) .use(highlight) .use(html) .process(data, function (err, file) { @@ -56,9 +60,20 @@ app.get('/data', function(req, res) { app.get('/img/*', function (req, res) { console.log("[" + new Date() + "] > " + "200 - " + req.url); - var img = fs.readFileSync(req.url.replace('/img', path)); - res.writeHead(200, {'Content-Type': 'image/gif' }); - res.end(img, 'binary'); + if( path == '/img/ic_info_black_48px.svg' || + path == '/imr/ic_error_black_48px.svg' || + path == '/imr/ic_good_black_48px.svg' || + path == '/imr/ic_bad_black_48px.svg' || + path == '/imr/ic_comment_black_48px.svg' || + path == '/imr/ic_help_black_48px.svg' ) { + const img = fs.readFileSync(path); + res.writeHead(200, {'Content-Type': 'image/svg' }); + res.end(img, 'binary'); + }else { + const img = fs.readFileSync(req.url.replace('/img', path)); + res.writeHead(200, {'Content-Type': 'image/gif' }); + res.end(img, 'binary'); + } }); app.get('/', function(req, res) { diff --git a/public/css/style.css b/public/css/style.css index e63e59a..2319188 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -31,3 +31,63 @@ blockquote { padding: 1px 2%; border-left: 5px solid #ccc; } + +.special-box { + background: #eee7da; + margin: 12.5px 12.5px; + padding: 10px 0 10px 95px; + color: #424242; + min-height: 60px; +} +.special-box::before{ + content: ""; + display: block; + width: 48px; + height: 48px; + background-repeat: no-repeat; + margin: 0px 0 -48px -70px; +} +.information{ + background: #daeaee; +} +.information::before{ + background-image: url("/img/ic_info_black_48px.svg"); +} +.comment{ + background: #eea; +} +.comment::before{ + background-image: url("/img/ic_comment_black_48px.svg"); +} +.attention{ + background: #eee7da; +} +.attention::before{ + background-image: url("/img/ic_error_black_48px.svg"); +} +.question{ + background: #e2daee; +} +.question::before{ + background-image: url("/img/ic_help_black_48px.svg"); +} +.good{ + background: #aea; +} +.good::before{ + background-image: url("/img/ic_good_black_48px.svg"); +} +.bad{ + background: #eaa; +} +.bad::before{ + background-image: url("/img/ic_bad_black_48px.svg"); +} +.secret { + background: #eee; + padding: 10px 0 10px 15px; + min-height: 20px; +} +.hiden_block_quote { + display: none; +} diff --git a/public/img/ic_bad_black_48px.svg b/public/img/ic_bad_black_48px.svg new file mode 100644 index 0000000..0b02d88 --- /dev/null +++ b/public/img/ic_bad_black_48px.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/img/ic_comment_black_48px.svg b/public/img/ic_comment_black_48px.svg new file mode 100644 index 0000000..e0d89e2 --- /dev/null +++ b/public/img/ic_comment_black_48px.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/img/ic_error_black_48px.svg b/public/img/ic_error_black_48px.svg new file mode 100644 index 0000000..d8eb238 --- /dev/null +++ b/public/img/ic_error_black_48px.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/img/ic_good_black_48px.svg b/public/img/ic_good_black_48px.svg new file mode 100644 index 0000000..0995688 --- /dev/null +++ b/public/img/ic_good_black_48px.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/img/ic_help_black_48px.svg b/public/img/ic_help_black_48px.svg new file mode 100644 index 0000000..c92b2ad --- /dev/null +++ b/public/img/ic_help_black_48px.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/img/ic_info_black_48px.svg b/public/img/ic_info_black_48px.svg new file mode 100644 index 0000000..266453e --- /dev/null +++ b/public/img/ic_info_black_48px.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/index.html b/public/index.html index f5a3c4a..1a476fa 100644 --- a/public/index.html +++ b/public/index.html @@ -9,6 +9,7 @@ + diff --git a/public/js/qcm.js b/public/js/qcm.js index c81fe8f..a0eeee2 100644 --- a/public/js/qcm.js +++ b/public/js/qcm.js @@ -12,6 +12,10 @@ function check(id/*, tab*/) { const fieldQCM = document.getElementById(id); Array.from(fieldQCM.getElementsByTagName('INPUT')).forEach((input) => { + if( input.type != 'checkbox' ) + return; + + const label = document.querySelector("label[for='" + input.id + "']"); if (input.checked) { Array.from(label.getElementsByClassName('hiden_block_quote')).forEach(((child) => { @@ -24,6 +28,7 @@ function check(id/*, tab*/) { } break; case '=': { + console.log("Good") label.style.color = '#00BB00'; } break; @@ -33,6 +38,7 @@ function check(id/*, tab*/) { } break; default: { + console.log("Oups") // empty } } -- cgit v1.2.3