/* * Copyright (c) 2008-2014 Institut National de l'Information Geographique et Forestiere (IGN) France. * Released under the BSD license. */ if (window.__Geoportal$timer===undefined) { var __Geoportal$timer= null; } /** * Function: checkApiLoading * Assess that needed classes have been loaded. * * Parameters: * retryClbk - {Function} function to call if any of the expected classes * is missing. * clss - {Array({String})} list of classes to check. * * Returns: * {Boolean} true when all needed classes have been loaded, false otherwise. */ function checkApiLoading(retryClbk,clss) { if (__Geoportal$timer!=null) { //clearTimeout: cancels the timer "__Geoportal$timer" before its end //clearTimeout: annule le minuteur "__Geoportal$timer" avant sa fin window.clearTimeout(__Geoportal$timer); __Geoportal$timer= null; } /** * It may happen that the init function is executed before the API is loaded * Addition of a timer code that waits 300 ms before running the init function * * Il se peut que l'init soit exécuté avant que l'API ne soit chargée * Ajout d'un code temporisateur qui attend 300 ms avant de relancer l'init */ var f; for (var i=0, l= clss.length; i} that handle the i18n "changelang" events. */ function translate(eids, vwrs) { Geoportal.Lang.add(Geoportal$translations); if (!eids) { eids= []; } eids.unshift('example_title'); eids.unshift('example_explain'); eids.unshift('example_jscode'); eids.unshift('legal'); var eids$i18n= function() { var e= null; for (var i= 0, l= eids.length; i} The viewer. * themeName - {String} Name of the theme. */ function changeTheme(viewer,themeName) { themeName= themeName || 'geoportal'; var themeId= '__Geoportal'+ (themeName=='geoportal'? '' : themeName.replace(/^\w/, function($0) {return $0.toUpperCase();}))+ 'Css__'; var currentTheme= OpenLayers.Util.getElement(Geoportal$theme); viewer.setTheme({ name:themeName, styles:[{ css:Geoportal._getScriptLocation()+'theme/'+themeName+'/style.css', id:themeId, anchor:currentTheme? Geoportal$theme : '' }] }); if (currentTheme) { currentTheme.parentNode.removeChild(currentTheme); } Geoportal$theme= themeId; }