-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from mejackreed/revert-53-twitter-cart
Revert "add twitter card md"
- Loading branch information
Showing
1 changed file
with
1 addition
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
var map; | ||
var layer; | ||
|
||
map = L.map('map', { | ||
center: [0, 0], | ||
crs: L.CRS.Simple, | ||
zoom: 0 | ||
}); | ||
|
||
var url = window.location.search.replace('?url=', ''); | ||
var url = window.location.search.replace('?url=', '') | ||
|
||
// http://stackoverflow.com/a/18222306 | ||
var urlregex = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; | ||
|
||
if (urlregex.test(url)) { | ||
layer = L.tileLayer.iiif(url, {}).addTo(map); | ||
} | ||
|
||
layer.on('load', function() { | ||
$('head').append( | ||
'<meta name="twitter:card" content="summary_large_image">' + | ||
'<meta name="twitter:site" content="@mejackreed">' + | ||
'<meta name="twitter:image" content="' + url.replace('info.json', 'full/' + layer._imageSizes[1].x + ',/0/default.jpg') + '">' | ||
); | ||
}); |