MapRip bookmarklet that saves map context

I was trying recently to utilize bookmarklets for injection of custom code into arbitrary webpage to get control a provide some additional funcitonality.. for example transfering the content of openlayers maps into MapShake. Not heard about MapShake ? I will post soon more. My bookmarlet looks like this:

javascript:(function(){var%20s=document.createElement(%22script%22);s.charset=%22UTF-8%22;s.src=%22http://www.sumbera.com/lab/MapRip/MapRip.js%22;document.body.appendChild (s)})();

try{
var rippedMap = map;
var format = new OpenLayers.Format.WMC({‘layerOptions’: {buffer: 0}});
var text = format.write(rippedMap);
var w;
setTimeout(‘w=window.open(“”,””,”width=600,height=1200,resizable=0,scrollbars=1″);e(w);’,10);
function e(w){
d = w.document;
d.write(“<textarea id=’wmc’ rows=’100′ cols=’65’>” + text +”</textarea>”);
d.close();
w.focus()
}

page with bookmarklet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.