|
Tags: Blanking Manual revert Reverted |
| Line 1: |
Line 1: |
| /**
| |
| * MediviaMapper MediaWiki Extension (minimal prototype)
| |
| * Allows embedding the full Medivia Mapper in a <mediviamap> tag
| |
| * using an <iframe> internally (safest, lowest maintenance approach)
| |
| */
| |
|
| |
|
| (function () {
| |
| if (typeof mw === 'undefined') return;
| |
|
| |
| mw.hook('wikipage.content').add(function ($content) {
| |
| $content.find('mediviamap').each(function () {
| |
| var el = $(this);
| |
| var x = el.attr('x') || '2048';
| |
| var y = el.attr('y') || '-2047';
| |
| var z = el.attr('z') || '7';
| |
| var zoom = el.attr('zoom') || '2';
| |
| var width = el.attr('width') || '100%';
| |
| var height = el.attr('height') || '500px';
| |
|
| |
| var iframe = $('<iframe>', {
| |
| src: 'https://tafonath.github.io/medivia-mapper/?x=' + x + '&y=' + y + '&z=' + z + '&zoom=' + zoom,
| |
| width: width,
| |
| height: height,
| |
| frameborder: 0,
| |
| allowfullscreen: true,
| |
| style: 'border:none;'
| |
| });
| |
|
| |
| el.replaceWith(iframe);
| |
| });
| |
| });
| |
| })();
| |