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:
parent
8fba91fa30
commit
3213788dbb
14 changed files with 43 additions and 12 deletions
|
@ -1,5 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version {next}
|
||||||
|
- Autolink/embed youtube videos and spotify links
|
||||||
|
|
||||||
## Version 0.2.2 (2017-02-05)
|
## Version 0.2.2 (2017-02-05)
|
||||||
- Fix: allow syndication to work again (issue#42)
|
- Fix: allow syndication to work again (issue#42)
|
||||||
|
|
||||||
|
|
1
public/assets/js/links.js
Normal file
1
public/assets/js/links.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
!function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=18)}({18:function(t,e){var r=/watch\?v=([A-Za-z0-9\-_]+)\b/,n=/https\:\/\/play\.spotify\.com\/(.*)\b/,o=document.querySelectorAll(".e-content"),a=!0,u=!1,i=void 0;try{for(var c,l=o[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var s=c.value,f=s.textContent.match(r);if(f){var p=document.createElement("iframe");p.classList.add("youtube"),p.setAttribute("src","https://www.youtube.com/embed/"+f[1]),p.setAttribute("frameborder",0),p.setAttribute("allowfullscreen","true"),s.appendChild(p)}var d=s.textContent.match(n);if(d){var b=d[1].replace("/",":"),m=document.createElement("iframe");m.classList.add("spotify"),m.setAttribute("src","https://embed.spotify.com/?uri=spotify:"+b),m.setAttribute("frameborder",0),m.setAttribute("allowtransparency","true"),s.appendChild(m)}}}catch(t){u=!0,i=t}finally{try{!a&&l.return&&l.return()}finally{if(u)throw i}}}});
|
BIN
public/assets/js/links.js.br
Normal file
BIN
public/assets/js/links.js.br
Normal file
Binary file not shown.
BIN
public/assets/js/links.js.gz
Normal file
BIN
public/assets/js/links.js.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
28
resources/assets/es6/links.js
Normal file
28
resources/assets/es6/links.js
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,12 +20,11 @@ Notes «
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
|
|
||||||
<!--<script src="/assets/frontend/Autolinker.min.js"></script>
|
<script defer src="/assets/js/links.js"></script>
|
||||||
<script src="/assets/js/links.js"></script>-->
|
|
||||||
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
|
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
|
||||||
<script defer src="/assets/js/maps.js"></script>
|
<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">
|
<link rel="stylesheet" href="/assets/prism/prism.css">
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@extends('master')
|
@extends('master')
|
||||||
|
|
||||||
@section('title')
|
@section('title')
|
||||||
{{ strip_tags($note->note) }} « Notes «
|
{{ strip_tags($note->note) }} « Notes «
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
@ -34,11 +34,10 @@
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
@include('templates.mapbox-links')
|
|
||||||
|
|
||||||
<script src="/assets/frontend/Autolinker.min.js"></script>
|
<script defer src="/assets/js/links.js"></script>
|
||||||
<script src="/assets/js/links.js"></script>
|
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
|
||||||
<script src="/assets/js/maps.js"></script>
|
<script defer src="/assets/js/maps.js"></script>
|
||||||
|
|
||||||
<script src="/assets/prism/prism.js"></script>
|
<script src="/assets/prism/prism.js"></script>
|
||||||
<link rel="stylesheet" href="/assets/prism/prism.css">
|
<link rel="stylesheet" href="/assets/prism/prism.css">
|
||||||
|
|
|
@ -4,6 +4,7 @@ const config = {
|
||||||
context: __dirname + '/resources/assets/es6',
|
context: __dirname + '/resources/assets/es6',
|
||||||
entry: {
|
entry: {
|
||||||
//app: './app.js',
|
//app: './app.js',
|
||||||
|
links: './links.js',
|
||||||
maps: './maps.js',
|
maps: './maps.js',
|
||||||
newnote: './newnote.js'
|
newnote: './newnote.js'
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue