Made extension compatible with MobileFrontend extension.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 22 Nov 2015 21:40:59 +0000 (21:40 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 22 Nov 2015 21:40:59 +0000 (21:40 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/mediawiki_extensions/wrmap/trunk@2362 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrmap.body.php
wrmap.php

index d5afd97ea4f7cf2c0fed13949e48a13c565a6cac..1d109e6ae1bc527ac7c2fc4adfc33f927d6fba69 100644 (file)
@@ -286,6 +286,12 @@ class WrBaseMap {
                $div->appendElement('div', array('style' => 'height: 0px; display:none;'))->appendText($json_string);
                return array($doc->saveHTML($div), 'markerType' => 'nowiki');
        }
+
+
+       public static function onEnableMobileModules($out, $mode) {
+               $out->addModules('ext.wrmap.mobile');
+               return true;
+       }
 }
 
 
index 29da3e1dd57481d0822c1efa80ddb5792b7e8e19..f17296b1ddda3d71fd947e7459986b4c1c1b7caf 100644 (file)
--- a/wrmap.php
+++ b/wrmap.php
@@ -170,6 +170,7 @@ $wgExtensionCredits['parserhook'][] = array(
 
 
 
+// desktop (non-mobile) version
 $wgResourceModules['ext.wrmap'] = array(
        'scripts' => array('openlayers/OpenLayers.min.js', 'wrmap.js'),
        // 'scripts' => array('openlayers/OpenLayers.js', 'wrmap.js'), // non-minimized version for debugging
@@ -195,10 +196,15 @@ $wgResourceModules['ext.wrmap'] = array(
 );
 
 
+// mobile version # http://www.mediawiki.org/wiki/ResourceLoader/Writing_a_MobileFrontend_friendly_ResourceLoader_module
+$wgResourceModules['ext.wrmap.mobile'] = $wgResourceModules['ext.wrmap'] + array('targets' => 'mobile');
+
+
 $wgAutoloadClasses['WrMap'] = dirname(__FILE__) . '/wrmap.body.php';
 $wgAutoloadClasses['WrGMap'] = $wgAutoloadClasses['WrMap'];
 $wgMessagesDirs['wrmap'] = __DIR__ . '/i18n';
 $wgHooks['ParserFirstCallInit'][] = 'wrMapParserFirstCallInit';
+$wgHooks['EnableMobileModules'][] = 'WrMap::onEnableMobileModules';
 
 
 function wrMapParserFirstCallInit($parser) {