Compare commits

..

No commits in common. "626e5f932ed2d7a2f5d3a5acd4e6d548bb14c5e2" and "62844f9ac241dd3f1fa2aeaba58719385e5f7e03" have entirely different histories.

2 changed files with 8 additions and 35 deletions

View File

@ -1,39 +1,12 @@
const urls = [
"*://*.tile.openstreetmap.org/*"
]
var tileserver_url = "";
function log(msg) {
console.log("custom-openstreetmap-tile-server: " + msg)
}
function setTileserver(storage) {
tileserver_url = storage.tileserver;
log("set tileserver_url to " + tileserver_url);
}
function onError(error) {
log(`Error: ${error}`);
}
function updateTileserverUrl() {
var getting = browser.storage.local.get("tileserver");
getting.then(setTileserver, onError);
}
function replaceTileserver(request) {
updateTileserverUrl();
if (tileserver_url == "") {
log(request.url + " -> no tileserver_url");
return {}
}
var url = request.url.replace("tile.openstreetmap.org", tileserver_url);
log(request.url + " -> " + url);
var url = request.url.replace("tile.openstreetmap.org", "tiles.demostat.de");
console.log("custom-openstreetmap-tile-server: " + request.url + " -> " + url);
return {redirectUrl: url};
}
urls = [
"*://*.tile.openstreetmap.org/*"
]
chrome.webRequest.onBeforeRequest.addListener(replaceTileserver, {urls: urls}, ["blocking"]);

View File

@ -8,7 +8,7 @@ function saveOptions(e) {
function restoreOptions() {
function setCurrentChoice(result) {
document.querySelector("#tileserver").value = result.tileserver || "";
document.querySelector("#tileserver").value = result.tileserver;
}
function onError(error) {