|
Tags: Blanking Manual revert |
| (4 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| $(function () {
| |
|
| |
|
| $('.map-toggle').on('click', function () {
| |
|
| |
| var mapId = $(this).data('mapid');
| |
| var box = $('#mw-customcollapsible-' + mapId);
| |
|
| |
| // Already loaded?
| |
| if (box.data('loaded')) return;
| |
|
| |
| var x = box.data('x');
| |
| var y = box.data('y');
| |
| var z = box.data('z');
| |
| var zoom = box.data('zoom');
| |
| var w = box.data('width');
| |
| var h = box.data('height');
| |
|
| |
| // Build mapper tag
| |
| var code = `{{#mapper:${x}|${y}|${z}|${zoom}|${w}|${h}}}`;
| |
|
| |
| // Ask MW API to parse it into HTML
| |
| new mw.Api().post({
| |
| action: 'parse',
| |
| text: code,
| |
| prop: 'text'
| |
| }).done(function (data) {
| |
| var html = data.parse.text['*'];
| |
| box.find('.map-placeholder').replaceWith(html);
| |
| box.attr('data-loaded', 1);
| |
| });
| |
| });
| |
|
| |
| });
| |