Merge branch 'release/0.12.5'
This commit is contained in:
commit
0ca03d778c
16 changed files with 91 additions and 568 deletions
|
@ -462,7 +462,7 @@ class Note extends Model
|
||||||
$name = str_replace('#', '', $name);
|
$name = str_replace('#', '', $name);
|
||||||
$replacements[$name] =
|
$replacements[$name] =
|
||||||
'<a rel="tag" class="p-category" href="/notes/tagged/'
|
'<a rel="tag" class="p-category" href="/notes/tagged/'
|
||||||
. Tag::normalizeTag($name)
|
. Tag::normalize($name)
|
||||||
. '">#'
|
. '">#'
|
||||||
. $name
|
. $name
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
76
app/Observers/NoteObserver.php
Normal file
76
app/Observers/NoteObserver.php
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\{Note, Tag};
|
||||||
|
|
||||||
|
class NoteObserver
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Listen to the Note created event.
|
||||||
|
*
|
||||||
|
* @param \App\Note $note
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function created(Note $note)
|
||||||
|
{
|
||||||
|
$tags = $this->getTagsFromNote($note->getAttributes()['note']);
|
||||||
|
|
||||||
|
if (count($tags) === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tags->transform(function ($tag) {
|
||||||
|
return Tag::firstOrCreate(['tag' => $tag]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$note->tags()->attach($tags->map(function ($tag) {
|
||||||
|
return $tag->id;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen to the Note updated event.
|
||||||
|
*
|
||||||
|
* @param \App\Note $Note
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updated(Note $note)
|
||||||
|
{
|
||||||
|
$tags = $this->getTagsFromNote($note->getAttributes()['note']);
|
||||||
|
if (count($tags) === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tags->transform(function ($tag) {
|
||||||
|
return Tag::firstOrCreate(['tag' => $tag]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$note->tags()->sync($tags->map(function ($tag) {
|
||||||
|
return $tag->id;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listen to the Note deleting event.
|
||||||
|
*
|
||||||
|
* @param \App\Note $note
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleting(Note $note)
|
||||||
|
{
|
||||||
|
$note->tags()->detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTagsFromNote($note)
|
||||||
|
{
|
||||||
|
preg_match_all('/#([^\s<>]+)\b/', $note, $tags);
|
||||||
|
if (array_get($tags, '1') === null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return collect($tags[1])->map(function ($tag) {
|
||||||
|
return Tag::normalize($tag);
|
||||||
|
})->unique();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Tag;
|
|
||||||
use App\Note;
|
use App\Note;
|
||||||
use Validator;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use App\Observers\NoteObserver;
|
||||||
use Laravel\Dusk\DuskServiceProvider;
|
use Laravel\Dusk\DuskServiceProvider;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
@ -18,35 +17,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
// Validate photos for a maximum filesize
|
Note::observe(NoteObserver::class);
|
||||||
Validator::extend('photosize', function ($attribute, $value, $parameters, $validator) {
|
|
||||||
if ($value[0] !== null) {
|
|
||||||
foreach ($value as $file) {
|
|
||||||
if ($file->getSize() > 5000000) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
//Add tags for notes
|
|
||||||
Note::created(function ($note) {
|
|
||||||
$tagsToAdd = [];
|
|
||||||
preg_match_all('/#([^\s<>]+)\b/', $note->note, $tags);
|
|
||||||
foreach ($tags[1] as $tag) {
|
|
||||||
$tag = Tag::normalizeTag($tag);
|
|
||||||
}
|
|
||||||
$tags = array_unique($tags[1]);
|
|
||||||
foreach ($tags as $tag) {
|
|
||||||
$tag = Tag::firstOrCreate(['tag' => $tag]);
|
|
||||||
$tagsToAdd[] = $tag->id;
|
|
||||||
}
|
|
||||||
if (count($tagsToAdd) > 0) {
|
|
||||||
$note->tags()->attach($tagsToAdd);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Request AS macro
|
// Request AS macro
|
||||||
Request::macro('wantsActivityStream', function () {
|
Request::macro('wantsActivityStream', function () {
|
||||||
|
|
18
app/Tag.php
18
app/Tag.php
|
@ -6,13 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The database table used by the model.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $table = 'tags';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the relationship with tags.
|
* Define the relationship with tags.
|
||||||
*
|
*
|
||||||
|
@ -31,13 +24,6 @@ class Tag extends Model
|
||||||
return $this->belongsToMany('App\Bookmark');
|
return $this->belongsToMany('App\Bookmark');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes excluded from the model's JSON form.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $hidden = ['deleted'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We shall set a blacklist of non-modifiable model attributes.
|
* We shall set a blacklist of non-modifiable model attributes.
|
||||||
*
|
*
|
||||||
|
@ -52,7 +38,7 @@ class Tag extends Model
|
||||||
*/
|
*/
|
||||||
public function setTagAttribute($value)
|
public function setTagAttribute($value)
|
||||||
{
|
{
|
||||||
$this->attributes['tag'] = $this->normalizeTag($value);
|
$this->attributes['tag'] = $this->normalize($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +47,7 @@ class Tag extends Model
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
public static function normalizeTag($tag)
|
public static function normalize($tag)
|
||||||
{
|
{
|
||||||
return mb_strtolower(
|
return mb_strtolower(
|
||||||
preg_replace(
|
preg_replace(
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 0.12.5 (2017-11-09)
|
||||||
|
- Fix style of tags on bookmarks page that had been visited
|
||||||
|
- Fix style of notes listed on `/notes/tagged/tag`
|
||||||
|
- Move code manging tagging of notes to NoteObserver
|
||||||
|
|
||||||
## Version 0.12.4 (2017-11-07)
|
## Version 0.12.4 (2017-11-07)
|
||||||
- Pull in newer version of my linkify extension to fix errors
|
- Pull in newer version of my linkify extension to fix errors
|
||||||
|
|
||||||
|
|
2
public/assets/css/app.css
vendored
2
public/assets/css/app.css
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
{"version":3,"sources":["../../../resources/assets/sass/_border-box.scss","../../../resources/assets/sass/_base-font.scss","../../../resources/assets/sass/_header.scss","../../../resources/assets/sass/_variables.scss","../../../resources/assets/sass/_main.scss","../../../resources/assets/sass/_hovercard.scss","../../../resources/assets/sass/_notes.scss","../../../resources/assets/sass/_pagination.scss","../../../resources/assets/sass/_contacts-page.scss","../../../resources/assets/sass/_projects.scss","../../../resources/assets/sass/_footer.scss","../../../resources/assets/sass/_bridgy-links.scss","../../../resources/assets/sass/_emoji.scss","../../../resources/assets/sass/_mapbox.scss","../../../resources/assets/sass/_colors.scss","../../../resources/assets/sass/_styles.scss","../../../resources/assets/sass/_tags.scss"],"names":[],"mappings":"AAKA,KACI,8BAAsB,AAAtB,qBAAsB,CACzB,qBAKG,2BAAmB,AAAnB,kBAAmB,CACtB,KCVG,eACA,yBAA0B,CAC7B,gBAGG,oBAAqB,CACxB,WCNG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,kBACA,AADA,cACA,yBACA,AADA,sBACA,AADA,mBACA,WACA,eCJgB,CDKnB,cAGG,eACA,cAAe,CAClB,eAGG,cAAe,CAClB,KEdG,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,0BACA,AADA,uBACA,AADA,oBACA,gBACA,cACA,gBAAiB,CACpB,SAGG,cAAe,CAClB,WAIG,gBAAiB,CACpB,aCfG,iBAAkB,CACrB,qBAGG,iBAAkB,CACrB,2BAGG,WAAY,CACf,8BAGG,oBAAa,AAAb,oBAAa,AAAb,YAAa,CAChB,WAGG,kBACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,yBACA,AADA,sBACA,AADA,8BACA,sBACA,AADA,mBACA,AADA,qBACA,iBACA,YACA,WACA,UACA,WACA,uBACA,kBACA,2CACA,AADA,mCACA,YAAa,CAChB,0BAGG,WACA,WAAY,CACf,sBAGG,YAAa,CCnCjB,MACI,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,cAAe,CAClB,UAGG,eACA,eAAgB,CACnB,eAGG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,yBAA8B,AAA9B,sBAA8B,AAA9B,6BAA8B,CACjC,MAGG,WACA,UAAW,CACd,YCtBG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,8BACA,AADA,2BACA,AADA,6BACA,eACA,oBAAqB,CACxB,cCLG,eACA,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,8BACA,AADA,+BACA,AADA,2BACA,yBACA,AADA,sBACA,AADA,8BACA,eAAgB,CACnB,kBAGG,WACA,WAAY,CACf,UCVG,cAAe,CAClB,gBCDG,gBACA,cACA,gBAAiB,CACpB,OAGG,gBACA,cACA,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,yBAAmB,AAAnB,sBAAmB,AAAnB,kBAAmB,CACtB,qDCVG,YAAa,CAChB,sDCCG,iBAAkB,CACrB,gFAIG,kBACA,cACA,UACA,aACA,OACA,cACA,qBACA,yBACA,oBACA,4CACA,AADA,oCACA,yBACA,kCACA,WACA,cACA,0CAAkC,AAAlC,iCAAkC,CACrC,2BAGG,KACI,aACA,6BACA,wCACA,0BACA,8BAAkC,AAAlC,qBAAkC,CAGtC,GACI,aACA,kCACA,yBACA,WACA,4CAAgD,AAAhD,mCAAgD,CAAA,CAIxD,AApBC,mBAGG,KACI,aACA,6BACA,wCACA,0BACA,8BAAkC,AAAlC,qBAAkC,CAGtC,GACI,aACA,kCACA,yBACA,WACA,4CAAgD,AAAhD,mCAAgD,CAAA,CAIxD,aACI,kCACI,kCAAmC,CACtC,CC/CL,KACI,YAAa,CAChB,oBAGG,kBAAmB,CACtB,QAGG,y4HACA,wBACA,WACA,WAAY,CACf,UAGG,kBACA,MACA,OACA,iBACA,cAAe,CAClB,gBAGG,gBACA,gBAAiB,CACpB,KCzBG,gCACA,kBAAmB,CACtB,WAGG,8BACA,kBAAmB,CACtB,YAIG,iBAAkB,CACrB,aCZG,oBAAqB,CACxB,KAGG,oBAAqB,CACxB,MCHG,SACA,gBACA,SAAU,CACb,SAGG,WACA,oBAAqB,CACxB,KAGG,wBACA,0BACA,mBACA,qBACA,cACA,mBACA,sBACA,kBACA,qBACA,qBACA,8BAAsB,AAAtB,qBAAsB,CACzB,YAGG,0BACA,uCACA,oCACA,oCACA,WACA,kBACA,QACA,KAAM,CACT,WAGG,4BACA,kBAAmB,CACtB,kBAGG,4BAA6B,CAChC","file":"app.css"}
|
{"version":3,"sources":["../../../resources/assets/sass/_border-box.scss","../../../resources/assets/sass/_base-font.scss","../../../resources/assets/sass/_header.scss","../../../resources/assets/sass/_variables.scss","../../../resources/assets/sass/_main.scss","../../../resources/assets/sass/_hovercard.scss","../../../resources/assets/sass/_notes.scss","../../../resources/assets/sass/_pagination.scss","../../../resources/assets/sass/_contacts-page.scss","../../../resources/assets/sass/_projects.scss","../../../resources/assets/sass/_footer.scss","../../../resources/assets/sass/_bridgy-links.scss","../../../resources/assets/sass/_emoji.scss","../../../resources/assets/sass/_mapbox.scss","../../../resources/assets/sass/_colors.scss","../../../resources/assets/sass/_styles.scss","../../../resources/assets/sass/_tags.scss"],"names":[],"mappings":"AAKA,KACI,8BAAsB,AAAtB,qBAAsB,CACzB,qBAKG,2BAAmB,AAAnB,kBAAmB,CACtB,KCVG,eACA,yBAA0B,CAC7B,gBAGG,oBAAqB,CACxB,WCNG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,kBACA,AADA,cACA,yBACA,AADA,sBACA,AADA,mBACA,WACA,eCJgB,CDKnB,cAGG,eACA,cAAe,CAClB,eAGG,cAAe,CAClB,KEdG,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,0BACA,AADA,uBACA,AADA,oBACA,gBACA,cACA,gBAAiB,CACpB,SAGG,cAAe,CAClB,WAIG,gBAAiB,CACpB,aCfG,iBAAkB,CACrB,qBAGG,iBAAkB,CACrB,2BAGG,WAAY,CACf,8BAGG,oBAAa,AAAb,oBAAa,AAAb,YAAa,CAChB,WAGG,kBACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,yBACA,AADA,sBACA,AADA,8BACA,sBACA,AADA,mBACA,AADA,qBACA,iBACA,YACA,WACA,UACA,WACA,uBACA,kBACA,2CACA,AADA,mCACA,YAAa,CAChB,0BAGG,WACA,WAAY,CACf,sBAGG,YAAa,CCnCjB,MACI,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,cAAe,CAClB,UAGG,eACA,eAAgB,CACnB,eAGG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,yBAA8B,AAA9B,sBAA8B,AAA9B,6BAA8B,CACjC,MAGG,WACA,UAAW,CACd,YCtBG,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,6BACA,AADA,uBACA,AADA,mBACA,8BACA,AADA,2BACA,AADA,6BACA,eACA,oBAAqB,CACxB,cCLG,eACA,oBACA,AADA,oBACA,AADA,aACA,8BACA,AADA,8BACA,AADA,+BACA,AADA,2BACA,yBACA,AADA,sBACA,AADA,8BACA,eAAgB,CACnB,kBAGG,WACA,WAAY,CACf,UCVG,cAAe,CAClB,gBCDG,gBACA,cACA,gBAAiB,CACpB,OAGG,gBACA,cACA,oBACA,AADA,oBACA,AADA,aACA,4BACA,AADA,6BACA,AADA,0BACA,AADA,sBACA,yBAAmB,AAAnB,sBAAmB,AAAnB,kBAAmB,CACtB,qDCVG,YAAa,CAChB,sDCCG,iBAAkB,CACrB,gFAIG,kBACA,cACA,UACA,aACA,OACA,cACA,qBACA,yBACA,oBACA,4CACA,AADA,oCACA,yBACA,kCACA,WACA,cACA,0CAAkC,AAAlC,iCAAkC,CACrC,2BAGG,KACI,aACA,6BACA,wCACA,0BACA,8BAAkC,AAAlC,qBAAkC,CAGtC,GACI,aACA,kCACA,yBACA,WACA,4CAAgD,AAAhD,mCAAgD,CAAA,CAIxD,AApBC,mBAGG,KACI,aACA,6BACA,wCACA,0BACA,8BAAkC,AAAlC,qBAAkC,CAGtC,GACI,aACA,kCACA,yBACA,WACA,4CAAgD,AAAhD,mCAAgD,CAAA,CAIxD,aACI,kCACI,kCAAmC,CACtC,CC/CL,KACI,YAAa,CAChB,oBAGG,kBAAmB,CACtB,QAGG,y4HACA,wBACA,WACA,WAAY,CACf,UAGG,kBACA,MACA,OACA,iBACA,cAAe,CAClB,gBAGG,gBACA,gBAAiB,CACpB,KCzBG,gCACA,kBAAmB,CACtB,WAGG,8BACA,kBAAmB,CACtB,YAIG,iBAAkB,CACrB,aCZG,oBAAqB,CACxB,KAGG,oBAAqB,CACxB,MCHG,SACA,gBACA,SAAU,CACb,SAGG,WACA,oBAAqB,CACxB,kBAIG,wBACA,0BACA,mBACA,qBACA,cACA,mBACA,sBACA,kBACA,qBACA,qBACA,8BAAsB,AAAtB,qBAAsB,CACzB,YAGG,0BACA,uCACA,oCACA,oCACA,WACA,kBACA,QACA,KAAM,CACT,WAGG,4BACA,kBAAmB,CACtB,kBAGG,4BAA6B,CAChC","file":"app.css"}
|
69
resources/assets/js/form-save.js
vendored
69
resources/assets/js/form-save.js
vendored
|
@ -1,69 +0,0 @@
|
||||||
/* global alertify, store */
|
|
||||||
var feature = {
|
|
||||||
addEventListener : !!window.addEventListener,
|
|
||||||
querySelectorAll : !!document.querySelectorAll
|
|
||||||
};
|
|
||||||
|
|
||||||
if (feature.addEventListener && feature.querySelectorAll) {
|
|
||||||
var keys = getKeys();
|
|
||||||
for (var 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]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var timerId = window.setInterval(function() {
|
|
||||||
var saved = false;
|
|
||||||
var inputs = document.querySelectorAll('input[type=text], textarea');
|
|
||||||
for (var i = 0; i < inputs.length; i++) {
|
|
||||||
var key = getFormElement(inputs[i]).id + '~' + inputs[i].id;
|
|
||||||
if (store.get(key) !== inputs[i].value && inputs[i].value !== '') {
|
|
||||||
store.set(key, inputs[i].value);
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (saved === true) {
|
|
||||||
alertify.logPosition('top right');
|
|
||||||
alertify.success('Auto saved text');
|
|
||||||
}
|
|
||||||
}, 5000);
|
|
||||||
var forms = document.querySelectorAll('form');
|
|
||||||
for (var f = 0; f < forms.length; f++) {
|
|
||||||
var form = forms[f];
|
|
||||||
form.addEventListener('submit', function() {
|
|
||||||
window.clearInterval(timerId);
|
|
||||||
var formId = form.id;
|
|
||||||
var storedKeys = store.keys();
|
|
||||||
for (var i = 0; i < storedKeys.length; i++) {
|
|
||||||
if (storedKeys[i].indexOf(formId) > -1) {
|
|
||||||
store.remove(storedKeys[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getKeys() {
|
|
||||||
var keys = [];
|
|
||||||
var formFields = document.querySelectorAll('input[type=text], textarea');
|
|
||||||
for (var f = 0; f < formFields.length; f++) {
|
|
||||||
var parent = getFormElement(formFields[f]);
|
|
||||||
if (parent !== false) {
|
|
||||||
var key = parent.id + '~' + formFields[f].id;
|
|
||||||
keys.push(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
function getFormElement(elem) {
|
|
||||||
if (elem.nodeName.toLowerCase() !== 'body') {
|
|
||||||
var parent = elem.parentNode;
|
|
||||||
if (parent.nodeName.toLowerCase() === 'form') {
|
|
||||||
return parent;
|
|
||||||
} else {
|
|
||||||
return getFormElement(parent);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
39
resources/assets/js/links.js
vendored
39
resources/assets/js/links.js
vendored
|
@ -1,39 +0,0 @@
|
||||||
/* global Autolinker */
|
|
||||||
//the autlinker object
|
|
||||||
var autolinker = new Autolinker();
|
|
||||||
|
|
||||||
//the youtube regex
|
|
||||||
var ytidregex = /watch\?v=([A-Za-z0-9\-_]+)/;
|
|
||||||
|
|
||||||
var spotifyregex = /https\:\/\/play\.spotify\.com\/(.*)\b/;
|
|
||||||
|
|
||||||
//grab the notes and loop through them
|
|
||||||
var notes = document.querySelectorAll('.e-content');
|
|
||||||
for (var i = 0; i < notes.length; i++) {
|
|
||||||
//get Youtube ID
|
|
||||||
var ytid = notes[i].textContent.match(ytidregex);
|
|
||||||
if (ytid !== null) {
|
|
||||||
var yid = ytid[1];
|
|
||||||
var 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);
|
|
||||||
}
|
|
||||||
//get Spotify ID
|
|
||||||
var spotifyid = notes[i].textContent.match(spotifyregex);
|
|
||||||
if (spotifyid !== null) {
|
|
||||||
var sid = spotifyid[1].replace('/', ':');
|
|
||||||
var 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);
|
|
||||||
}
|
|
||||||
//now linkify everything
|
|
||||||
var orig = notes[i].innerHTML;
|
|
||||||
var linked = autolinker.link(orig);
|
|
||||||
notes[i].innerHTML = linked;
|
|
||||||
}
|
|
50
resources/assets/js/maps.js
vendored
50
resources/assets/js/maps.js
vendored
|
@ -1,50 +0,0 @@
|
||||||
/* global mapboxgl */
|
|
||||||
//This code runs on page load and looks for <div class="map">, then adds map
|
|
||||||
var mapDivs = document.querySelectorAll('.map');
|
|
||||||
mapboxgl.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiY2l2cDhjYW04MDAwcjJ0cG1uZnhqcm82ayJ9.qA2zeVA-nsoMh9IFrd5KQw';
|
|
||||||
for (var i = 0; i < mapDivs.length; i++) {
|
|
||||||
var mapDiv = mapDivs[i];
|
|
||||||
var latitude = mapDiv.dataset.latitude;
|
|
||||||
var longitude = mapDiv.dataset.longitude;
|
|
||||||
var el = document.createElement('div');
|
|
||||||
el.classList.add('marker');
|
|
||||||
var mapMenu = document.createElement('div');
|
|
||||||
mapMenu.classList.add('map-menu');
|
|
||||||
var streetsInput = document.createElement('input');
|
|
||||||
streetsInput.setAttribute('id', 'streets');
|
|
||||||
streetsInput.setAttribute('type', 'radio');
|
|
||||||
streetsInput.setAttribute('name', 'toggle');
|
|
||||||
streetsInput.setAttribute('value', 'streets');
|
|
||||||
streetsInput.setAttribute('checked', 'checked');
|
|
||||||
streetsInput.addEventListener('click', function () {
|
|
||||||
map.setStyle('mapbox://styles/mapbox/streets-v9');
|
|
||||||
});
|
|
||||||
var streetsLabel = document.createElement('label');
|
|
||||||
streetsLabel.setAttribute('for', 'streets');
|
|
||||||
streetsLabel.appendChild(document.createTextNode('Streets'));
|
|
||||||
var satelliteInput = document.createElement('input');
|
|
||||||
satelliteInput.setAttribute('id', 'satellite');
|
|
||||||
satelliteInput.setAttribute('type', 'radio');
|
|
||||||
satelliteInput.setAttribute('name', 'toggle');
|
|
||||||
satelliteInput.setAttribute('value', 'streets');
|
|
||||||
satelliteInput.addEventListener('click', function () {
|
|
||||||
map.setStyle('mapbox://styles/mapbox/satellite-v9');
|
|
||||||
});
|
|
||||||
var satelliteLabel = document.createElement('label');
|
|
||||||
satelliteLabel.setAttribute('for', 'satellite');
|
|
||||||
satelliteLabel.appendChild(document.createTextNode('Satellite'));
|
|
||||||
mapMenu.appendChild(streetsInput);
|
|
||||||
mapMenu.appendChild(streetsLabel);
|
|
||||||
mapMenu.appendChild(satelliteInput);
|
|
||||||
mapMenu.appendChild(satelliteLabel);
|
|
||||||
var map = new mapboxgl.Map({
|
|
||||||
container: mapDiv,
|
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
|
||||||
center: [longitude, latitude],
|
|
||||||
zoom: 15,
|
|
||||||
scrollZoom: false
|
|
||||||
});
|
|
||||||
map.addControl(new mapboxgl.NavigationControl());
|
|
||||||
new mapboxgl.Marker(el, {offset: [-10, -20]}).setLngLat([longitude, latitude]).addTo(map);
|
|
||||||
mapDiv.appendChild(mapMenu);
|
|
||||||
}
|
|
314
resources/assets/js/newnote.js
vendored
314
resources/assets/js/newnote.js
vendored
|
@ -1,314 +0,0 @@
|
||||||
/* global mapboxgl, alertify */
|
|
||||||
if ('geolocation' in navigator) {
|
|
||||||
var button = document.querySelector('#locate');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLocation() {
|
|
||||||
navigator.geolocation.getCurrentPosition(function (position) {
|
|
||||||
//the locate button has been clicked so add the places/map
|
|
||||||
addPlacesMap(position.coords.latitude, position.coords.longitude, position.coords.accuracy);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPlacesMap(latitude, longitude, uncertainty) {
|
|
||||||
//get the nearby places
|
|
||||||
fetch('/places/near/' + latitude + '/' + longitude + '?u=' + uncertainty, {
|
|
||||||
credentials: 'same-origin',
|
|
||||||
method: 'get'
|
|
||||||
}).then(function (response) {
|
|
||||||
return response.json();
|
|
||||||
}).then(function (j) {
|
|
||||||
if (j.error === true) {
|
|
||||||
alertify.reset();
|
|
||||||
alertify.error(j.error_description);
|
|
||||||
}
|
|
||||||
if (j.places.length > 0) {
|
|
||||||
var i;
|
|
||||||
var places = [];
|
|
||||||
for (i = 0; i < j.places.length; ++i) {
|
|
||||||
var latlng = parseLocation(j.places[i].location);
|
|
||||||
var name = j.places[i].name;
|
|
||||||
var uri = j.places[i].uri;
|
|
||||||
places.push([name, uri, latlng[0], latlng[1]]);
|
|
||||||
}
|
|
||||||
//add a map with the nearby places
|
|
||||||
addMap(latitude, longitude, places);
|
|
||||||
} else {
|
|
||||||
//add a map with just current location
|
|
||||||
addMap(latitude, longitude);
|
|
||||||
}
|
|
||||||
}).catch(function (err) {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addMap(latitude, longitude, places) {
|
|
||||||
//make places null if not supplied
|
|
||||||
if (arguments.length == 2) {
|
|
||||||
places = null;
|
|
||||||
}
|
|
||||||
// the form has a fieldset element that we are actually targetting
|
|
||||||
var form = document.querySelector('.note-ui');
|
|
||||||
var mapDiv = document.createElement('div');
|
|
||||||
mapDiv.classList.add('map');
|
|
||||||
//add the map div
|
|
||||||
form.appendChild(mapDiv);
|
|
||||||
//set up the mapbox gl map
|
|
||||||
mapboxgl.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiY2l2cDhjYW04MDAwcjJ0cG1uZnhqcm82ayJ9.qA2zeVA-nsoMh9IFrd5KQw';
|
|
||||||
var map = new mapboxgl.Map({
|
|
||||||
container: mapDiv,
|
|
||||||
style: 'mapbox://styles/mapbox/streets-v9',
|
|
||||||
center: [longitude, latitude],
|
|
||||||
zoom: 15
|
|
||||||
});
|
|
||||||
map.addControl(new mapboxgl.NavigationControl());
|
|
||||||
//create the current location marker
|
|
||||||
var el = document.createElement('div');
|
|
||||||
el.classList.add('marker');
|
|
||||||
//create the map style menu
|
|
||||||
var mapMenu = document.createElement('div');
|
|
||||||
mapMenu.classList.add('map-menu');
|
|
||||||
var streetsInput = document.createElement('input');
|
|
||||||
streetsInput.setAttribute('id', 'streets');
|
|
||||||
streetsInput.setAttribute('type', 'radio');
|
|
||||||
streetsInput.setAttribute('name', 'toggle');
|
|
||||||
streetsInput.setAttribute('value', 'streets');
|
|
||||||
streetsInput.setAttribute('checked', 'checked');
|
|
||||||
streetsInput.addEventListener('click', function () {
|
|
||||||
map.setStyle('mapbox://styles/mapbox/streets-v9');
|
|
||||||
});
|
|
||||||
var streetsLabel = document.createElement('label');
|
|
||||||
streetsLabel.setAttribute('for', 'streets');
|
|
||||||
streetsLabel.appendChild(document.createTextNode('Streets'));
|
|
||||||
var satelliteInput = document.createElement('input');
|
|
||||||
satelliteInput.setAttribute('id', 'satellite');
|
|
||||||
satelliteInput.setAttribute('type', 'radio');
|
|
||||||
satelliteInput.setAttribute('name', 'toggle');
|
|
||||||
satelliteInput.setAttribute('value', 'streets');
|
|
||||||
satelliteInput.addEventListener('click', function () {
|
|
||||||
map.setStyle('mapbox://styles/mapbox/satellite-v9');
|
|
||||||
});
|
|
||||||
var satelliteLabel = document.createElement('label');
|
|
||||||
satelliteLabel.setAttribute('for', 'satellite');
|
|
||||||
satelliteLabel.appendChild(document.createTextNode('Satellite'));
|
|
||||||
mapMenu.appendChild(streetsInput);
|
|
||||||
mapMenu.appendChild(streetsLabel);
|
|
||||||
mapMenu.appendChild(satelliteInput);
|
|
||||||
mapMenu.appendChild(satelliteLabel);
|
|
||||||
//add the map menu
|
|
||||||
mapDiv.appendChild(mapMenu);
|
|
||||||
//add a marker for the current location
|
|
||||||
new mapboxgl.Marker(el, {offset: [-10, -20]}).setLngLat([longitude, latitude]).addTo(map);
|
|
||||||
//create containing div for flexbox
|
|
||||||
var containingDiv = document.createElement('div');
|
|
||||||
//create the <select> element and give it a no location default
|
|
||||||
var selectEl = document.createElement('select');
|
|
||||||
selectEl.setAttribute('name', 'location');
|
|
||||||
var noLocation = document.createElement('option');
|
|
||||||
noLocation.setAttribute('value', 'no-location');
|
|
||||||
noLocation.appendChild(document.createTextNode('Don’t send location'));
|
|
||||||
selectEl.appendChild(noLocation);
|
|
||||||
var geoLocation = document.createElement('option');
|
|
||||||
geoLocation.setAttribute('selected', 'selected');
|
|
||||||
geoLocation.setAttribute('id', 'option-coords');
|
|
||||||
geoLocation.setAttribute('value', 'geo:' + latitude + ',' + longitude);
|
|
||||||
geoLocation.dataset.latitude = latitude;
|
|
||||||
geoLocation.dataset.longitude = longitude;
|
|
||||||
geoLocation.appendChild(document.createTextNode('Send co-ordinates'));
|
|
||||||
selectEl.appendChild(geoLocation);
|
|
||||||
containingDiv.appendChild(selectEl);
|
|
||||||
form.insertBefore(containingDiv, mapDiv);
|
|
||||||
if (places !== null) {
|
|
||||||
//add the places both to the map and <select>
|
|
||||||
places.forEach(function (item) {
|
|
||||||
var option = document.createElement('option');
|
|
||||||
option.setAttribute('value', item[1]);
|
|
||||||
var text = document.createTextNode(item[0]);
|
|
||||||
option.appendChild(text);
|
|
||||||
option.dataset.latitude = item[2];
|
|
||||||
option.dataset.longitude = item[3];
|
|
||||||
selectEl.appendChild(option);
|
|
||||||
var placeMarkerIcon = document.createElement('div');
|
|
||||||
placeMarkerIcon.classList.add('marker');
|
|
||||||
new mapboxgl.Marker(placeMarkerIcon, {offset: [-10, -20]}).setLngLat([item[3], item[2]]).addTo(map);
|
|
||||||
placeMarkerIcon.addEventListener('click', function () {
|
|
||||||
map.flyTo({
|
|
||||||
center: [
|
|
||||||
item[3],
|
|
||||||
item[2]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
selectPlace(item[1]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//add an event listener
|
|
||||||
selectEl.addEventListener('change', function () {
|
|
||||||
if (selectEl.value !== 'no-location') {
|
|
||||||
var placeLat = selectEl[selectEl.selectedIndex].dataset.latitude;
|
|
||||||
var placeLon = selectEl[selectEl.selectedIndex].dataset.longitude;
|
|
||||||
map.flyTo({
|
|
||||||
center: [
|
|
||||||
placeLon,
|
|
||||||
placeLat
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//add a button to add a new place
|
|
||||||
var newLocButton = document.createElement('button');
|
|
||||||
newLocButton.setAttribute('type', 'button');
|
|
||||||
newLocButton.setAttribute('id', 'create-new-place');
|
|
||||||
newLocButton.appendChild(document.createTextNode('Create New Place?'));
|
|
||||||
//the event listener
|
|
||||||
newLocButton.addEventListener('click', function() {
|
|
||||||
//add the form elements
|
|
||||||
var nameDiv = document.createElement('div');
|
|
||||||
var nameLabel = document.createElement('label');
|
|
||||||
nameLabel.setAttribute('for', 'place-name');
|
|
||||||
nameLabel.classList.add('place-label');
|
|
||||||
nameLabel.appendChild(document.createTextNode('Place Name:'));
|
|
||||||
var nameEl = document.createElement('input');
|
|
||||||
nameEl.setAttribute('placeholder', 'Name');
|
|
||||||
nameEl.setAttribute('name', 'place-name');
|
|
||||||
nameEl.setAttribute('id', 'place-name');
|
|
||||||
nameEl.setAttribute('type', 'text');
|
|
||||||
nameDiv.appendChild(nameLabel);
|
|
||||||
nameDiv.appendChild(nameEl);
|
|
||||||
var descDiv = document.createElement('div');
|
|
||||||
var descLabel = document.createElement('label');
|
|
||||||
descLabel.setAttribute('for', 'place-description');
|
|
||||||
descLabel.classList.add('place-label');
|
|
||||||
descLabel.appendChild(document.createTextNode('Place Description:'));
|
|
||||||
var descEl = document.createElement('input');
|
|
||||||
descEl.setAttribute('placeholder', 'Description');
|
|
||||||
descEl.setAttribute('name', 'place-description');
|
|
||||||
descEl.setAttribute('id', 'place-description');
|
|
||||||
descEl.setAttribute('type', 'text');
|
|
||||||
descDiv.appendChild(descLabel);
|
|
||||||
descDiv.appendChild(descEl);
|
|
||||||
var latDiv = document.createElement('div');
|
|
||||||
var latLabel = document.createElement('label');
|
|
||||||
latLabel.setAttribute('for', 'place-latitude');
|
|
||||||
latLabel.classList.add('place-label');
|
|
||||||
latLabel.appendChild(document.createTextNode('Place Latitude:'));
|
|
||||||
var latEl = document.createElement('input');
|
|
||||||
latEl.setAttribute('name', 'place-latitude');
|
|
||||||
latEl.setAttribute('id', 'place-latitude');
|
|
||||||
latEl.setAttribute('type', 'text');
|
|
||||||
latEl.value = getLatitudeFromMapbox(map.getCenter());
|
|
||||||
latDiv.appendChild(latLabel);
|
|
||||||
latDiv.appendChild(latEl);
|
|
||||||
var lonDiv = document.createElement('div');
|
|
||||||
var lonLabel = document.createElement('label');
|
|
||||||
lonLabel.setAttribute('for', 'place-longitude');
|
|
||||||
lonLabel.classList.add('place-label');
|
|
||||||
lonLabel.appendChild(document.createTextNode('Place Longitude:'));
|
|
||||||
var lonEl = document.createElement('input');
|
|
||||||
lonEl.setAttribute('name', 'place-longitude');
|
|
||||||
lonEl.setAttribute('id', 'place-longitude');
|
|
||||||
lonEl.setAttribute('type', 'text');
|
|
||||||
lonEl.value = getLongitudeFromMapbox(map.getCenter());
|
|
||||||
lonDiv.appendChild(lonLabel);
|
|
||||||
lonDiv.appendChild(lonEl);
|
|
||||||
var placeSubmit = document.createElement('button');
|
|
||||||
placeSubmit.setAttribute('id', 'place-submit');
|
|
||||||
placeSubmit.setAttribute('value', 'Submit New Place');
|
|
||||||
placeSubmit.setAttribute('name', 'place-submit');
|
|
||||||
placeSubmit.setAttribute('type', 'button');
|
|
||||||
placeSubmit.appendChild(document.createTextNode('Submit New Place'));
|
|
||||||
form.appendChild(nameDiv);
|
|
||||||
form.appendChild(descDiv);
|
|
||||||
form.appendChild(latDiv);
|
|
||||||
form.appendChild(lonDiv);
|
|
||||||
form.appendChild(placeSubmit);
|
|
||||||
//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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
containingDiv.appendChild(newLocButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseLocation(point) {
|
|
||||||
var re = /\((.*)\)/;
|
|
||||||
var resultArray = re.exec(point);
|
|
||||||
var location = resultArray[1].split(' ');
|
|
||||||
|
|
||||||
return [location[1], location[0]];
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectPlace(uri) {
|
|
||||||
document.querySelector('select [value="' + uri + '"]').selected = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLatitudeFromMapbox(lnglat) {
|
|
||||||
var resultArray = /\((.*)\)/.exec(lnglat);
|
|
||||||
var location = resultArray[1].split(' ');
|
|
||||||
|
|
||||||
return location[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLongitudeFromMapbox(lnglat) {
|
|
||||||
var resultArray = /\((.*)\)/.exec(lnglat);
|
|
||||||
var location = resultArray[1].split(' ');
|
|
||||||
|
|
||||||
return location[0].replace(',', '');
|
|
||||||
}
|
|
44
resources/assets/js/newplace.js
vendored
44
resources/assets/js/newplace.js
vendored
|
@ -1,44 +0,0 @@
|
||||||
/* global L */
|
|
||||||
var button = document.querySelector('#locate');
|
|
||||||
|
|
||||||
if (button.addEventListener) {
|
|
||||||
button.addEventListener('click', getLocation);
|
|
||||||
} else {
|
|
||||||
button.attachEvent('onclick', getLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLocation() {
|
|
||||||
if ('geolocation' in navigator) {
|
|
||||||
navigator.geolocation.getCurrentPosition(function(position) {
|
|
||||||
updateForm(position.coords.latitude, position.coords.longitude);
|
|
||||||
addMap(position.coords.latitude, position.coords.longitude);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateForm(latitude, longitude) {
|
|
||||||
var inputLatitude = document.querySelector('#latitude');
|
|
||||||
var inputLongitude = document.querySelector('#longitude');
|
|
||||||
inputLatitude.value = latitude;
|
|
||||||
inputLongitude.value = longitude;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addMap(latitude, longitude) {
|
|
||||||
var form = document.querySelector('form');
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.setAttribute('id', 'map');
|
|
||||||
form.appendChild(div);
|
|
||||||
L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';
|
|
||||||
var map = L.mapbox.map('map', 'jonnybarnes.gnoihnim')
|
|
||||||
.setView([latitude, longitude], 15)
|
|
||||||
.addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {
|
|
||||||
detectRetina: true
|
|
||||||
}));
|
|
||||||
var marker = L.marker([latitude, longitude], {
|
|
||||||
draggable: true
|
|
||||||
}).addTo(map);
|
|
||||||
marker.on('dragend', function () {
|
|
||||||
var markerLocation = marker.getLatLng();
|
|
||||||
updateForm(markerLocation.lat, markerLocation.lng);
|
|
||||||
});
|
|
||||||
}
|
|
3
resources/assets/sass/_tags.scss
vendored
3
resources/assets/sass/_tags.scss
vendored
|
@ -13,7 +13,8 @@
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag,
|
||||||
|
.tag:visited {
|
||||||
background: var(--white);
|
background: var(--white);
|
||||||
border-radius: 3px 0 0 3px;
|
border-radius: 3px 0 0 3px;
|
||||||
color: var(--black);
|
color: var(--black);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@section('content')
|
@section('content')
|
||||||
<h2>Notes tagged with <em>{{ $tag }}</em></h2>
|
<h2>Notes tagged with <em>{{ $tag }}</em></h2>
|
||||||
@foreach ($notes as $note)
|
@foreach ($notes as $note)
|
||||||
<div>
|
<div class="note">
|
||||||
{!! $note->note !!}
|
{!! $note->note !!}
|
||||||
<a href="/note/{{ $note->id }}">{{ $note->humandiff }}</a>
|
<a href="/note/{{ $note->id }}">{{ $note->humandiff }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue