From 6974a8c306c2d9e2453a3db35f5053066cbb27ae Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 2 Jan 2018 14:48:41 +0100 Subject: Raw button implementation --- app.js | 15 +++++++++++++-- public/css/style.css | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 1657afd..5182330 100644 --- a/app.js +++ b/app.js @@ -36,15 +36,25 @@ const remark = require('remark-parse'); const inspect = require('unist-util-inspect'); const useLandScript = " " +const userSide_Button = '' app.use(express.static('public')); app.get('/' + path + '/*', function(req, res) { - var url = decodeURI(req.url); + var url = req._parsedUrl.pathname; + var query = req.query; + console.log("[" + new Date() + "] > " + "200 - " + url); fs.readFile(url.substr(1), 'utf8', function(err, data) { if (err) return console.log(err); + + if( query && query['raw'] == 'true' ) { + console.log("PLEASE"); + res.send( data ) + return; + } + // remark() /* Debbug comment const a = unified() @@ -75,7 +85,8 @@ app.get('/' + path + '/*', function(req, res) { .use(rehypeStringify) .process(data, function (err, file) { - res.send(String(file) + useLandScript); + res.send(String(file) + useLandScript + + '' + userSide_Button + ''); console.error(report(err || file)); }); }); diff --git a/public/css/style.css b/public/css/style.css index e70a940..4717cd6 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -110,4 +110,41 @@ kbd { text-shadow: 0 1px 0 #fff; color: #5e551f; } +.view { + position: relative; +} +.raw_button { + position: absolute; + top:10px; + right:0; + + margin : 0; + padding : 0; + border : 0; + background : transparent; + font-family : inherit; + font-size : 1em; + cursor : pointer; +} +.raw_button > div { + width : 40px; + height : 24px; + background : rgb(192,192,192) url('image.png') no-repeat center center; + line-height : 24px; + border : 1px solid rgba(27, 31, 35, 0.2); + border-radius : 3px; + font-size: 12px; + + color: #24292e; + background-color: #eff3f6; + background-image: linear-gradient(-180deg, #fafbfc 0%, #eff3f6 90%); + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; +} +.raw_button > div > div { + font-weight: bold; +} + +.no-style { + text-decoration: none; +} -- cgit v1.2.3