[Talk-cz] oznacovani dlazdic jako dirty

Petr Holub hopet na ics.muni.cz
Úterý Duben 28 16:11:24 UTC 2015


Ahoj,

narazil jsem na takovy docela pekny Greasemonkey skriptik, treba
se to bude nekomu hodit:
https://gist.github.com/Adrianod/e6b522bf1715a49b68c2
na Alt klik to pak umi na OSM invalidovat dlazdice.

Protoze jsme narazil na obcasne problemy se synchronizaci jednotlivych
tile serveru OSM, trochu jsem ho pro sichr osklive hacknul, ze to
jde po vsech serverech najednou, vizte nize.

Petr



// ==UserScript==

// @name        click n' dirt
// @namespace   https://gist.github.com/Adrianod/e6b522bf1715a49b68c2
// @description Alt-click to mark tiles as dirty on openstreetmap.org
// @include     http://www.openstreetmap.org/*
// @include     https://www.openstreetmap.org/*
// @version     1
// @grant       none
// ==/UserScript==

/*
        $.ajax({\
            url: this.src.text().replace(/.\.tile\.openstreetmap\.org/, "a.tile.openstreetmap.org")+"/dirty",\
            context: this\
            });\
	    */

var code = '\
$("#map").on("click", ".leaflet-tile", function(e) {\
    if (e.altKey) {\
        $.ajax({\
            url: this.src.replace(/.\.tile\.openstreetmap\.org/, "a.tile.openstreetmap.org")+"/dirty",\
            context: this\
            }).done(function() {\
                $(this).fadeTo("fast", .8);\
        });\
        $.ajax({\
            url: this.src.replace(/.\.tile\.openstreetmap\.org/, "b.tile.openstreetmap.org")+"/dirty",\
            context: this\
            }).done(function() {\
                $(this).fadeTo("fast", .6);\
        });\
        $.ajax({\
            url: this.src.replace(/.\.tile\.openstreetmap\.org/, "c.tile.openstreetmap.org")+"/dirty",\
            context: this\
            }).done(function() {\
                $(this).fadeTo("fast", .2);\
        });\
    }\
});';
 
var script = document.createElement("script");
script.textContent = code;
document.body.appendChild(script);






Další informace o konferenci talk-cz