Merge branch 'develop' of github.com:jonnybarnes/jonnybarnes.uk into develop

This commit is contained in:
Jonny Barnes 2017-02-02 13:12:36 +00:00
commit 04167cb858
70 changed files with 3692 additions and 865 deletions

9
.babelrc Normal file
View file

@ -0,0 +1,9 @@
{
"presets": [
["latest", {
"es2015": {
"modules": false
}
}]
]
}

View file

@ -3,16 +3,11 @@
.PHONY: sass frontend js compress lint-sass lint-js
jsfiles := $(wildcard resources/assets/js/*.js)
sassfiles := $(wildcard resources/assets/sass/*.scss)
yarnfiles:= node_modules/whatwg-fetch/fetch.js \
node_modules/alertify.js/dist/js/alertify.js \
node_modules/store2/dist/store2.min.js \
node_modules/autolinker/dist/Autolinker.min.js \
node_modules/marked/marked.min.js
yarnfiles:= node_modules/mapbox-gl/dist/mapbox-gl.css
assets := public/assets/css/app.css \
public/assets/prism/prism.css public/assets/prism/prism.js \
$(wildcard public/assets/js/*.js) \
$(wildcard pubilc/assets/frontend/*.css) \
$(wildcard public/assets/frontend/*.js)
$(wildcard public/assets/frontend/*.css)
sass: public/assets/css/app.css

View file

@ -51,6 +51,7 @@ class NotesController extends Controller
$note->longitude = $lnglat[0];
$note->address = $note->place->name;
$note->placeLink = '/places/' . $note->place->slug;
$note->geoJson = $this->getGeoJson($note->longitude, $note->latitude, $note->place->name, $note->place->icon);
}
$photoURLs = [];
$photos = $note->getMedia();
@ -150,6 +151,7 @@ class NotesController extends Controller
$note->longitude = $lnglat[0];
$note->address = $note->place->name;
$note->placeLink = '/places/' . $note->place->slug;
$note->geoJson = $this->getGeoJson($note->longitude, $note->latitude, $note->place->name, $note->place->icon);
}
$photoURLs = [];
@ -348,4 +350,21 @@ class NotesController extends Controller
return $address;
});
}
private function getGeoJson($longitude, $latitude, $title, $icon)
{
$icon = $icon ?? 'marker';
return '{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [' . $longitude . ', ' . $latitude . ']
},
"properties": {
"title": "' . $title . '",
"icon": "' . $icon . '"
}
}';
}
}

View file

@ -1,7 +1,23 @@
# Changelog
## Version {next}
## Version 0.1.7 (2017-01-27)
- Add a rel=me link to my own domain in my h-card.
## Version 0.1.6 (2017-01-27)
- Update the webmention parser to a version with a verified fix
## Version 0.1.5 (2017-01-27)
- Update the webmention parser version to fix a bug with displaying webmentions
## Version 0.1.4 (2017-01-27)
- Fix: refactor code slightly to allow multiple maps to be added to a page
## Version 0.1.3 (2017-01-26)
- cleanup frontend assets, update compressed versions
## Version 0.1.2 (2017-01-26)
- Improve syndication flow when working out which targets to use
- Use webpack/babel/es6 (this was a big one, code wise, functionality now basically the same though)
## Version 0.1.1 (2016-12-10)
- Fix: use correct link for footer iwc icon

479
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddIconToPlaces extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('places', function (Blueprint $table) {
$table->string('icon')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('places', function (Blueprint $table) {
$table->dropColumn('icon');
});
}
}

View file

@ -6,15 +6,23 @@
"dependencies": {
"alertify.js": "^1.0.12",
"autolinker": "^1.2.0",
"mapbox-gl": "^0.29.0",
"marked": "^0.3.6",
"normalize.css": "^5.0.0",
"store2": "^2.3.2",
"webStorage": "^1.2.2",
"whatwg-fetch": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"babel-preset-latest": "^6.16.0",
"babel-runtime": "^6.20.0",
"lint-staged": "^3.2.1",
"pre-commit": "^1.1.3",
"stylelint-config-standard": "^14.0.0"
"stylelint-config-standard": "^14.0.0",
"webpack": "^2.2.0"
},
"private": true,
"scripts": {

Binary file not shown.

View file

@ -1 +1 @@
{"version":3,"sources":["../../../resources/assets/sass/app.scss","../../../resources/assets/sass/layout.scss","../../../resources/assets/sass/styles.scss","../../../resources/assets/sass/pagination.scss","../../../resources/assets/sass/note-form.scss","../../../resources/assets/sass/mapbox.scss","../../../resources/assets/sass/contacts.scss"],"names":[],"mappings":"AAIA,KACI,sBACA,cAAgB,CACnB,qBAKG,kBAAoB,CACvB,KCVG,eACA,cACA,iBACA,kBACA,oBAAsB,CACzB,WAGG,iBAAmB,CACtB,SAGG,gBAAkB,CACrB,MAGG,oBACA,AADA,aACA,4BAAuB,AAAvB,6BAAuB,AAAvB,qBAAuB,CAC1B,eAGG,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,yBACA,AADA,8BACA,gBAAkB,CACrB,cAGG,oBACA,AADA,aACA,yBAAoB,AAApB,kBAAoB,CACvB,kBAGG,gBAAkB,CACrB,iBAGG,qBACA,WAAa,CAChB,aAGG,eACA,yBAA2B,CAC9B,OAGG,eAAiB,CACpB,cAGG,eAAiB,CACpB,WAGG,eACA,cACA,iBAAmB,CACtB,sBAGG,cAAgB,CACnB,sBAGG,iBACA,cAAgB,CACnB,KClEG,6JAWe,CAClB,EAGG,qBACA,wBACA,UAAY,CACf,gBAGG,kBAAoB,CACvB,MAGG,WACA,UAAY,CACf,OAGG,iBACA,iBAAmB,CACtB,WAGG,kBAAoB,CACvB,UAGG,YACA,WAAa,CAChB,YC1CG,WACA,YACA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,yBACA,AADA,8BACA,yBAAoB,AAApB,kBAAoB,CACvB,eAGG,oBAAsB,CACzB,SCVG,oBACA,AADA,aACA,4BAAuB,AAAvB,6BAAuB,AAAvB,qBAAuB,CAC1B,0BAGG,aACI,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,cAAgB,CACnB,CAGL,0BACI,sBACI,UAAY,CACf,CAGL,eACI,UACA,oBACA,gBAAkB,CACrB,oDAIG,mBAAQ,AAAR,MAAQ,CACX,kBAGG,qBAAuB,CAC1B,QAGG,mBAAqB,CACxB,KCnCG,eACA,YAAc,CACjB,QAGG,y4HACA,wBACA,WACA,WAAa,CAChB,UAGG,kBACA,MACA,OACA,iBACA,cAAgB,CACnB,gBAGG,gBACA,gBAAkB,CACrB,SCtBG,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,eACA,6BAA+B,CAClC,aAGG,oBACA,YACA,YAAc,CACjB","file":"app.css"}
{"version":3,"sources":["../../../resources/assets/sass/app.scss","../../../resources/assets/sass/layout.scss","../../../resources/assets/sass/styles.scss","../../../resources/assets/sass/pagination.scss","../../../resources/assets/sass/note-form.scss","../../../resources/assets/sass/mapbox.scss","../../../resources/assets/sass/contacts.scss"],"names":[],"mappings":"AAIA,KACI,sBACA,cAAe,CAClB,qBAKG,kBAAmB,CACtB,KCVG,eACA,cACA,iBACA,kBACA,oBAAqB,CACxB,WAGG,iBAAkB,CACrB,SAGG,gBAAiB,CACpB,MAGG,oBACA,AADA,aACA,4BAAsB,AAAtB,6BAAsB,AAAtB,qBAAsB,CACzB,eAGG,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,yBACA,AADA,8BACA,gBAAiB,CACpB,cAGG,oBACA,AADA,aACA,yBAAmB,AAAnB,kBAAmB,CACtB,kBAGG,gBAAiB,CACpB,iBAGG,qBACA,WAAY,CACf,aAGG,eACA,yBAA0B,CAC7B,OAGG,eAAgB,CACnB,cAGG,eAAgB,CACnB,WAGG,eACA,cACA,iBAAkB,CACrB,sBAGG,cAAe,CAClB,sBAGG,iBACA,cAAe,CAClB,KClEG,6JAWc,CACjB,EAGG,qBACA,wBACA,UAAW,CACd,gBAGG,kBAAmB,CACtB,MAGG,WACA,UAAW,CACd,OAGG,iBACA,iBAAkB,CACrB,WAGG,kBAAmB,CACtB,UAGG,YACA,WAAY,CACf,YC1CG,WACA,YACA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,yBACA,AADA,8BACA,yBAAmB,AAAnB,kBAAmB,CACtB,eAGG,oBAAqB,CACxB,SCVG,oBACA,AADA,aACA,4BAAsB,AAAtB,6BAAsB,AAAtB,qBAAsB,CACzB,0BAGG,aACI,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,cAAe,CAClB,CAGL,0BACI,sBACI,UAAW,CACd,CAGL,eACI,UACA,oBACA,gBAAiB,CACpB,oDAIG,mBAAO,AAAP,MAAO,CACV,kBAGG,qBAAsB,CACzB,QAGG,mBAAoB,CACvB,KCnCG,eACA,YAAa,CAChB,QAGG,y4HACA,wBACA,WACA,WAAY,CACf,UAGG,kBACA,MACA,OACA,iBACA,cAAe,CAClB,gBAGG,gBACA,gBAAiB,CACpB,SCtBG,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,mBACA,eACA,6BAA8B,CACjC,aAGG,oBACA,YACA,YAAa,CAChB","file":"app.css"}

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
.alertify-logs>*{padding:12px 24px;color:#fff;box-shadow:0 2px 5px 0 rgba(0,0,0,.2);border-radius:1px}.alertify-logs>*,.alertify-logs>.default{background:rgba(0,0,0,.8)}.alertify-logs>.error{background:rgba(244,67,54,.8)}.alertify-logs>.success{background:rgba(76,175,80,.9)}.alertify{position:fixed;background-color:rgba(0,0,0,.3);left:0;right:0;top:0;bottom:0;width:100%;height:100%;z-index:1}.alertify.hide{opacity:0;pointer-events:none}.alertify,.alertify.show{box-sizing:border-box;transition:all .33s cubic-bezier(.25,.8,.25,1)}.alertify,.alertify *{box-sizing:border-box}.alertify .dialog{padding:12px}.alertify .alert,.alertify .dialog{width:100%;margin:0 auto;position:relative;top:50%;transform:translateY(-50%)}.alertify .alert>*,.alertify .dialog>*{width:400px;max-width:95%;margin:0 auto;text-align:center;padding:12px;background:#fff;box-shadow:0 2px 4px -1px rgba(0,0,0,.14),0 4px 5px 0 rgba(0,0,0,.098),0 1px 10px 0 rgba(0,0,0,.084)}.alertify .alert .msg,.alertify .dialog .msg{padding:12px;margin-bottom:12px;margin:0;text-align:left}.alertify .alert input:not(.form-control),.alertify .dialog input:not(.form-control){margin-bottom:15px;width:100%;font-size:100%;padding:12px}.alertify .alert input:not(.form-control):focus,.alertify .dialog input:not(.form-control):focus{outline-offset:-2px}.alertify .alert nav,.alertify .dialog nav{text-align:right}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button),.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button){background:transparent;box-sizing:border-box;color:rgba(0,0,0,.87);position:relative;outline:0;border:0;display:inline-block;-ms-flex-align:center;-ms-grid-row-align:center;align-items:center;padding:0 6px;margin:6px 8px;line-height:36px;min-height:36px;white-space:nowrap;min-width:88px;text-align:center;text-transform:uppercase;font-size:14px;text-decoration:none;cursor:pointer;border:1px solid transparent;border-radius:2px}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):active,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):hover{background-color:rgba(0,0,0,.05)}.alertify .alert nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus,.alertify .dialog nav button:not(.btn):not(.pure-button):not(.md-button):not(.mdl-button):focus{border:1px solid rgba(0,0,0,.1)}.alertify .alert nav button.btn,.alertify .dialog nav button.btn{margin:6px 4px}.alertify-logs{position:fixed;z-index:1}.alertify-logs.bottom,.alertify-logs:not(.top){bottom:16px}.alertify-logs.left,.alertify-logs:not(.right){left:16px}.alertify-logs.left>*,.alertify-logs:not(.right)>*{float:left;transform:translateZ(0);height:auto}.alertify-logs.left>.show,.alertify-logs:not(.right)>.show{left:0}.alertify-logs.left>*,.alertify-logs.left>.hide,.alertify-logs:not(.right)>*,.alertify-logs:not(.right)>.hide{left:-110%}.alertify-logs.right{right:16px}.alertify-logs.right>*{float:right;transform:translateZ(0)}.alertify-logs.right>.show{right:0;opacity:1}.alertify-logs.right>*,.alertify-logs.right>.hide{right:-110%;opacity:0}.alertify-logs.top{top:0}.alertify-logs>*{box-sizing:border-box;transition:all .4s cubic-bezier(.25,.8,.25,1);position:relative;clear:both;backface-visibility:hidden;perspective:1000;max-height:0;margin:0;padding:0;overflow:hidden;opacity:0;pointer-events:none}.alertify-logs>.show{margin-top:12px;opacity:1;max-height:1000px;padding:12px;pointer-events:auto}

File diff suppressed because one or more lines are too long

View file

@ -1,466 +0,0 @@
(function(self) {
'use strict';
if (self.fetch) {
return
}
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob: 'FileReader' in self && 'Blob' in self && (function() {
try {
new Blob()
return true
} catch(e) {
return false
}
})(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
}
if (support.arrayBuffer) {
var viewClasses = [
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]'
]
var isDataView = function(obj) {
return obj && DataView.prototype.isPrototypeOf(obj)
}
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
}
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name')
}
return name.toLowerCase()
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value)
}
return value
}
// Build a destructive iterator for the value list
function iteratorFor(items) {
var iterator = {
next: function() {
var value = items.shift()
return {done: value === undefined, value: value}
}
}
if (support.iterable) {
iterator[Symbol.iterator] = function() {
return iterator
}
}
return iterator
}
function Headers(headers) {
this.map = {}
if (headers instanceof Headers) {
headers.forEach(function(value, name) {
this.append(name, value)
}, this)
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function(name) {
this.append(name, headers[name])
}, this)
}
}
Headers.prototype.append = function(name, value) {
name = normalizeName(name)
value = normalizeValue(value)
var list = this.map[name]
if (!list) {
list = []
this.map[name] = list
}
list.push(value)
}
Headers.prototype['delete'] = function(name) {
delete this.map[normalizeName(name)]
}
Headers.prototype.get = function(name) {
var values = this.map[normalizeName(name)]
return values ? values[0] : null
}
Headers.prototype.getAll = function(name) {
return this.map[normalizeName(name)] || []
}
Headers.prototype.has = function(name) {
return this.map.hasOwnProperty(normalizeName(name))
}
Headers.prototype.set = function(name, value) {
this.map[normalizeName(name)] = [normalizeValue(value)]
}
Headers.prototype.forEach = function(callback, thisArg) {
Object.getOwnPropertyNames(this.map).forEach(function(name) {
this.map[name].forEach(function(value) {
callback.call(thisArg, value, name, this)
}, this)
}, this)
}
Headers.prototype.keys = function() {
var items = []
this.forEach(function(value, name) { items.push(name) })
return iteratorFor(items)
}
Headers.prototype.values = function() {
var items = []
this.forEach(function(value) { items.push(value) })
return iteratorFor(items)
}
Headers.prototype.entries = function() {
var items = []
this.forEach(function(value, name) { items.push([name, value]) })
return iteratorFor(items)
}
if (support.iterable) {
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
}
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'))
}
body.bodyUsed = true
}
function fileReaderReady(reader) {
return new Promise(function(resolve, reject) {
reader.onload = function() {
resolve(reader.result)
}
reader.onerror = function() {
reject(reader.error)
}
})
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsArrayBuffer(blob)
return promise
}
function readBlobAsText(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsText(blob)
return promise
}
function readArrayBufferAsText(buf) {
var view = new Uint8Array(buf)
var chars = new Array(view.length)
for (var i = 0; i < view.length; i++) {
chars[i] = String.fromCharCode(view[i])
}
return chars.join('')
}
function bufferClone(buf) {
if (buf.slice) {
return buf.slice(0)
} else {
var view = new Uint8Array(buf.byteLength)
view.set(new Uint8Array(buf))
return view.buffer
}
}
function Body() {
this.bodyUsed = false
this._initBody = function(body) {
this._bodyInit = body
if (!body) {
this._bodyText = ''
} else if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString()
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
this._bodyArrayBuffer = bufferClone(body.buffer)
// IE 10-11 can't handle a DataView body.
this._bodyInit = new Blob([this._bodyArrayBuffer])
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
this._bodyArrayBuffer = bufferClone(body)
} else {
throw new Error('unsupported BodyInit type')
}
if (!this.headers.get('content-type')) {
if (typeof body === 'string') {
this.headers.set('content-type', 'text/plain;charset=UTF-8')
} else if (this._bodyBlob && this._bodyBlob.type) {
this.headers.set('content-type', this._bodyBlob.type)
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
}
}
}
if (support.blob) {
this.blob = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
return Promise.resolve(new Blob([this._bodyText]))
}
}
this.arrayBuffer = function() {
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
} else {
return this.blob().then(readBlobAsArrayBuffer)
}
}
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
if (support.formData) {
this.formData = function() {
return this.text().then(decode)
}
}
this.json = function() {
return this.text().then(JSON.parse)
}
return this
}
// HTTP methods whose capitalization should be normalized
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
function normalizeMethod(method) {
var upcased = method.toUpperCase()
return (methods.indexOf(upcased) > -1) ? upcased : method
}
function Request(input, options) {
options = options || {}
var body = options.body
if (typeof input === 'string') {
this.url = input
} else {
if (input.bodyUsed) {
throw new TypeError('Already read')
}
this.url = input.url
this.credentials = input.credentials
if (!options.headers) {
this.headers = new Headers(input.headers)
}
this.method = input.method
this.mode = input.mode
if (!body && input._bodyInit != null) {
body = input._bodyInit
input.bodyUsed = true
}
}
this.credentials = options.credentials || this.credentials || 'omit'
if (options.headers || !this.headers) {
this.headers = new Headers(options.headers)
}
this.method = normalizeMethod(options.method || this.method || 'GET')
this.mode = options.mode || this.mode || null
this.referrer = null
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
throw new TypeError('Body not allowed for GET or HEAD requests')
}
this._initBody(body)
}
Request.prototype.clone = function() {
return new Request(this, { body: this._bodyInit })
}
function decode(body) {
var form = new FormData()
body.trim().split('&').forEach(function(bytes) {
if (bytes) {
var split = bytes.split('=')
var name = split.shift().replace(/\+/g, ' ')
var value = split.join('=').replace(/\+/g, ' ')
form.append(decodeURIComponent(name), decodeURIComponent(value))
}
})
return form
}
function parseHeaders(rawHeaders) {
var headers = new Headers()
rawHeaders.split('\r\n').forEach(function(line) {
var parts = line.split(':')
var key = parts.shift().trim()
if (key) {
var value = parts.join(':').trim()
headers.append(key, value)
}
})
return headers
}
Body.call(Request.prototype)
function Response(bodyInit, options) {
if (!options) {
options = {}
}
this.type = 'default'
this.status = 'status' in options ? options.status : 200
this.ok = this.status >= 200 && this.status < 300
this.statusText = 'statusText' in options ? options.statusText : 'OK'
this.headers = new Headers(options.headers)
this.url = options.url || ''
this._initBody(bodyInit)
}
Body.call(Response.prototype)
Response.prototype.clone = function() {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
})
}
Response.error = function() {
var response = new Response(null, {status: 0, statusText: ''})
response.type = 'error'
return response
}
var redirectStatuses = [301, 302, 303, 307, 308]
Response.redirect = function(url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError('Invalid status code')
}
return new Response(null, {status: status, headers: {location: url}})
}
self.Headers = Headers
self.Request = Request
self.Response = Response
self.fetch = function(input, init) {
return new Promise(function(resolve, reject) {
var request = new Request(input, init)
var xhr = new XMLHttpRequest()
xhr.onload = function() {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
}
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
var body = 'response' in xhr ? xhr.response : xhr.responseText
resolve(new Response(body, options))
}
xhr.onerror = function() {
reject(new TypeError('Network request failed'))
}
xhr.ontimeout = function() {
reject(new TypeError('Network request failed'))
}
xhr.open(request.method, request.url, true)
if (request.credentials === 'include') {
xhr.withCredentials = true
}
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
})
}
self.fetch.polyfill = true
})(typeof self !== 'undefined' ? self : this);

Binary file not shown.

Binary file not shown.

299
public/assets/frontend/mapbox-gl.css vendored Normal file
View file

@ -0,0 +1,299 @@
.mapboxgl-map {
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
overflow: hidden;
position: relative;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.mapboxgl-canvas-container.mapboxgl-interactive,
.mapboxgl-ctrl-nav-compass {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.mapboxgl-canvas-container.mapboxgl-interactive:active,
.mapboxgl-ctrl-nav-compass:active {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right { position:absolute; pointer-events:none; z-index:2; }
.mapboxgl-ctrl-top-left { top:0; left:0; }
.mapboxgl-ctrl-top-right { top:0; right:0; }
.mapboxgl-ctrl-bottom-left { bottom:0; left:0; }
.mapboxgl-ctrl-bottom-right { right:0; bottom:0; }
.mapboxgl-ctrl { clear:both; pointer-events:auto }
.mapboxgl-ctrl-top-left .mapboxgl-ctrl { margin:10px 0 0 10px; float:left; }
.mapboxgl-ctrl-top-right .mapboxgl-ctrl{ margin:10px 10px 0 0; float:right; }
.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl { margin:0 0 10px 10px; float:left; }
.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl { margin:0 10px 10px 0; float:right; }
.mapboxgl-ctrl-group {
border-radius: 4px;
-moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.1);
-webkit-box-shadow: 0px 0px 2px rgba(0,0,0,0.1);
box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);
overflow: hidden;
background: #fff;
}
.mapboxgl-ctrl-group > button {
width: 30px;
height: 30px;
display: block;
padding: 0;
outline: none;
border: none;
border-bottom: 1px solid #ddd;
box-sizing: border-box;
background-color: rgba(0,0,0,0);
cursor: pointer;
}
/* https://bugzilla.mozilla.org/show_bug.cgi?id=140562 */
.mapboxgl-ctrl > button::-moz-focus-inner {
border: 0;
padding: 0;
}
.mapboxgl-ctrl > button:last-child {
border-bottom: 0;
}
.mapboxgl-ctrl > button:hover {
background-color: rgba(0,0,0,0.05);
}
.mapboxgl-ctrl-icon,
.mapboxgl-ctrl-icon > span.arrow {
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.mapboxgl-ctrl-icon {
padding: 5px;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-out {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27m%207%2C9%20c%20-0.554%2C0%20-1%2C0.446%20-1%2C1%200%2C0.554%200.446%2C1%201%2C1%20l%206%2C0%20c%200.554%2C0%201%2C-0.446%201%2C-1%200%2C-0.554%20-0.446%2C-1%20-1%2C-1%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-in {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27M%2010%206%20C%209.446%206%209%206.4459904%209%207%20L%209%209%20L%207%209%20C%206.446%209%206%209.446%206%2010%20C%206%2010.554%206.446%2011%207%2011%20L%209%2011%20L%209%2013%20C%209%2013.55401%209.446%2014%2010%2014%20C%2010.554%2014%2011%2013.55401%2011%2013%20L%2011%2011%20L%2013%2011%20C%2013.554%2011%2014%2010.554%2014%2010%20C%2014%209.446%2013.554%209%2013%209%20L%2011%209%20L%2011%207%20C%2011%206.4459904%2010.554%206%2010%206%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%23333%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.watching {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%2300f%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-compass > span.arrow {
width: 20px;
height: 20px;
margin: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%0A%09%3Cpolygon%20fill%3D%27%23333333%27%20points%3D%276%2C9%2010%2C1%2014%2C9%27%2F%3E%0A%09%3Cpolygon%20fill%3D%27%23CCCCCC%27%20points%3D%276%2C11%2010%2C19%2014%2C11%20%27%2F%3E%0A%3C%2Fsvg%3E");
background-repeat: no-repeat;
display: inline-block;
}
.mapboxgl-ctrl.mapboxgl-ctrl-attrib {
padding: 0 5px;
background-color: rgba(255, 255, 255, .5);
margin: 0;
}
.mapboxgl-ctrl-attrib.compact {
padding-top: 2px;
padding-bottom: 2px;
margin: 0 10px 10px 10px;
position: relative;
padding-right: 24px;
background-color: #fff;
border-radius: 3px 12px 12px 3px;
visibility: hidden;
}
.mapboxgl-ctrl-attrib.compact:hover {
visibility: visible;
}
.mapboxgl-ctrl-attrib.compact:after {
content: '';
cursor: pointer;
position: absolute;
bottom: 0;
right: 0;
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%09%3Cpath%20fill%3D%27%23333333%27%20fill-rule%3D%27evenodd%27%20d%3D%27M4%2C10a6%2C6%200%201%2C0%2012%2C0a6%2C6%200%201%2C0%20-12%2C0%20M9%2C7a1%2C1%200%201%2C0%202%2C0a1%2C1%200%201%2C0%20-2%2C0%20M9%2C10a1%2C1%200%201%2C1%202%2C0l0%2C3a1%2C1%200%201%2C1%20-2%2C0%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
background-color: rgba(255, 255, 255, .5);
width: 24px;
height: 24px;
box-sizing: border-box;
visibility: visible;
border-radius: 12px;
}
.mapboxgl-ctrl-attrib a {
color: rgba(0,0,0,0.75);
text-decoration: none;
}
.mapboxgl-ctrl-attrib a:hover {
color: inherit;
text-decoration: underline;
}
.mapboxgl-ctrl-attrib .mapbox-improve-map {
font-weight: bold;
margin-left: 2px;
}
.mapboxgl-ctrl-scale {
background-color: rgba(255,255,255,0.75);
font-size: 10px;
border-width: medium 2px 2px;
border-style: none solid solid;
border-color: #333;
padding: 0 5px;
color: #333;
}
.mapboxgl-popup {
position: absolute;
top: 0;
left: 0;
display: -webkit-flex;
display: flex;
will-change: transform;
pointer-events: none;
}
.mapboxgl-popup-anchor-top,
.mapboxgl-popup-anchor-top-left,
.mapboxgl-popup-anchor-top-right {
-webkit-flex-direction: column;
flex-direction: column;
}
.mapboxgl-popup-anchor-bottom,
.mapboxgl-popup-anchor-bottom-left,
.mapboxgl-popup-anchor-bottom-right {
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
}
.mapboxgl-popup-anchor-left {
-webkit-flex-direction: row;
flex-direction: row;
}
.mapboxgl-popup-anchor-right {
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.mapboxgl-popup-tip {
width: 0;
height: 0;
border: 10px solid transparent;
z-index: 1;
}
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-top: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip {
-webkit-align-self: flex-start;
align-self: flex-start;
border-top: none;
border-left: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
-webkit-align-self: flex-end;
align-self: flex-end;
border-top: none;
border-right: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-bottom: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip {
-webkit-align-self: flex-start;
align-self: flex-start;
border-bottom: none;
border-left: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
-webkit-align-self: flex-end;
align-self: flex-end;
border-bottom: none;
border-right: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-left: none;
border-right-color: #fff;
}
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-right: none;
border-left-color: #fff;
}
.mapboxgl-popup-close-button {
position: absolute;
right: 0;
top: 0;
border: none;
border-radius: 0 3px 0 0;
cursor: pointer;
background-color: rgba(0,0,0,0);
}
.mapboxgl-popup-close-button:hover {
background-color: rgba(0,0,0,0.05);
}
.mapboxgl-popup-content {
position: relative;
background: #fff;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0,0,0,0.10);
padding: 10px 10px 15px;
pointer-events: auto;
}
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content {
border-top-left-radius: 0;
}
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content {
border-top-right-radius: 0;
}
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content {
border-bottom-left-radius: 0;
}
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content {
border-bottom-right-radius: 0;
}
.mapboxgl-marker {
position: absolute;
top: 0;
left: 0;
will-change: transform;
}
.mapboxgl-crosshair,
.mapboxgl-crosshair .mapboxgl-interactive,
.mapboxgl-crosshair .mapboxgl-interactive:active {
cursor: crosshair;
}
.mapboxgl-boxzoom {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
background: #fff;
border: 2px dotted #202020;
opacity: 0.5;
}
@media print {
.mapbox-improve-map {
display:none;
}
}

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -1,5 +0,0 @@
/*! store2 - v2.3.2 - 2015-10-27
* Copyright (c) 2015 Nathan Bubna; Licensed MIT, GPL */
!function(a,b){var c={version:"2.3.2",areas:{},apis:{},inherit:function(a,b){for(var c in a)b.hasOwnProperty(c)||(b[c]=a[c]);return b},stringify:function(a){return void 0===a||"function"==typeof a?a+"":JSON.stringify(a)},parse:function(a){try{return JSON.parse(a)}catch(b){return a}},fn:function(a,b){c.storeAPI[a]=b;for(var d in c.apis)c.apis[d][a]=b},get:function(a,b){return a.getItem(b)},set:function(a,b,c){a.setItem(b,c)},remove:function(a,b){a.removeItem(b)},key:function(a,b){return a.key(b)},length:function(a){return a.length},clear:function(a){a.clear()},Store:function(a,b,d){var e=c.inherit(c.storeAPI,function(a,b,c){return 0===arguments.length?e.getAll():void 0!==b?e.set(a,b,c):"string"==typeof a||"number"==typeof a?e.get(a):a?e.setAll(a,b):e.clear()});e._id=a;try{var f="_safariPrivate_";b.setItem(f,"sucks"),e._area=b,b.removeItem(f)}catch(g){}return e._area||(e._area=c.inherit(c.storageAPI,{items:{},name:"fake"})),e._ns=d||"",c.areas[a]||(c.areas[a]=e._area),c.apis[e._ns+e._id]||(c.apis[e._ns+e._id]=e),e},storeAPI:{area:function(a,b){var d=this[a];return d&&d.area||(d=c.Store(a,b,this._ns),this[a]||(this[a]=d)),d},namespace:function(a,b){if(!a)return this._ns?this._ns.substring(0,this._ns.length-1):"";var d=a,e=this[d];return e&&e.namespace||(e=c.Store(this._id,this._area,this._ns+d+"."),this[d]||(this[d]=e),b||e.area("session",c.areas.session)),e},isFake:function(){return"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(a){return this._area.has?this._area.has(this._in(a)):!!(this._in(a)in this._area)},size:function(){return this.keys().length},each:function(a,b){for(var d=0,e=c.length(this._area);e>d;d++){var f=this._out(c.key(this._area,d));if(void 0!==f&&a.call(this,f,b||this.get(f))===!1)break;e>c.length(this._area)&&(e--,d--)}return b||this},keys:function(){return this.each(function(a,b){b.push(a)},[])},get:function(a,b){var d=c.get(this._area,this._in(a));return null!==d?c.parse(d):b||d},getAll:function(){return this.each(function(a,b){b[a]=this.get(a)},{})},set:function(a,b,d){var e=this.get(a);return null!=e&&d===!1?b:c.set(this._area,this._in(a),c.stringify(b),d)||e},setAll:function(a,b){var c,d;for(var e in a)d=a[e],this.set(e,d,b)!==d&&(c=!0);return c},remove:function(a){var b=this.get(a);return c.remove(this._area,this._in(a)),b},clear:function(){return this._ns?this.each(function(a){c.remove(this._area,this._in(a))},1):c.clear(this._area),this},clearAll:function(){var a=this._area;for(var b in c.areas)c.areas.hasOwnProperty(b)&&(this._area=c.areas[b],this.clear());return this._area=a,this},_in:function(a){return"string"!=typeof a&&(a=c.stringify(a)),this._ns?this._ns+a:a},_out:function(a){return this._ns?a&&0===a.indexOf(this._ns)?a.substring(this._ns.length):void 0:a}},storageAPI:{length:0,has:function(a){return this.items.hasOwnProperty(a)},key:function(a){var b=0;for(var c in this.items)if(this.has(c)&&a===b++)return c},setItem:function(a,b){this.has(a)||this.length++,this.items[a]=b},removeItem:function(a){this.has(a)&&(delete this.items[a],this.length--)},getItem:function(a){return this.has(a)?this.items[a]:null},clear:function(){for(var a in this.list)this.removeItem(a)},toString:function(){return this.length+" items in "+this.name+"Storage"}}};a.store&&(c.conflict=a.store);var d=c.Store("local",function(){try{return localStorage}catch(a){}}());d.local=d,d._=c,d.area("session",function(){try{return sessionStorage}catch(a){}}()),a.store=d,"function"==typeof b&&void 0!==b.amd?b(function(){return d}):"undefined"!=typeof module&&module.exports&&(module.exports=d)}(this,this.define);
//# sourceMappingURL=store2.min.js.map

View file

@ -1,2 +0,0 @@
function getKeys(){for(var e=[],t=document.querySelectorAll("input[type=text], textarea"),r=0;r<t.length;r++){var o=getFormElement(t[r]);if(o!==!1){var n=o.id+"~"+t[r].id;e.push(n)}}return e}function getFormElement(e){if("body"!==e.nodeName.toLowerCase()){var t=e.parentNode;return"form"===t.nodeName.toLowerCase()?t:getFormElement(t)}return!1}var feature={addEventListener:!!window.addEventListener,querySelectorAll:!!document.querySelectorAll};if(feature.addEventListener&&feature.querySelectorAll)for(var keys=getKeys(),i=0;i<keys.length;i++)if(store.get(keys[i])){var formId=keys[i].split("~")[1];document.getElementById(formId).value=store.get(keys[i])}for(var timerId=window.setInterval(function(){for(var e=!1,t=document.querySelectorAll("input[type=text], textarea"),r=0;r<t.length;r++){var o=getFormElement(t[r]).id+"~"+t[r].id;store.get(o)!==t[r].value&&""!==t[r].value&&(store.set(o,t[r].value),e=!0)}e===!0&&(alertify.logPosition("top right"),alertify.success("Auto saved text"))},5e3),forms=document.querySelectorAll("form"),f=0;f<forms.length;f++){var form=forms[f];form.addEventListener("submit",function(){window.clearInterval(timerId);for(var e=form.id,t=store.keys(),r=0;r<t.length;r++)t[r].indexOf(e)>-1&&store.remove(t[r])})}
//# sourceMappingURL=public/assets/js/form-save.js.map

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
{"version":3,"sources":["resources/assets/js/form-save.js"],"names":["getKeys","keys","formFields","document","querySelectorAll","f","length","parent","getFormElement","key","id","push","elem","nodeName","toLowerCase","parentNode","feature","addEventListener","window","i","store","get","formId","split","getElementById","value","timerId","setInterval","saved","inputs","set","alertify","logPosition","success","forms","form","clearInterval","storedKeys","indexOf","remove"],"mappings":"AA6CA,QAASA,WAGL,IAAK,GAFDC,MACAC,EAAaC,SAASC,iBAAiB,8BAClCC,EAAI,EAAGA,EAAIH,EAAWI,OAAQD,IAAK,CACxC,GAAIE,GAASC,eAAeN,EAAWG,GACvC,IAAIE,KAAW,EAAO,CAClB,GAAIE,GAAMF,EAAOG,GAAK,IAAMR,EAAWG,GAAGK,EAC1CT,GAAKU,KAAKF,IAGlB,MAAOR,GAEX,QAASO,gBAAeI,GACpB,GAAoC,SAAhCA,EAAKC,SAASC,cAA0B,CACxC,GAAIP,GAASK,EAAKG,UAClB,OAAsC,SAAlCR,EAAOM,SAASC,cACTP,EAEAC,eAAeD,GAG1B,OAAO,EAjEf,GAAIS,UACAC,mBAAqBC,OAAOD,iBAC5Bb,mBAAqBD,SAASC,iBAGlC,IAAIY,QAAQC,kBAAoBD,QAAQZ,iBAEpC,IAAK,GADDH,MAAOD,UACFmB,EAAI,EAAGA,EAAIlB,KAAKK,OAAQa,IAC7B,GAAIC,MAAMC,IAAIpB,KAAKkB,IAAK,CACpB,GAAIG,QAASrB,KAAKkB,GAAGI,MAAM,KAAK,EAChCpB,UAASqB,eAAeF,QAAQG,MAAQL,MAAMC,IAAIpB,KAAKkB,IAqBnE,IAAK,GAhBDO,SAAUR,OAAOS,YAAY,WAG7B,IAAK,GAFDC,IAAQ,EACRC,EAAS1B,SAASC,iBAAiB,8BAC9Be,EAAI,EAAGA,EAAIU,EAAOvB,OAAQa,IAAK,CACpC,GAAIV,GAAMD,eAAeqB,EAAOV,IAAIT,GAAK,IAAMmB,EAAOV,GAAGT,EACrDU,OAAMC,IAAIZ,KAASoB,EAAOV,GAAGM,OAA6B,KAApBI,EAAOV,GAAGM,QAChDL,MAAMU,IAAIrB,EAAKoB,EAAOV,GAAGM,OACzBG,GAAQ,GAGZA,KAAU,IACVG,SAASC,YAAY,aACrBD,SAASE,QAAQ,qBAEtB,KACCC,MAAQ/B,SAASC,iBAAiB,QAC7BC,EAAI,EAAGA,EAAI6B,MAAM5B,OAAQD,IAAK,CACnC,GAAI8B,MAAOD,MAAM7B,EACjB8B,MAAKlB,iBAAiB,SAAU,WAC5BC,OAAOkB,cAAcV,QAGrB,KAAK,GAFDJ,GAASa,KAAKzB,GACd2B,EAAajB,MAAMnB,OACdkB,EAAI,EAAGA,EAAIkB,EAAW/B,OAAQa,IAC/BkB,EAAWlB,GAAGmB,QAAQhB,IAAU,GAChCF,MAAMmB,OAAOF,EAAWlB","file":"public/assets/js/form-save.js"}

View file

@ -1,2 +0,0 @@
for(var autolinker=new Autolinker,ytidregex=/watch\?v=([A-Za-z0-9\-_]+)/,spotifyregex=/https\:\/\/play\.spotify\.com\/(.*)\b/,notes=document.querySelectorAll(".e-content"),i=0;i<notes.length;i++){var ytid=notes[i].textContent.match(ytidregex);if(null!==ytid){var yid=ytid[1],yiframe=document.createElement("iframe");yiframe.classList.add("youtube"),yiframe.setAttribute("src","//www.youtube.com/embed/"+yid),yiframe.setAttribute("frameborder",0),yiframe.setAttribute("allowfullscreen","true"),notes[i].appendChild(yiframe)}var spotifyid=notes[i].textContent.match(spotifyregex);if(null!==spotifyid){var sid=spotifyid[1].replace("/",":"),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"),notes[i].appendChild(siframe)}var orig=notes[i].innerHTML,linked=autolinker.link(orig);notes[i].innerHTML=linked}
//# sourceMappingURL=public/assets/js/links.js.map

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
{"version":3,"sources":["resources/assets/js/links.js"],"names":["autolinker","Autolinker","ytidregex","spotifyregex","notes","document","querySelectorAll","i","length","ytid","textContent","match","yid","yiframe","createElement","classList","add","setAttribute","appendChild","spotifyid","sid","replace","siframe","orig","innerHTML","linked","link"],"mappings":"AAWA,IAAK,GATDA,YAAa,GAAIC,YAGjBC,UAAY,6BAEZC,aAAe,wCAGfC,MAAQC,SAASC,iBAAiB,cAC7BC,EAAI,EAAGA,EAAIH,MAAMI,OAAQD,IAAK,CAEnC,GAAIE,MAAOL,MAAMG,GAAGG,YAAYC,MAAMT,UACtC,IAAa,OAATO,KAAe,CACf,GAAIG,KAAMH,KAAK,GACXI,QAAUR,SAASS,cAAc,SACrCD,SAAQE,UAAUC,IAAI,WACtBH,QAAQI,aAAa,MAAO,2BAA6BL,KACzDC,QAAQI,aAAa,cAAe,GACpCJ,QAAQI,aAAa,kBAAmB,QACxCb,MAAMG,GAAGW,YAAYL,SAGzB,GAAIM,WAAYf,MAAMG,GAAGG,YAAYC,MAAMR,aAC3C,IAAkB,OAAdgB,UAAoB,CACpB,GAAIC,KAAMD,UAAU,GAAGE,QAAQ,IAAK,KAChCC,QAAUjB,SAASS,cAAc,SACrCQ,SAAQP,UAAUC,IAAI,WACtBM,QAAQL,aAAa,MAAO,0CAA4CG,KACxEE,QAAQL,aAAa,cAAe,GACpCK,QAAQL,aAAa,oBAAqB,QAC1Cb,MAAMG,GAAGW,YAAYI,SAGzB,GAAIC,MAAOnB,MAAMG,GAAGiB,UAChBC,OAASzB,WAAW0B,KAAKH,KAC7BnB,OAAMG,GAAGiB,UAAYC","file":"public/assets/js/links.js"}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
{"version":3,"sources":["resources/assets/js/maps.js"],"names":["mapDivs","document","querySelectorAll","mapboxgl","accessToken","i","length","mapDiv","latitude","dataset","longitude","el","createElement","classList","add","mapMenu","streetsInput","setAttribute","addEventListener","map","setStyle","streetsLabel","appendChild","createTextNode","satelliteInput","satelliteLabel","Map","container","style","center","zoom","scrollZoom","addControl","NavigationControl","Marker","offset","setLngLat","addTo"],"mappings":"AAEA,GAAIA,SAAUC,SAASC,iBAAiB,OACxCC,UAASC,YAAc,gGACvB,KAAK,GAAIC,GAAI,EAAGA,EAAIL,QAAQM,OAAQD,IAAK,CACrC,GAAIE,QAASP,QAAQK,GACjBG,SAAWD,OAAOE,QAAQD,SAC1BE,UAAaH,OAAOE,QAAQC,UAC5BC,GAAKV,SAASW,cAAc,MAChCD,IAAGE,UAAUC,IAAI,SACjB,IAAIC,SAAUd,SAASW,cAAc,MACrCG,SAAQF,UAAUC,IAAI,WACtB,IAAIE,cAAef,SAASW,cAAc,QAC1CI,cAAaC,aAAa,KAAM,WAChCD,aAAaC,aAAa,OAAQ,SAClCD,aAAaC,aAAa,OAAQ,UAClCD,aAAaC,aAAa,QAAS,WACnCD,aAAaC,aAAa,UAAW,WACrCD,aAAaE,iBAAiB,QAAS,WACnCC,IAAIC,SAAS,sCAEjB,IAAIC,cAAepB,SAASW,cAAc,QAC1CS,cAAaJ,aAAa,MAAO,WACjCI,aAAaC,YAAYrB,SAASsB,eAAe,WACjD,IAAIC,gBAAiBvB,SAASW,cAAc,QAC5CY,gBAAeP,aAAa,KAAM,aAClCO,eAAeP,aAAa,OAAQ,SACpCO,eAAeP,aAAa,OAAQ,UACpCO,eAAeP,aAAa,QAAS,WACrCO,eAAeN,iBAAiB,QAAS,WACrCC,IAAIC,SAAS,wCAEjB,IAAIK,gBAAiBxB,SAASW,cAAc,QAC5Ca,gBAAeR,aAAa,MAAO,aACnCQ,eAAeH,YAAYrB,SAASsB,eAAe,cACnDR,QAAQO,YAAYN,cACpBD,QAAQO,YAAYD,cACpBN,QAAQO,YAAYE,gBACpBT,QAAQO,YAAYG,eACpB,IAAIN,KAAM,GAAIhB,UAASuB,KACnBC,UAAWpB,OACXqB,MAAO,oCACPC,QAASnB,UAAWF,UACpBsB,KAAM,GACNC,YAAY,GAEhBZ,KAAIa,WAAW,GAAI7B,UAAS8B,mBAC5B,GAAI9B,UAAS+B,OAAOvB,IAAKwB,SAAS,IAAK,MAAOC,WAAW1B,UAAWF,WAAW6B,MAAMlB,KACrFZ,OAAOe,YAAYP","file":"public/assets/js/maps.js"}

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

View file

@ -1,2 +0,0 @@
function getLocation(){"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(function(t){updateForm(t.coords.latitude,t.coords.longitude),addMap(t.coords.latitude,t.coords.longitude)})}function updateForm(t,e){var o=document.querySelector("#latitude"),n=document.querySelector("#longitude");o.value=t,n.value=e}function addMap(t,e){var o=document.querySelector("form"),n=document.createElement("div");n.setAttribute("id","map"),o.appendChild(n),L.mapbox.accessToken="pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w";var a=L.mapbox.map("map","jonnybarnes.gnoihnim").setView([t,e],15).addLayer(L.mapbox.tileLayer("jonnybarnes.gnoihnim",{detectRetina:!0})),i=L.marker([t,e],{draggable:!0}).addTo(a);i.on("dragend",function(){var t=i.getLatLng();updateForm(t.lat,t.lng)})}var button=document.querySelector("#locate");button.addEventListener?button.addEventListener("click",getLocation):button.attachEvent("onclick",getLocation);
//# sourceMappingURL=public/assets/js/newplace.js.map

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
{"version":3,"sources":["resources/assets/js/newplace.js"],"names":["getLocation","navigator","geolocation","getCurrentPosition","position","updateForm","coords","latitude","longitude","addMap","inputLatitude","document","querySelector","inputLongitude","value","form","div","createElement","setAttribute","appendChild","L","mapbox","accessToken","map","setView","addLayer","tileLayer","detectRetina","marker","draggable","addTo","on","markerLocation","getLatLng","lat","lng","button","addEventListener","attachEvent"],"mappings":"AASA,QAASA,eACD,eAAiBC,YACjBA,UAAUC,YAAYC,mBAAmB,SAASC,GAC9CC,WAAWD,EAASE,OAAOC,SAAUH,EAASE,OAAOE,WACrDC,OAAOL,EAASE,OAAOC,SAAUH,EAASE,OAAOE,aAK7D,QAASH,YAAWE,EAAUC,GAC1B,GAAIE,GAAgBC,SAASC,cAAc,aACvCC,EAAiBF,SAASC,cAAc,aAC5CF,GAAcI,MAAQP,EACtBM,EAAeC,MAAQN,EAG3B,QAASC,QAAOF,EAAUC,GACtB,GAAIO,GAAOJ,SAASC,cAAc,QAC9BI,EAAML,SAASM,cAAc,MACjCD,GAAIE,aAAa,KAAM,OACvBH,EAAKI,YAAYH,GACjBI,EAAEC,OAAOC,YAAc,wEACvB,IAAIC,GAAMH,EAAEC,OAAOE,IAAI,MAAO,wBACzBC,SAASjB,EAAUC,GAAY,IAC/BiB,SAASL,EAAEC,OAAOK,UAAU,wBACzBC,cAAc,KAElBC,EAASR,EAAEQ,QAAQrB,EAAUC,IAC7BqB,WAAW,IACZC,MAAMP,EACTK,GAAOG,GAAG,UAAW,WACjB,GAAIC,GAAiBJ,EAAOK,WAC5B5B,YAAW2B,EAAeE,IAAKF,EAAeG,OAxCtD,GAAIC,QAASzB,SAASC,cAAc,UAEhCwB,QAAOC,iBACPD,OAAOC,iBAAiB,QAASrC,aAEjCoC,OAAOE,YAAY,UAAWtC","file":"public/assets/js/newplace.js"}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,136 @@
//mapbox-utils.js
import mapboxgl from 'mapbox-gl/dist/mapbox-gl.js';
import parseLocation from './parse-location';
import selectPlaceInForm from './select-place';
mapboxgl.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiY2l2cDhjYW04MDAwcjJ0cG1uZnhqcm82ayJ9.qA2zeVA-nsoMh9IFrd5KQw';
//define some functions to be used in the default function.
const titlecase = (string) => {
return string.split('-').map(([first,...rest]) => first.toUpperCase() + rest.join('').toLowerCase()).join(' ')
};
const addMapTypeOption = (map, menu, option, checked = false) => {
let input = document.createElement('input');
input.setAttribute('id', option);
input.setAttribute('type', 'radio');
input.setAttribute('name', 'toggle');
input.setAttribute('value', option);
if (checked == true) {
input.setAttribute('checked', 'checked');
}
input.addEventListener('click', function () {
map.setStyle('mapbox://styles/mapbox/' + option + '-v9');
});
let label = document.createElement('label');
label.setAttribute('for', option);
label.appendChild(document.createTextNode(titlecase(option)));
menu.appendChild(input);
menu.appendChild(label);
}
const makeMapMenu = (map) => {
let mapMenu = document.createElement('div');
mapMenu.classList.add('map-menu');
addMapTypeOption(map, mapMenu, 'streets', true);
addMapTypeOption(map, mapMenu, 'satellite-streets');
return mapMenu;
}
//the main function
export default function addMap(div, position = null, places = null) {
let dataLatitude = div.dataset.latitude;
let dataLongitude = div.dataset.longitude;
let dataId = div.dataset.id;
let data = window['geojson'+dataId];
if (data == null) {
data = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [dataLongitude, dataLatitude]
},
"properties": {
"title": "Current Location",
"icon": "circle-stroked",
"uri": "current-location"
}
}]
};
}
if (places != null) {
for (let place of places) {
let placeLongitude = parseLocation(place.location).longitude;
let placeLatitude = parseLocation(place.location).latitude;
data.features.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [placeLongitude, placeLatitude]
},
"properties": {
"title": place.name,
"icon": "circle",
"uri": place.slug
}
});
}
}
if (position != null) {
let dataLongitude = position.coords.longitude;
let dataLatitude = position.coords.latitude;
}
let map = new mapboxgl.Map({
container: div,
style: 'mapbox://styles/mapbox/streets-v9',
center: [dataLongitude, dataLatitude],
zoom: 15
});
if (position == null) {
map.scrollZoom.disable();
}
map.addControl(new mapboxgl.NavigationControl());
div.appendChild(makeMapMenu(map));
map.on('load', function () {
map.addSource('points', {
"type": "geojson",
"data": data
});
map.addLayer({
"id": "points",
"interactive": true,
"type": "symbol",
"source": "points",
"layout": {
"icon-image": "{icon}-15",
"text-field": "{title}",
"text-offset": [0, 1]
}
});
});
if (position != null) {
map.on('click', function (e) {
let features = map.queryRenderedFeatures(e.point, {
layer: ['points']
});
// if there are features within the given radius of the click event,
// fly to the location of the click event
if (features.length) {
// Get coordinates from the symbol and center the map on those coordinates
map.flyTo({center: features[0].geometry.coordinates});
selectPlaceInForm(features[0].properties.uri);
}
});
}
if (data.features && data.features.length > 1) {
let bounds = new mapboxgl.LngLatBounds();
for (let feature of data.features) {
bounds.extend(feature.geometry.coordinates);
}
map.fitBounds(bounds, { padding: 65});
}
return map;
}

View file

@ -0,0 +1,8 @@
//maps.js
import addMapTo from './mapbox-utils';
let mapDivs = document.querySelectorAll('.map');
for (var div of mapDivs) {
addMapTo(div);
}

View file

@ -0,0 +1,80 @@
//nearby-places.js
import alertify from 'alertify.js';
import addMap from './mapbox-utils';
import parseLocation from './parse-location';
import makeNewPlaceForm from './newplace-micropub';
const makeOptionsForForm = (map, position, places = null) => {
//create the <select> element and give it a no location default
let selectElement = document.createElement('select');
selectElement.setAttribute('name', 'location');
let noLocationOption = document.createElement('option');
noLocationOption.setAttribute('selected', 'selected');
noLocationOption.setAttribute('value', 'no-location');
noLocationOption.appendChild(document.createTextNode('Dont send location'));
selectElement.appendChild(noLocationOption);
let geoLocationOption = document.createElement('option');
geoLocationOption.setAttribute('id', 'option-coords');
geoLocationOption.setAttribute('value', 'geo:' + position.coords.latitude + ',' + position.coords.longitude);
geoLocationOption.dataset.latitude = position.coords.latitude;
geoLocationOption.dataset.longitude = position.coords.longitude;
geoLocationOption.appendChild(document.createTextNode('Send co-ordinates'));
selectElement.appendChild(geoLocationOption);
if (places != null) {
for (let place of places) {
let parsedCoords = parseLocation(place.location);
let option = document.createElement('option');
option.setAttribute('value', place.slug);
option.dataset.latitude = parsedCoords.latitude;
option.dataset.longitude = parsedCoords.longitude;
option.appendChild(document.createTextNode(place.name));
selectElement.appendChild(option);
}
}
//add an event listener
selectElement.addEventListener('change', function () {
if (selectElement.value !== 'no-location') {
let optionLatitude = selectElement[selectElement.selectedIndex].dataset.latitude;
let optionLongitude = selectElement[selectElement.selectedIndex].dataset.longitude;
map.flyTo({center: [optionLongitude, optionLatitude]});
}
});
return selectElement
}
//position is output of navigator.geolocation call
export default function addMapWithPlaces(div, position) {
fetch('/places/near/' + position.coords.latitude + '/' + position.coords.longitude + '?u=' + position.coords.accuracy, {
credentials: 'same-origin',
method: 'get'
}).then(function (response) {
if (response.ok) {
return response.json();
} else {
alertify.reset();
alertify.error('Non OK response');
}
}).then(function (json) {
if (json.error == true) {
alertify.reset();
alertify.error(json.error_description);
}
let places = null;
if (json.places.length > 0) {
places = json.places;
}
let map = addMap(div, position, places);
//create a containting div for flexbox styling purposes
let flexboxDiv = document.createElement('div');
let options = makeOptionsForForm(map, position, places);
flexboxDiv.appendChild(options);
let newPlaceForm = makeNewPlaceForm(map);
flexboxDiv.appendChild(newPlaceForm);
let form = document.querySelector('fieldset');
form.insertBefore(flexboxDiv, document.querySelector('.map'));
}).catch(function (error) {
console.error(error);
});
}

View file

@ -0,0 +1,14 @@
//newnote-button.js
import getLocation from './newnote-getlocation';
export default function enableLocateButton(button) {
if ('geolocation' in navigator) {
if (button.addEventListener) {
//if we have javascript, event listeners and geolocation
//make the locate button clickable and add event
button.disabled = false;
button.addEventListener('click', getLocation);
}
}
}

View file

@ -0,0 +1,16 @@
//newnote-getlocation.js
import addMapWithPlaces from './nearby-places';
export default function getLocation() {
let container = document.querySelector('fieldset');
let mapDiv = document.createElement('div');
mapDiv.classList.add('map');
container.appendChild(mapDiv);
navigator.geolocation.getCurrentPosition(function (position) {
mapDiv.dataset.latitude = position.coords.latitude;
mapDiv.dataset.longitude = position.coords.longitude;
mapDiv.dataset.accuracy = position.coords.accuracy;
addMapWithPlaces(mapDiv, position);
});
}

View file

@ -0,0 +1,8 @@
//newnote.js
import enableLocateButton from './newnote-button';
import persistFormData from './persist-form';
let button = document.querySelector('#locate');
enableLocateButton(button);
persistFormData();

View file

@ -0,0 +1,134 @@
//newplace-micropub.js
import submitNewPlace from './submit-place';
export default function makeNewPlaceForm(map) {
//add a button to add a new place
let newLocationButton = document.createElement('button');
newLocationButton.setAttribute('type', 'button');
newLocationButton.setAttribute('id', 'create-new-place');
newLocationButton.appendChild(document.createTextNode('Create New Place?'));
//the event listener
newLocationButton.addEventListener('click', function() {
//add the form elements
let newPlaceNameDiv = document.createElement('div');
let newPlaceNameLabel = document.createElement('label');
newPlaceNameLabel.setAttribute('for', 'place-name');
newPlaceNameLabel.classList.add('place-label');
newPlaceNameLabel.appendChild(document.createTextNode('Name:'));
let newPlaceNameInput = document.createElement('input');
newPlaceNameInput.setAttribute('placeholder', 'Name');
newPlaceNameInput.setAttribute('name', 'place-name');
newPlaceNameInput.setAttribute('id', 'place-name');
newPlaceNameInput.setAttribute('type', 'text');
newPlaceNameDiv.appendChild(newPlaceNameLabel);
newPlaceNameDiv.appendChild(newPlaceNameInput);
let newPlaceDescDiv = document.createElement('div');
let newPlaceDescLabel = document.createElement('label');
newPlaceDescLabel.setAttribute('for', 'place-description');
newPlaceDescLabel.classList.add('place-label');
newPlaceDescLabel.appendChild(document.createTextNode('Description:'));
let newPlaceDescInput = document.createElement('input');
newPlaceDescInput.setAttribute('placeholder', 'Description');
newPlaceDescInput.setAttribute('name', 'place-description');
newPlaceDescInput.setAttribute('id', 'place-description');
newPlaceDescInput.setAttribute('type', 'text');
newPlaceDescDiv.appendChild(newPlaceDescLabel);
newPlaceDescDiv.appendChild(newPlaceDescInput);
let newPlaceLatitudeDiv = document.createElement('div');
var newPlaceLatitudeLabel = document.createElement('label');
newPlaceLatitudeLabel.setAttribute('for', 'place-latitude');
newPlaceLatitudeLabel.classList.add('place-label');
newPlaceLatitudeLabel.appendChild(document.createTextNode('Latitude:'));
let newPlaceLatitudeInput = document.createElement('input');
newPlaceLatitudeInput.setAttribute('name', 'place-latitude');
newPlaceLatitudeInput.setAttribute('id', 'place-latitude');
newPlaceLatitudeInput.setAttribute('type', 'text');
newPlaceLatitudeInput.value = map.getCenter().lat;
newPlaceLatitudeDiv.appendChild(newPlaceLatitudeLabel);
newPlaceLatitudeDiv.appendChild(newPlaceLatitudeInput);
let newPlaceLongitudeDiv = document.createElement('div');
let newPlaceLongitudeLabel = document.createElement('label');
newPlaceLongitudeLabel.setAttribute('for', 'place-longitude');
newPlaceLongitudeLabel.classList.add('place-label');
newPlaceLongitudeLabel.appendChild(document.createTextNode('Longitude:'));
let newPlaceLongitudeInput = document.createElement('input');
newPlaceLongitudeInput.setAttribute('name', 'place-longitude');
newPlaceLongitudeInput.setAttribute('id', 'place-longitude');
newPlaceLongitudeInput.setAttribute('type', 'text');
newPlaceLongitudeInput.value = map.getCenter().lng;
newPlaceLongitudeDiv.appendChild(newPlaceLongitudeLabel);
newPlaceLongitudeDiv.appendChild(newPlaceLongitudeInput);
let newPlaceSubmit = document.createElement('button');
newPlaceSubmit.setAttribute('id', 'place-submit');
newPlaceSubmit.setAttribute('name', 'place-submit');
newPlaceSubmit.setAttribute('type', 'button');
newPlaceSubmit.appendChild(document.createTextNode('Submit New Place'));
newPlaceSubmit.addEventListener('click', function () {
submitNewPlace(map);
});
let form = document.querySelector('fieldset');
form.appendChild(newPlaceNameDiv);
form.appendChild(newPlaceDescDiv);
form.appendChild(newPlaceLatitudeDiv);
form.appendChild(newPlaceLongitudeDiv);
form.appendChild(newPlaceSubmit);
//the event listener for the new place form
/*placeSubmit.addEventListener('click', function () {
//create the form data to send
var formData = new FormData();
formData.append('place-name', document.querySelector('#place-name').value);
formData.append('place-description', document.querySelector('#place-description').value);
formData.append('place-latitude', document.querySelector('#place-latitude').value);
formData.append('place-longitude', document.querySelector('#place-longitude').value);
//post the new place
fetch('/places/new', {
//send cookies with the request
credentials: 'same-origin',
method: 'post',
body: formData
})
.then(function (response) {
return response.json();
})
.then(function (placeJson) {
if (placeJson.error === true) {
throw new Error(placeJson.error_description);
}
//remove un-needed form elements
//iterate through labels and remove parent div elements
var labels = document.querySelectorAll('.place-label');
for (var i = 0; i < labels.length; ++i) {
form.removeChild(labels[i].parentNode);
}
form.removeChild(document.querySelector('#place-submit'));
var newPlaceButton = document.querySelector('#create-new-place');
//in order to remove a DOM Node, you need to run removeChild on the parent Node
newPlaceButton.parentNode.removeChild(newPlaceButton);
//add place marker
var newOption = document.createElement('option');
newOption.setAttribute('value', placeJson.uri);
newOption.appendChild(document.createTextNode(placeJson.name));
newOption.dataset.latitude = placeJson.latitude;
newOption.dataset.longitude = placeJson.longitude;
selectEl.appendChild(newOption);
var newPlaceMarkerIcon = document.createElement('div');
newPlaceMarkerIcon.classList.add('marker');
new mapboxgl.Marker(newPlaceMarkerIcon, {offset: [-10, -20]}).setLngLat([placeJson.longitude, placeJson.latitude]).addTo(map);
map.flyTo({center: [placeJson.longitude, placeJson.latitude]});
newPlaceMarkerIcon.addEventListener('click', function () {
map.flyTo({center: [placeJson.longitude, placeJson.latitude]});
selectPlace(placeJson.uri);
});
//make selected
selectPlace(placeJson.uri);
}).catch(function (placeError) {
alertify.reset();
alertify.error(placeError);
});
});*/
});
return newLocationButton;
}

View file

@ -0,0 +1,10 @@
//parse-location.js
//text = `POINT(lon lat)`
export default function parseLocation(text) {
let coords = /POINT\((.*)\)/.exec(text);
let parsedLongitude = coords[1].split(' ')[0];
let parsedLatitude = coords[1].split(' ')[1];
return {'latitude': parsedLatitude, 'longitude': parsedLongitude};
}

View file

@ -0,0 +1,32 @@
//persist-form.js
import webStorage from 'webStorage';
import alertify from 'alertify.js';
const loadData = () => {
let replyTo = document.querySelector('#in-reply-to');
replyTo.value = webStorage.getItem('replyTo');
let content = document.querySelector('#content');
content.value = webStorage.getItem('content');
}
const saveData = () => {
let replyTo = document.querySelector('#in-reply-to');
let content = document.querySelector('#content');
webStorage.setItem('replyTo', replyTo.value);
webStorage.setItem('content', content.value);
alertify.success('Auto-saved data');
}
const clearData = () => {
webStorage.removeItem('replyTo');
webStorage.removeItem('content');
}
export default function persistFormData()
{
let form = document.querySelector('form[name="micropub"]');
form.addEventListener('change', saveData);
form.addEventListener('submit', clearData);
loadData();
}

View file

@ -0,0 +1,11 @@
//select-place.js
export default function selectPlaceInForm(uri) {
if (document.querySelector('select')) {
if (uri == 'current-location') {
document.querySelector('select [id="option-coords"]').selected = true
} else {
document.querySelector('select [value="' + uri + '"]').selected = true
}
}
}

View file

@ -0,0 +1,71 @@
//submit-place.js
import alertify from 'alertify.js';
export default function submitNewPlace(map) {
//create the form data to send
let formData = new FormData();
formData.append('place-name', document.querySelector('#place-name').value);
formData.append('place-description', document.querySelector('#place-description').value);
formData.append('place-latitude', document.querySelector('#place-latitude').value);
formData.append('place-longitude', document.querySelector('#place-longitude').value);
//post the new place
fetch('/places/new', {
//send cookies with the request
credentials: 'same-origin',
method: 'post',
body: formData
}).then(function (response) {
return response.json();
}).then(function (placeJson) {
if (placeJson.error === true) {
throw new Error(placeJson.error_description);
}
//remove un-needed form elements
let form = document.querySelector('fieldset');
//iterate through labels and remove parent div elements
let labels = document.querySelectorAll('.place-label');
for (let label of labels) {
form.removeChild(label.parentNode);
}
form.removeChild(document.querySelector('#place-submit'));
let newPlaceButton = document.querySelector('#create-new-place');
//in order to remove a DOM Node, you need to run removeChild on the parent Node
newPlaceButton.parentNode.removeChild(newPlaceButton);
//remove current location from map
let source = map.getSource('points');
let newFeatures = source._data.features.filter(function (item) {
return item.properties.title != 'Current Location';
});
//add new place to map
newFeatures.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [placeJson.longitude, placeJson.latitude]
},
"properties": {
"title": placeJson.name,
"icon": "circle",
"uri": placeJson.uri
}
});
let newSource = {
"type": "FeatureCollection",
"features": newFeatures
}
map.getSource('points').setData(newSource);
//add new place to select menu
let selectElement = document.querySelector('select');
let newlyCreatedPlaceOption = document.createElement('option');
newlyCreatedPlaceOption.setAttribute('value', placeJson.uri);
newlyCreatedPlaceOption.appendChild(document.createTextNode(placeJson.name));
newlyCreatedPlaceOption.dataset.latitude = placeJson.latitude;
newlyCreatedPlaceOption.dataset.longitude = placeJson.longitude;
selectElement.appendChild(newlyCreatedPlaceOption);
document.querySelector('select [value="' + placeJson.uri + '"]').selected = true;
}).catch(function (placeError) {
alertify.reset();
alertify.error(placeError);
});
}

View file

@ -19,11 +19,11 @@ Notes «
@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 src="/assets/frontend/Autolinker.min.js"></script>
<script 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">
@ -32,7 +32,7 @@ Notes «
@section('bio')
@if ($homepage === true)
<div class="h-card">
<p>My name is <span class="p-name p-author">Jonny Barnes</span>, and Im from <a href="https://en.wikipedia.org/wiki/Manchester" class="h-adr p-adr"><span class="p-locality">Manchester</span>, <abbr class="p-country-name" title="United Kingdom">UK</abbr></a>.</p>
<p>My name is <span class="p-name p-author">Jonny Barnes</span>, and <a rel="me" href="https://jonnybarnes.uk" class="u-url"><code>jonnybarnes.uk</code></a> is my site. Im from <a href="https://en.wikipedia.org/wiki/Manchester" class="h-adr p-adr"><span class="p-locality">Manchester</span>, <abbr class="p-country-name" title="United Kingdom">UK</abbr></a>.</p>
<p>I am active to varying degrees on several <a href="https://indieweb.org/silo">silos</a>:</p>
<ul class="social-list">
<li>I keep in touch with friends on <a rel="me" href="https://www.facebook.com/jonnybarnes" class="u-url">Facebook</a></li>

View file

@ -26,19 +26,19 @@ New Note «
@endif
@include('templates.new-note-form', [
'micropub' => true,
'action' => '/notes/new',
'id' => 'newnote'
'action' => '/notes/new'
])
@stop
@section('scripts')
@include('templates.mapbox-links')
<script src="/assets/frontend/fetch.js"></script>
<script src="/assets/frontend/store2.min.js"></script>
<script src="/assets/frontend/alertify.js"></script>
<script src="/assets/js/form-save.js"></script>
<script src="/assets/js/newnote.js"></script>
<script>
window.Promise || document.write('<script src="https://unpkg.com/promise-polyfill/promise.min.js"><\/script>');
window.fetch || document.write('<script src="https://unpkg.com/whatwg-fetch/fetch.js"><\/script>');
</script>
<!--<script src="/assets/frontend/store2.min.js"></script>
<script src="/assets/js/form-save.js"></script>-->
<script defer src="/assets/js/newnote.js"></script>
<link rel="stylesheet" href="/assets/frontend/alertify.css">
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
@stop

View file

@ -1,2 +1,2 @@
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.css" integrity="sha384-dCW/5IRoXPf5hkwrejBih/Unwf0nefL7NDk8hFitylhgPyk1YB4K9nwT5thMO2lV" crossorigin="anonymous">
<script src="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.js" integrity="sha384-Q8pgRmod5Yo3TQg5NSTfk4lNXS6Seqm160e2XA+RXpgGqdGOzX5c+UU6IoohcdWZ" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.css">
<script src="https://api.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.js" ></script>

View file

@ -1,4 +1,4 @@
<form action="{{ $action }}" method="post" enctype="multipart/form-data" accept-charset="utf-8" id="{{ $id }}">
<form action="{{ $action }}" method="post" enctype="multipart/form-data" accept-charset="utf-8"@if($micropub) name="micropub"@endif>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<fieldset class="note-ui">
<legend>New Note</legend>

View file

@ -26,6 +26,7 @@
</div>
</div>
@if ($note->placeLink)
<div class="map" data-latitude="{{ $note->latitude }}" data-longitude="{{ $note->longitude }}"></div>
<div class="map" data-latitude="{{ $note->latitude }}" data-longitude="{{ $note->longitude }}" data-id="{{ $note->nb60id }}"></div>
<script>var geojson{{ $note->nb60id }} = {!! $note->geoJson !!};</script>
@endif
</div>

34
webpack.config.js Normal file
View file

@ -0,0 +1,34 @@
const webpack = require('webpack');
const config = {
context: __dirname + '/resources/assets/es6',
entry: {
//app: './app.js',
maps: './maps.js',
newnote: './newnote.js'
},
output: {
path: __dirname + '/public/assets/js',
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: __dirname + '/node_modules/',
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: true,
mangle: {
except: ['fetch', 'map'],
screw_ie8: true
}
})
]
};
module.exports = config;

2530
yarn.lock

File diff suppressed because it is too large Load diff