[OpenLayers-Users] SingleFile.js - small improvement in RegExp of
function _getScriptLocation
Eric Lemoine
eric.lemoine at camptocamp.com
Tue Feb 15 03:03:11 EST 2011
On Mon, Feb 14, 2011 at 5:51 PM, Andreas Neumann <a.neumann at carto.net> wrote:
> Hi,
>
> While trying to optimize OpenLayers for deployment I noticed that OpenLayers
> fails if the file is named OpenLayers.js.gz instead of just OpenLayers.js
>
> It is simple to fix:
>
> In file SingleFile.js, in function _getScriptLocation change:
>
> old:
> var r = new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"),
> s = document.getElementsByTagName('script'),
> src, m, l = "";
>
> new:
> var r = new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\.gz)*(\\?|$)"),
> s = document.getElementsByTagName('script'),
> src, m, l = "";
>
> note the additional '(\.gz)*'
>
> Could this be included in trunk so one can use either OpenLayers.js or
> OpenLayers.js.gz?
>
> see ticket http://trac.osgeo.org/openlayers/ticket/3060
Hi
I can see two alternatives.
#1 Write your own SingleFile.js:
var OpenLayers = {
_getScriptLocation: function() {
return "path to your OpenLayers.js.gz";
}
};
#2 Do the following:
- In your page's head add a <link> tag to OpenLayers'
theme/default/style.css file,
- Pass theme:null to the Map (and the OverviewMap)
- Set OpenLayers.imgPath to the path to OpenLayers' img dir
With these things OpenLayers won't need _getScriptLocation at all.
I'd recommend #2.
Cheers,
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list