OpenStreetMap

MapBBCode Triumphant

Posted by Zverik on 6 December 2013 in English.

Yesterday I’ve created another repository in MapBBCode project. It is a small script, which does great things.

[map=16]16.3866,119.95855(Complete)[/map]

The Rails Port does not support MapBBCode, and probably never will. But copy and paste the following line to the address bar to witness the magic (you’ll have to restore “javascript:” prefix in Chrome and IE):

javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://osmz.ru/mapbb.plain.js';})();

MapBBCode Loader searches for BBCode on the current page, and if it succeeds, it appends Leaflet and MapBBCode libraries and replaces all [map] bbcode with maps. And if there is a specially marked button, the script adds a map editor to it. Basically, this script allows integrating MapBBCode into forum and blog engines which do not have native plugins for that yet.

I guess nothing can stop MapBBCode from conquering the internet. Even closed-source forum engines (I’m looking at you, vBulletin, which requested $250 license for access to documentation) and lazy administrators. The complete instruction of five simple steps for embedding MapBBCode anywhere is published in the GitHub repo.

The loader requires MapBBCode 1.2, which is now in development and may contains traces of bugs.

Update: it seems Leaflet can’t stand CSS in OSM diaries. And in Firefox you cannot run javascript from the location bar. In Chrome and Internet Explorer “javascript:” prefix is automatically removed when you copy the string, you have to add it back yourself. Basically, it works without fixing only in Opera browser.

But that is not the point: the loader is not supposed to power such one-off demostrations. It serves as a plugin replacement for engines that are hard to modify. For example, shtosm.ru is powered by a closed-source engine, and only MapBBCodeLoader has allowed for maps in it.

Discussion

Log in to leave a comment