Gabriel
ca4b7635a4
* Server implementation complete. * Cross-compatibility with discover * switch to fetch api * Easy to make into a hugo shortcode
19 lines
583 B
JavaScript
19 lines
583 B
JavaScript
function interverse_data(url,cback){
|
|
url = interverse_proxy+"?url="+url
|
|
fetch(url).then((response)=> {
|
|
if (!response.ok){
|
|
return {}
|
|
}
|
|
return response.json();
|
|
}).then((data)=>cback(data))
|
|
|
|
}
|
|
|
|
// https://davidwalsh.name/query-string-javascript
|
|
function getUrlParameter(name) {
|
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
var results = regex.exec(location.search);
|
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
};
|
|
|