Skip to content

Commit

Permalink
Move google resources to extension.json
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Aug 9, 2019
1 parent b02c778 commit 68e23ee
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 94 deletions.
68 changes: 68 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,74 @@
"scripts": [
"leaflet/ext.sm.leafletajax.js"
]
},

"ext.maps.googlemaps3": {
"dependencies": [
"ext.maps.common"
],
"scripts": [
"GoogleMaps/jquery.googlemap.js",
"GoogleMaps/ext.maps.googlemaps3.js"
],
"messages": [
"maps-googlemaps3-incompatbrowser",
"maps-copycoords-prompt",
"maps-searchmarkers-text",
"maps-fullscreen-button",
"maps-fullscreen-button-tooltip"
]
},

"ext.maps.gm3.markercluster": {
"dependencies": [
"ext.maps.googlemaps3"
],
"scripts": [
"GoogleMaps/gm3-util-library/markerclusterer.js"
]
},

"ext.maps.gm3.markerwithlabel": {
"dependencies": [
"ext.maps.googlemaps3"
],
"scripts": [
"GoogleMaps/gm3-util-library/markerwithlabel.js"
],
"styles": [
"GoogleMaps/gm3-util-library/markerwithlabel.css"
]
},

"ext.maps.gm3.geoxml": {
"dependencies": [
"ext.maps.googlemaps3"
],
"scripts": [
"GoogleMaps/geoxml3/geoxml3.js",
"GoogleMaps/geoxml3/ZipFile.complete.js",
"GoogleMaps/geoxml3/ProjectedOverlay.js"
]
},

"ext.maps.gm3.earth": {
"dependencies": [
"ext.maps.googlemaps3"
],
"scripts": [
"GoogleMaps/gm3-util-library/googleearth-compiled.js"
]
},

"ext.sm.googlemaps3ajax": {
"dependencies": [
"ext.maps.googlemaps3",
"ext.sm.common"
],
"scripts": [
"GoogleMaps/ext.sm.googlemaps3ajax.js"
]
}
},

Expand Down
94 changes: 0 additions & 94 deletions src/MapsSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function setup() {

private function registerAllTheThings() {
$this->registerParserHooks();
$this->registerGoogleMapsModules();
$this->registerPermissions();
$this->registerParameterTypes();
$this->registerHooks();
Expand Down Expand Up @@ -146,99 +145,6 @@ function ( $text, array $arguments, Parser $parser ) {
};
}

private function registerGoogleMapsModules() {
global $wgResourceModules;

$localBasePath = __DIR__ . '/../resources/GoogleMaps';
$remoteExtPath = 'Maps/resources/GoogleMaps';

$wgResourceModules['ext.maps.googlemaps3'] = [
'dependencies' => [ 'ext.maps.common' ],
'localBasePath' => $localBasePath,
'remoteExtPath' => $remoteExtPath,
'targets' => [
'mobile',
'desktop'
],
'scripts' => [
'jquery.googlemap.js',
'ext.maps.googlemaps3.js'
],
'messages' => [
'maps-googlemaps3-incompatbrowser',
'maps-copycoords-prompt',
'maps-searchmarkers-text',
'maps-fullscreen-button',
'maps-fullscreen-button-tooltip',
]
];

$wgResourceModules['ext.maps.gm3.markercluster'] = [
'localBasePath' => $localBasePath . '/gm3-util-library',
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
'targets' => [
'mobile',
'desktop'
],
'scripts' => [
'markerclusterer.js',
],
];

$wgResourceModules['ext.maps.gm3.markerwithlabel'] = [
'localBasePath' => $localBasePath . '/gm3-util-library',
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
'targets' => [
'mobile',
'desktop'
],
'scripts' => [
'markerwithlabel.js',
],
'styles' => [
'markerwithlabel.css',
],
];

$wgResourceModules['ext.maps.gm3.geoxml'] = [
'localBasePath' => $localBasePath . '/geoxml3',
'remoteExtPath' => $remoteExtPath . '/geoxml3',
'targets' => [
'mobile',
'desktop'
],
'scripts' => [
'geoxml3.js',
'ZipFile.complete.js', //kmz handling
'ProjectedOverlay.js', //Overlay handling
],
];

$wgResourceModules['ext.maps.gm3.earth'] = [
'localBasePath' => $localBasePath . '/gm3-util-library',
'remoteExtPath' => $remoteExtPath . '/gm3-util-library',
'targets' => [
'mobile',
'desktop'
],
'scripts' => [
'googleearth-compiled.js',
],
];

$wgResourceModules['ext.sm.googlemaps3ajax'] = [
'localBasePath' => $localBasePath,
'remoteExtPath' => $remoteExtPath,
'dependencies' => [
'ext.maps.googlemaps3',
'ext.sm.common'
],
'scripts' => [
'ext.sm.googlemaps3ajax.js'
]
];
}

private function registerPermissions() {
$this->mwGlobals['wgAvailableRights'][] = 'geocode';

Expand Down

0 comments on commit 68e23ee

Please sign in to comment.