1
Fork 0

Import static assets from old site

This commit is contained in:
Jake Howard 2018-07-23 09:25:00 +01:00
parent 713ad636fc
commit f94f0c26a3
Signed by: jake
GPG key ID: 57AFB45680EDD477
13 changed files with 13069 additions and 3 deletions

View file

@ -27,8 +27,9 @@ RUN npm install
COPY manage.py /app/manage.py
COPY project/ /app/project/
COPY static/ /app/static/
COPY scripts/ /app/scripts/
COPY templates/ /app/templates/
RUN ./manage.py collectstatic --noinput
RUN ./scripts/build-static.sh
EXPOSE 8000

12575
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,5 +8,27 @@
"url": "git+https://github.com/RealOrangeOne/website.git"
},
"author": "",
"dependencies": {}
"devDependencies": {
"broken-link-checker-local": "0.2.0",
"eslint-config-dabapps": "github:dabapps/eslint-config-dabapps#v3.0.0",
"markdown-spellcheck": "1.3.1",
"node-sass": "4.9.0",
"parcel-bundler": "1.9.1",
"sass-lint": "1.12.1",
"yaml-lint": "1.2.3"
},
"dependencies": {
"@fortawesome/fontawesome": "1.1.8",
"@fortawesome/fontawesome-free-brands": "5.0.13",
"@fortawesome/fontawesome-free-regular": "5.0.13",
"@fortawesome/fontawesome-free-solid": "5.0.13",
"bootstrap": "4.1.1",
"clipboard": "1.7.1",
"jquery": "3.3.1",
"lg-thumbnail": "1.1.0",
"lightgallery": "1.6.11",
"mermaid": "7.1.2",
"popper.js": "1.14.3",
"speedpack": "0.2.0"
}
}

19
scripts/build-static.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
source ./scripts/common.sh
rm -rf $STATIC_BUILD
mkdir -p $STATIC_BUILD/js $STATIC_BUILD/css
cp -r $BASEDIR/node_modules/lightgallery/dist/fonts $STATIC_BUILD
cp -r $STATIC_SRC/img $STATIC_BUILD/img
cp -r $BASEDIR/node_modules/lightgallery/dist/img/* $STATIC_BUILD/img
parcel build $STATIC_SRC/js/index.js -d $STATIC_BUILD/js/ -o app.js
node-sass $STATIC_SRC/scss/style.scss $STATIC_BUILD/css/style.css --source-map-embed
cp $BASEDIR/node_modules/mermaid/dist/mermaid.min.js $STATIC_BUILD/js/mermaid.min.js
./manage.py collectstatic --noinput

7
scripts/common.sh Executable file
View file

@ -0,0 +1,7 @@
BASEDIR=$PWD
NODE_BIN=$BASEDIR/node_modules/.bin
STATIC_SRC=$BASEDIR/static/src
STATIC_BUILD=$BASEDIR/static/build
export PATH=$NODE_BIN:$BASEDIR/bin:$PATH

BIN
static/src/img/header.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

14
static/src/js/fa.js Normal file
View file

@ -0,0 +1,14 @@
'use strict';
var fontawesome = require('@fortawesome/fontawesome');
var solid = require('@fortawesome/fontawesome-free-solid');
var regular = require('@fortawesome/fontawesome-free-regular');
var brands = require('@fortawesome/fontawesome-free-brands');
try {
fontawesome.library.add(solid);
fontawesome.library.add(regular);
fontawesome.library.add(brands);
} catch (e) {
// Sometimes loading icons raises an exception, even when there's no invalid icons on the screen
}

67
static/src/js/index.js Normal file
View file

@ -0,0 +1,67 @@
'use strict';
var $ = require('./jquery-global');
require('./fa');
require('bootstrap');
require('lightgallery/dist/js/lightgallery');
require('lg-thumbnail/dist/lg-thumbnail');
var Clipboard = require('clipboard');
$('.image').each(function () { // setup div-image hybrids
var ele = $(this);
if (ele.data('image')) {
ele.css('background-image', 'url(' + ele.data('image') + ')');
} else {
ele.removeClass('image');
}
});
$(document).ready(function () {
$('#light-gallery').lightGallery({
thumbnail:true,
animateThumb: false,
showThumbByDefault: false,
preload: 2,
download: false
});
// HACK: ToC has blank li if no initial header
$('#TableOfContents').each(function () {
var ele = $(this);
if (ele.find('a').length <= 3) {
ele.parent().remove();
} else if (ele.children('ul').children('li').length === 1) {
ele.children('ul').replaceWith(ele.children('ul').children('li').children('ul'));
}
});
mermaid.initialize({
startOnLoad: true
});
});
$('.navbar-brand').on('click', function (event) {
if ($('html').scrollTop() > 100) {
$('html, body').stop().animate({
scrollTop: 0
}, 500);
} else {
window.location = '/';
}
event.preventDefault();
});
var clipboard = new Clipboard('a');
clipboard.on('success', function (e) {
var ele = $(e.trigger);
ele.find('i').attr('class', 'fas fa-check');
ele.attr('title', 'Copied!');
});
$('[data-clipboard-text]').on('click', function (event) {
event.preventDefault();
});

10
static/src/js/jquery-global.js vendored Normal file
View file

@ -0,0 +1,10 @@
'use strict';
var jQuery = require('jquery');
window.$ = jQuery;
window.jQuery = jQuery;
global.$ = jQuery;
global.jQuery = jQuery;
module.exports = jQuery;

View file

@ -0,0 +1,81 @@
/* Background */ .chroma { background-color: #f8f8f8 }
/* Other */ .chroma .x { color: #000000 }
/* Error */ .chroma .err { color: #a40000 }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em; }
/* Keyword */ .chroma .k { color: #204a87; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #204a87; font-weight: bold }
/* KeywordDeclaration */ .chroma .kd { color: #204a87; font-weight: bold }
/* KeywordNamespace */ .chroma .kn { color: #204a87; font-weight: bold }
/* KeywordPseudo */ .chroma .kp { color: #204a87; font-weight: bold }
/* KeywordReserved */ .chroma .kr { color: #204a87; font-weight: bold }
/* KeywordType */ .chroma .kt { color: #204a87; font-weight: bold }
/* Name */ .chroma .n { color: #000000 }
/* NameAttribute */ .chroma .na { color: #c4a000 }
/* NameBuiltin */ .chroma .nb { color: #204a87 }
/* NameBuiltinPseudo */ .chroma .bp { color: #3465a4 }
/* NameClass */ .chroma .nc { color: #000000 }
/* NameConstant */ .chroma .no { color: #000000 }
/* NameDecorator */ .chroma .nd { color: #5c35cc; font-weight: bold }
/* NameEntity */ .chroma .ni { color: #ce5c00 }
/* NameException */ .chroma .ne { color: #cc0000; font-weight: bold }
/* NameFunction */ .chroma .nf { color: #000000 }
/* NameFunctionMagic */ .chroma .fm { color: #000000 }
/* NameLabel */ .chroma .nl { color: #f57900 }
/* NameNamespace */ .chroma .nn { color: #000000 }
/* NameOther */ .chroma .nx { color: #000000 }
/* NameProperty */ .chroma .py { color: #000000 }
/* NameTag */ .chroma .nt { color: #204a87; font-weight: bold }
/* NameVariable */ .chroma .nv { color: #000000 }
/* NameVariableClass */ .chroma .vc { color: #000000 }
/* NameVariableGlobal */ .chroma .vg { color: #000000 }
/* NameVariableInstance */ .chroma .vi { color: #000000 }
/* NameVariableMagic */ .chroma .vm { color: #000000 }
/* Literal */ .chroma .l { color: #000000 }
/* LiteralDate */ .chroma .ld { color: #000000 }
/* LiteralString */ .chroma .s { color: #4e9a06 }
/* LiteralStringAffix */ .chroma .sa { color: #4e9a06 }
/* LiteralStringBacktick */ .chroma .sb { color: #4e9a06 }
/* LiteralStringChar */ .chroma .sc { color: #4e9a06 }
/* LiteralStringDelimiter */ .chroma .dl { color: #4e9a06 }
/* LiteralStringDoc */ .chroma .sd { color: #8f5902; font-style: italic }
/* LiteralStringDouble */ .chroma .s2 { color: #4e9a06 }
/* LiteralStringEscape */ .chroma .se { color: #4e9a06 }
/* LiteralStringHeredoc */ .chroma .sh { color: #4e9a06 }
/* LiteralStringInterpol */ .chroma .si { color: #4e9a06 }
/* LiteralStringOther */ .chroma .sx { color: #4e9a06 }
/* LiteralStringRegex */ .chroma .sr { color: #4e9a06 }
/* LiteralStringSingle */ .chroma .s1 { color: #4e9a06 }
/* LiteralStringSymbol */ .chroma .ss { color: #4e9a06 }
/* LiteralNumber */ .chroma .m { color: #0000cf; font-weight: bold }
/* LiteralNumberBin */ .chroma .mb { color: #0000cf; font-weight: bold }
/* LiteralNumberFloat */ .chroma .mf { color: #0000cf; font-weight: bold }
/* LiteralNumberHex */ .chroma .mh { color: #0000cf; font-weight: bold }
/* LiteralNumberInteger */ .chroma .mi { color: #0000cf; font-weight: bold }
/* LiteralNumberIntegerLong */ .chroma .il { color: #0000cf; font-weight: bold }
/* LiteralNumberOct */ .chroma .mo { color: #0000cf; font-weight: bold }
/* Operator */ .chroma .o { color: #ce5c00; font-weight: bold }
/* OperatorWord */ .chroma .ow { color: #204a87; font-weight: bold }
/* Punctuation */ .chroma .p { color: #000000; font-weight: bold }
/* Comment */ .chroma .c { color: #8f5902; font-style: italic }
/* CommentHashbang */ .chroma .ch { color: #8f5902; font-style: italic }
/* CommentMultiline */ .chroma .cm { color: #8f5902; font-style: italic }
/* CommentSingle */ .chroma .c1 { color: #8f5902; font-style: italic }
/* CommentSpecial */ .chroma .cs { color: #8f5902; font-style: italic }
/* CommentPreproc */ .chroma .cp { color: #8f5902; font-style: italic }
/* CommentPreprocFile */ .chroma .cpf { color: #8f5902; font-style: italic }
/* Generic */ .chroma .g { color: #000000 }
/* GenericDeleted */ .chroma .gd { color: #a40000 }
/* GenericEmph */ .chroma .ge { color: #000000; font-style: italic }
/* GenericError */ .chroma .gr { color: #ef2929 }
/* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold }
/* GenericInserted */ .chroma .gi { color: #00a000 }
/* GenericOutput */ .chroma .go { color: #000000; font-style: italic }
/* GenericPrompt */ .chroma .gp { color: #8f5902 }
/* GenericStrong */ .chroma .gs { color: #000000; font-weight: bold }
/* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold }
/* GenericTraceback */ .chroma .gt { color: #a40000; font-weight: bold }
/* TextWhitespace */ .chroma .w { color: #f8f8f8 }

271
static/src/scss/style.scss Normal file
View file

@ -0,0 +1,271 @@
@import "variables";
@import "highlight"; // Generated by Hugo
@import "node_modules/lightgallery/src/sass/lightgallery";
@import "node_modules/bootstrap/scss/bootstrap";
html, body {
height: 100%;
}
a {
transition: color 0.5s;
color: $primary;
&:hover {
color: $black;
}
&.colour-invert {
color: $black;
&:hover {
color: $primary;
}
}
}
pre code {
margin: 0;
border: 0;
border-radius: 0;
background: none;
padding: 0;
}
code {
padding: 0.25em;
}
.image {
background-repeat: no-repeat;
background-position: center;
background-size: cover;
&.featured {
margin-bottom: 2em !important;
height: 13em;
&.main {
height: 40vh;
}
}
}
.yt-embed {
position: relative;
padding-top: 30px;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
#light-gallery {
a {
display: inline-block;
margin-bottom: $grid-gutter-width;
border-bottom: 0;
cursor: zoom-in;
width: 100%;
overflow: hidden;
img {
transition: opacity 0.5s;
width: 100%;
}
&:hover img {
opacity: 0.7;
}
}
& + h4 {
margin-top: -$grid-gutter-width / 2;
}
}
table td {
vertical-align: middle;
}
.navbar {
padding-top: 0;
padding-bottom: 0;
.navbar-brand {
font-size: $font-size-base;
}
.nav-link {
padding-right: $font-size-base !important;
padding-left: $font-size-base !important;
}
.nav-link code, .navbar-brand code {
background-color: inherit;
font-size: 90%;
}
}
.bg-black {
background-color: $black;
}
#index-header {
width: 100%;
height: calc(100% - 110px);
}
footer {
position: static;
bottom: 0;
width: 100%;
height: 110px;
color: $gray-700;
a {
color: $gray-700;
&:hover {
color: $black;
}
}
}
#main {
margin-top: $spacer * 6;
}
.list-page-item {
.img-wrapper {
width: 20%;
}
.image {
width: 100%;
height: 10vh;
}
}
#TableOfContents {
font-size: $font-size-base;
ul {
list-style-type: none;
}
& > ul {
margin-bottom: 0;
padding-left: $spacer;
li {
text-indent: -5px;
&::before {
margin-right: 5px;
content: "-";
}
}
}
}
ul ul, ol ol {
padding-left: $spacer * 1.5;
}
pre.chroma {
margin: $spacer 0;
padding: $spacer;
.highlight & {
margin-top: 0;
}
}
.content {
font-size: $font-size-lg;
h1, h2, h3, h4, h5, h6 {
margin-top: $spacer;
}
blockquote {
border-left: $spacer * 0.2 solid $light;
padding-left: $spacer * 1.2;
}
img {
width: 100%;
}
iframe {
width: 100%;
height: 50vh;
}
}
.plyr {
min-width: initial;
}
p, li, h1, h2, h3, h4, h5, h6 {
code {
@extend .chroma;
padding: $spacer * 0.25;
color: inherit;
}
}
.header-image {
width: 100%;
height: 35vh;
}
.tag {
font-size: 1rem;
}
.breadcrumb {
margin-top: $spacer * 1.5;
margin-bottom: 0;
background-color: initial;
padding: 0;
font-size: $spacer * 0.9;
.breadcrumb-item + .breadcrumb-item::before {
padding: 0 0.2rem;
color: $black;
}
}
.playlist {
.image {
width: 50px;
height: 50px;
}
td, td > * {
vertical-align: middle;
}
}
.mermaid {
font-size: $font-size-base;
}
a.no-color-change {
&, &:hover {
color: inherit;
}
}

View file

@ -0,0 +1 @@
$primary: #E85537;