/ ;
if (regexpDimensions.test( script ) )
{
delete FCK.GoogleMapsHandler.maps[this.number] ;
this.number = RegExp.$1 ;
FCK.GoogleMapsHandler.maps[this.number] = this ;
this.width = RegExp.$2 ;
this.height = RegExp.$3 ;
}
// map.setCenter(new GLatLng(42.4298,-8.07756), 8);
var regexpPosition = /map\.setCenter\(new GLatLng\((-?\d{1,3}\.\d{1,6}),(-?\d{1,3}\.\d{1,6})\), (\d{1,2})\);/ ;
if (regexpPosition.test( script ) )
{
this.centerLat = RegExp.$1 ;
this.centerLon = RegExp.$2 ;
this.zoom = RegExp.$3 ;
}
// v <= 1.5
if ( version<=5 )
{
// var text = 'En O Carballino ha estado la d\'elegacion diplomatica japonesa';
var markerText, markerLat=0, markerLon=0;
var regexpText = /var text\s*=\s*("|')(.*)\1;\s*\n/ ;
if (regexpText.test( script ) )
{
markerText = RegExp.$2 ;
}
// var point = new GLatLng(42.4298,-8.07756);
var regexpMarker = /var point\s*=\s*new GLatLng\((-?\d{1,3}\.\d{1,6}),(-?\d{1,3}\.\d{1,6})\)/ ;
if (regexpMarker.test( script ) )
{
markerLat = RegExp.$1 ;
markerLon = RegExp.$2 ;
}
if (markerLat!=0 && markerLon!=0)
this.markerPoints.push( {lat:markerLat, lon:markerLon, text:this.decodeText(markerText)} ) ;
}
else
{
// v > 1.5. multiple points.
// AddMarkers( [{lat:37.45088, lon:-122.21123, text:'Write your text'}] ) ;
var regexpMarkers = /\{lat\:(-?\d{1,3}\.\d{1,6}),\s*lon\:(-?\d{1,3}\.\d{1,6}),\s*text\:("|')(.*)\3}(?:,|])/ ;
var point;
var sampleText = script ;
var startIndex = 0;
var totalLength = sampleText.length;
var result, pos;
while (startIndex != totalLength) {
result = regexpMarkers.exec(sampleText);
if (result && result.length > 0) {
pos = sampleText.indexOf(result[0]);
startIndex += pos;
this.markerPoints.push( {lat:result[1], lon:result[2], text:this.decodeText(result[4])} ) ;
sampleText = sampleText.substr(pos + result[0].length);
startIndex += result[0].length;
} else {
break;
}
}
/*
while (result = regexpMarkers.exec( script ) )
{
this.markerPoints.push( {lat:result[1], lon:result[2], text:result[4]} ) ;
}
*/
}
// var encodedPoints = "iuowFf{kbMzH}N`IbJb@zBpYzO{dAvfF{LwDyN`_@`NzKqB|Ec@|L}BKmBbCoPjrBeEdy@uJ`Mn@zoAer@bjA~Xz{JczBa]pIps@de@tW}rCdxSwhPl`XgikCl{soA{dLdAaaF~cCyxCk_Aao@jp@kEvnCgoJ`]y[pVguKhCkUflAwrEzKk@yzCv^k@?mI";
var regexpLinePoints = /var encodedPoints\s*=\s*("|')(.*)\1;\s*\n/ ;
if (regexpLinePoints.test( script ) )
{
this.LinePoints = RegExp.$2 ;
}
// var encodedLevels = "B????????????????????????????????????B";
var regexpLineLevels = /var encodedLevels\s*=\s*("|')(.*)\1;\s*\n/ ;
if (regexpLineLevels.test( script ) )
{
this.LineLevels = RegExp.$2 ;
}
// 1.8 mapType
// map.setMapType( allMapTypes[ 1 ] );
var regexpMapType = /setMapType\([^\[]*\[\s*(\d+)\s*\]\s*\)/ ;
if (regexpMapType.test( script ) )
{
this.mapType = RegExp.$1 ;
}
// 1.9 wrapper div with custom class
if ( version >= 9 )
{
var regexpWrapper = /
') ;
aScript.push( versionMarker ) ;
if ( this.WrapperClass !== '')
aScript.push('document.write(\'
\'); //wrapper');
aScript.push('document.write(\'
.<\\\/div>\');');
if ( this.WrapperClass !== '')
aScript.push('document.write(\'<\\\/div>\'); ');
aScript.push('function CreateGMap' + this.number + '() {');
aScript.push(' if(!GBrowserIsCompatible()) return;');
aScript.push(' var allMapTypes = [G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP] ;');
aScript.push(' var map = new GMap2(document.getElementById("gmap' + this.number + '"), {mapTypes:allMapTypes});');
aScript.push(' map.setCenter(new GLatLng(' + this.centerLat + ',' + this.centerLon + '), ' + this.zoom + ');');
aScript.push(' map.setMapType( allMapTypes[ ' + this.mapType + ' ] );');
aScript.push(' map.addControl(new GSmallMapControl());');
aScript.push(' map.addControl(new GMapTypeControl());');
var aPoints = [];
for (var i=0; i');
return aScript.join('\r\n');
}
// Modifications of the core routines of FCKeditor:
FCKXHtml.GetXHTML = Inject(FCKXHtml.GetXHTML, null, FCK.GoogleMapsHandler.GetXHTMLAfter ) ;
FCKXHtml.TagProcessors.img = function( node, htmlNode, xmlNode )
{
if ( htmlNode.getAttribute( 'MapNumber' ) )
{
var oMap = FCK.GoogleMapsHandler.getMap( htmlNode.getAttribute( 'MapNumber' ) ) ;
FCK.GoogleMapsHandler.CreatedMapsNames.push( oMap.number ) ;
oMap.updateScript( htmlNode );
node = FCK.GetRealElement( htmlNode ) ;
if ( FCK.GoogleMapsHandler.CreatedMapsNames.length == 1 )
{
// If it is the first map, insert the google maps script
var index = FCKTempBin.AddElement( FCK.GoogleMapsHandler.GenerateGoogleScript() ) ;
var prefix = ( FCKConfig.ProtectedSource._CodeTag || 'PS..' ) ;
oScriptCommentNode = xmlNode.ownerDocument.createComment( '{' + prefix + index + '}' ) ;
xmlNode.appendChild( oScriptCommentNode ) ;
}
return xmlNode.ownerDocument.createComment( node.nodeValue ) ;
}
if (typeof FCK.GoogleMapsHandler.previousProcessor == 'function')
node = FCK.GoogleMapsHandler.previousProcessor( node, htmlNode, xmlNode ) ;
else
node = FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
return node ;
};
/**
@desc inject the function
@author Aimingoo&Riceball
*/
function Inject( aOrgFunc, aBeforeExec, aAtferExec ) {
return function() {
if (typeof(aBeforeExec) == 'function') arguments = aBeforeExec.apply(this, arguments) || arguments;
//convert arguments object to array
var Result, args = [].slice.call(arguments);
args.push(aOrgFunc.apply(this, args));
if (typeof(aAtferExec) == 'function') Result = aAtferExec.apply(this, args);
return (typeof(Result) != 'undefined')?Result:args.pop();
} ;
}