goodreads fetch nodeside, babel

This commit is contained in:
wgroeneveld 2020-05-30 17:41:38 +02:00
parent d48973a247
commit 6be5ebfa06
15 changed files with 3050 additions and 29 deletions

1
.gitignore vendored
View File

@ -6,5 +6,6 @@ public/
out/
build/
resources/
node_modules/
*.class

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "themes/minimal"]
path = themes/minimal
url = https://github.com/calintat/minimal.git

View File

@ -1,9 +1,2 @@
Brainbaking.com hugo site.
### Theme
Update/install:
$ git submodule add https://github.com/calintat/minimal.git themes/minimal
$ git submodule init
$ git submodule update

11
babel.config.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = function (api) {
api.cache(true);
const presets = [ '@babel/preset-env' ];
const plugins = [ ];
return {
presets,
plugins
};
}

View File

@ -49,12 +49,7 @@ These are the latest 12 books I've read:
<div id="gr_grid_widget_1496758344" class="goodreadswidget">
</div>
<script src="https://www.goodreads.com/review/grid_widget/5451893.Wouter's%20bookshelf:%20read?cover_size=medium&hide_link=&hide_title=&num_books=12&order=d&shelf=read&sort=date_added&widget_id=1496758344" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
[...document.querySelectorAll('.goodreadswidget img')].forEach(img => {
img.src = img.src.replace(/_SX[0-9]+_(SY[0-9]+_)*.jpg/, "_S400_.jpg")
})
</script>
<script src="/js/goodreads.js" type="text/javascript" charset="utf-8"></script>
<main>
<p style="clear: both;">&nbsp;</p>

View File

@ -76,7 +76,7 @@ The black sketches come from the Cross Concord: look at the thickness of those s
The problem with those nibs is the availability. These are hand crafted by Japanese experts and they are deeply back ordered. Importing from Japan could burn an even greater hole in your wallet: in Belgium import rates go as high as 50%!
> Mastery is in short supply nowadays, a consequence of our multi-tasking, bucket-listing world. A Microsoft study released this May claims the human attention span is now eight seconds, one second short of a goldfish. Disposable culture may feed the needs of the moment, but still leave the spirit hungry for something more. (Leigh Reyes)
> Mastery is in short supply nowadays, a consequence of our multi-tasking, bucket-listing world. A Microsoft study released this May claims the human attention span is now eight seconds, one second short of a goldfish. Disposable culture may feed the needs of the moment, but still leave the spirit hungry for something more. <span>Leigh Reyes</span>
#### Pilot Justus 95

View File

@ -16,7 +16,7 @@ My wife has been blogging on and off for more than five years now, and she's bee
That's where things like Webnode and Wix come in: a lot of illustrators and designers create their own website using **blocks**: they are **page builders**, where drag and dropping is possible and (ugly) CSS/HTML is scaffolded. Since both Webnode and Wix are paid solutions, and both do not enable you to host it yourself, we decided to go for the Wordpress option again, more specifically with a page builder plugin: _[Brizy](https://brizy.io)_.
### "The most user-friendly website builder in town"
> The most user-friendly website builder in town <span>According to the Brizy website</span>
See for yourself:

17
goodreads-fetch.js Normal file
View File

@ -0,0 +1,17 @@
const https = require('https')
// WHY? Because including this thing comes with free cookies...
const url = "https://www.goodreads.com/review/grid_widget/5451893.Wouter's%20bookshelf:%20read?cover_size=medium&hide_link=&hide_title=&num_books=12&order=d&shelf=read&sort=date_added&widget_id=1496758344"
https.get(url, (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
resp.on('end', () => {
console.log(data)
});
})

2959
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "brainbaking",
"version": "1.0.0",
"description": "",
"main": "goodreads-fetch.js",
"directories": {
"doc": "docs"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6"
},
"scripts": {
"build": "/usr/local/bin/hugo",
"install": "node goodreads-fetch.js > static/js/goodreads.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wgroeneveld/brainbaking.git"
},
"author": "",
"license": "",
"bugs": {
"url": "https://github.com/wgroeneveld/brainbaking/issues"
},
"homepage": "https://github.com/wgroeneveld/brainbaking#readme"
}

9
static/js/goodreads.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,13 @@ document.addEventListener("DOMContentLoaded",function() {
});
})();
(function goodreads() {
if(document.querySelector('.goodreadswidget') === null) return;
[...document.querySelectorAll('.goodreadswidget img')].forEach(img => {
img.src = img.src.replace(/_SX[0-9]+_(SY[0-9]+_)*.jpg/, "_S400_.jpg")
})
})()
const lightbox = () => {
[...document.querySelectorAll('main img')].forEach(el => {
if(el.parentNode.nodeName !== 'A') {

View File

@ -6,13 +6,15 @@
<h1>
<svg class='icon'><use xlink:href="#{{ .Params.icontag }}"></use></svg>&nbsp;{{ .Title }}
</h1>
<hr/>
{{ end }}
{{ with .Content }}
<div class="text-justify">
{{ . }}
</div>
{{ if eq .Paginator.PageNumber 1 }}
<hr/>
{{ with .Content }}
<div class="text-justify">
{{ . }}
</div>
{{ end }}
{{ end }}
{{ if (not .Params.disableList) }}

View File

@ -1,9 +1,8 @@
{{- $mainScriptPath := "js/brainbaking.js" }}
{{- $scripts := resources.Get $mainScriptPath | resources.ExecuteAsTemplate $mainScriptPath . }}
{{- $scripts := resources.Get $mainScriptPath | resources.ExecuteAsTemplate $mainScriptPath . | babel | resources.Minify | resources.Fingerprint "sha512" }}
<script src = '{{ $scripts.Permalink }}'></script>
<script src = '/js/simple-lightbox.min.js'></script>
<script src="/js/brainbaking.js"></script>
{{- if (ne hugo.Environment "development") }}
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->

View File

@ -9,15 +9,17 @@
</h1>
{{ end }}
{{ .Date.Format (.Site.Params.dateFormat | default "2 January 2006") | $.Scratch.Set "subtitle" }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
{{ if isset $.Params "subtitle" }}
{{ if isset .Params "subtitle" }}
<h2>{{ .Params.subtitle }}</h2>
<h3>
<span style="color: grey;">
{{ if isset .Params "date" }}
<span title="Created Date">
<svg class='icon icon-text'><use xlink:href='#cal1'></use></svg>{{ $.Scratch.Get "subtitle" }}
<svg class='icon icon-text'><use xlink:href='#cal1'></use></svg>
{{ .Date.Format (.Site.Params.dateFormat | default "2 January 2006") }}
</span>
{{ end }}
{{ if (not .Params.disableComments) }}
&nbsp;|&nbsp;
<span title="Comments">