interverse/Client/helper.js
2022-10-10 07:04:14 -04:00

23 lines
699 B
JavaScript

function fetchback(url,cback){
fetch(url).then((request)=>request.json()).then((data)=>cback(data));
}
function interverse_data(url,cback){
url = interverse_proxy+"/initial?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, ' '));
};