Squashed commit of the following:

commit 8e1dd96ad9a3301560a79aa3e6231e5cbc5112a8
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Feb 5 20:50:50 2017 +0000

    Update changelog

commit 2d5eae57534f40d6f768ab92e46123d45b85f23d
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Feb 5 20:47:21 2017 +0000

    Link to correct js files, also pre-compress js assets

commit 281844d09ced2035da05336d6a47399e3cf6a92a
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Feb 5 20:31:12 2017 +0000

    Adding a links util
This commit is contained in:
Jonny Barnes 2017-02-05 20:51:26 +00:00
parent 8fba91fa30
commit 3213788dbb
14 changed files with 43 additions and 12 deletions

View file

@ -0,0 +1,28 @@
//links.js
let youtubeRegex = /watch\?v=([A-Za-z0-9\-_]+)\b/;
let spotifyRegex = /https\:\/\/play\.spotify\.com\/(.*)\b/;
let notes = document.querySelectorAll('.e-content');
for (let note of notes) {
let ytid = note.textContent.match(youtubeRegex);
if (ytid) {
let ytiframe = document.createElement('iframe');
ytiframe.classList.add('youtube');
ytiframe.setAttribute('src', 'https://www.youtube.com/embed/' + ytid[1]);
ytiframe.setAttribute('frameborder', 0);
ytiframe.setAttribute('allowfullscreen', 'true');
note.appendChild(ytiframe);
}
let spotifyid = note.textContent.match(spotifyRegex);
if (spotifyid) {
let sid = spotifyid[1].replace('/', ':');
let siframe = document.createElement('iframe');
siframe.classList.add('spotify');
siframe.setAttribute('src', 'https://embed.spotify.com/?uri=spotify:' + sid);
siframe.setAttribute('frameborder', 0);
siframe.setAttribute('allowtransparency', 'true');
note.appendChild(siframe);
}
}

View file

@ -20,12 +20,11 @@ Notes «
@section('scripts')
<!--<script src="/assets/frontend/Autolinker.min.js"></script>
<script src="/assets/js/links.js"></script>-->
<script defer src="/assets/js/links.js"></script>
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
<script defer src="/assets/js/maps.js"></script>
<script src="/assets/prism/prism.js"></script>
<script defer src="/assets/prism/prism.js"></script>
<link rel="stylesheet" href="/assets/prism/prism.css">
@stop

View file

@ -1,7 +1,7 @@
@extends('master')
@section('title')
{{ strip_tags($note->note) }} « Notes «
{{ strip_tags($note->note) }} « Notes «
@stop
@section('content')
@ -34,11 +34,10 @@
@stop
@section('scripts')
@include('templates.mapbox-links')
<script src="/assets/frontend/Autolinker.min.js"></script>
<script src="/assets/js/links.js"></script>
<script src="/assets/js/maps.js"></script>
<script defer src="/assets/js/links.js"></script>
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
<script defer src="/assets/js/maps.js"></script>
<script src="/assets/prism/prism.js"></script>
<link rel="stylesheet" href="/assets/prism/prism.css">