<commit_before>Ext.onReady(function() {
	var maps = Ext.DomQuery.select('div.vpcGoogleMap');
    Ext.each(maps, function(map) {
		mapContainer= new Ext.Element(map)
		var options = Ext.decode(mapContainer.down("div.options").dom.innerHTML);
		var text = mapContainer.down("div.text").dom.innerHTML;
		myMap = new Vpc.Advanced.GoogleMap(mapContainer, options, text);
		myMap.show();
    	myMap.activateMarker();
	});

});



Ext.namespace("Vpc.Advanced");
Vpc.Advanced.GoogleMap = function(mapContainer, options, text){
		var input = mapContainer.down("form.fromAddress input");
		mapContainer.down("form.fromAddress").on('submit', function(e) {
			this.setMapDir(input.getValue());
			e.stopEvent();
		}, this);
		this.mapContainer = mapContainer;
		this.options = options;
		this.text = text;

		var container = mapContainer.down(".container");
		container.setWidth(parseInt(options.width));
		container.setHeight(parseInt(options.height));

		var input = mapContainer.down("form.fromAddress input");
		input.set({value:'Ihr Abfahrtsort: PLZ, Ort, Straße'});
		input.on('focus', function() {
			if (this.getValue() == 'Ihr Abfahrtsort: PLZ, Ort, Straße'){
				this.set({
					value: ''
				});
				this.removeClass('textBefore');
				this.addClass('textOn');
			}
		}, input);
		input.on('blur', function() {
			if (this.getValue()=='') {
				this.set({
					value:'Ihr Abfahrtsort: PLZ, Ort, Straße'});
			}
			this.addClass('textBefore');
		}, input);
};




Vpc.Advanced.GoogleMap.prototype = {

	show : function()
	{
		this.map = new GMap2(this.mapContainer.down(".container").dom);
		this.geocoder = new GClientGeocoder();
		if (this.options.zoom_properties == '0')
			this.map.addControl(new GLargeMapControl());
		else if (this.options.zoom_properties == '1')
			this.map.addControl(new GSmallMapControl());

		if (parseInt(this.options.scale))
        	this.map.addControl(new GScaleControl(),
								new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(64,15)));

		if (parseInt(this.options.satelite))
			this.map.addControl(new GMapTypeControl());

		if (parseInt(this.options.overview))
			this.map.addControl(new GOverviewMapControl());


		this.map.setCenter(new GLatLng(parseFloat(this.options.longitude),
										parseFloat(this.options.latitude)),
										parseInt(this.options.zoom));
										this.mapDir = new GDirections(this.map,
												this.mapContainer.down(".mapDir").dom);

	},

	activateMarker : function (){
		this.marker = new GMarker(new GLatLng(parseFloat(this.options.longitude),
								  parseFloat(this.options.latitude)), {draggable: false});
		this.map.addOverlay(this.marker);
		this.windowsize = parseInt(this.options.width) * 0.8;
		this.marker.openInfoWindowHtml(this.text, {maxWidth: this.windowsize});
		GEvent.addListener(this.marker, 'click',this.showWindow.createDelegate(this));
	},

	showWindow : function (){
		this.marker.openInfoWindowHtml(this.text, {maxWidth: this.windowsize});
	},

	setMapDir : function (fromAddress) {
		this.map.closeInfoWindow();
        var gcoder = new GClientGeocoder();
        gcoder.setBaseCountryCode('AT');
        gcoder.getLocations(fromAddress, this.testCallback.createDelegate(this));
 	},
	testCallback : function(o) {
		if (!o.Placemark) {
            alert('Eingegebener Ort konnte nicht gefunden werden.');
        } else {
            this.useFrom(o.Placemark[0], false);
            this.suggestLocations(o.Placemark);
        }
    },
	useFrom : function(Placemark, rewriteInput){
		if (typeof Placemark != 'object') {
                    Placemark = this.suggestPlacemarks[Placemark];
                }
                var pos = Placemark.Point.coordinates[1] +','+ Placemark.Point.coordinates[0];
                this.mapDir.load('from: ' + pos + ' to: ' + this.options.longitude + ', ' +
									this.options.latitude, { 'locale': 'de_AT' });
				if (rewriteInput) mapContainer.down("form.fromAddress").set({
					value: Placemark.address
				});
                	this.mapContainer.down(".mapDirSuggestParent").setStyle({display:"none"});
	},
	suggestLocations : function(Placemark){
		this.suggestPlacemarks = Placemark;
                var el = this.mapContainer.down(".mapDirSuggestParent ul.mapDirSuggest");
                var elParent = this.mapContainer.down(".mapDirSuggestParent");
                if (Placemark.length > 1) {
					el.remove();
                    elParent.setStyle({display:"block"});
					el = elParent.createChild({tag: 'ul'});
					el.addClass('mapDirSuggest');
                    for (var i=0; i<10; i++) {
                        if (!Placemark[i]) { break; }
						var a = el.createChild({tag: 'li'}).createChild({tag: 'a',
												href: '#', html: Placemark[i].address, rel:i});
						a.on('click', function(e, el){
							this.useFrom(Placemark[el.rel], true);
							e.stopEvent();
						}, this);
					}
                } else if (elParent) {
                    elParent.style.display = 'none';
                }
	}
}<commit_msg>Tigerfehler raus buck mit nur einem zeil behoben<commit_after>Ext.onReady(function() {
	var maps = Ext.DomQuery.select('div.vpcGoogleMap');
    Ext.each(maps, function(map) {
		mapContainer= new Ext.Element(map)
		var options = Ext.decode(mapContainer.down("div.options").dom.innerHTML);
		var text = mapContainer.down("div.text").dom.innerHTML;
		myMap = new Vpc.Advanced.GoogleMap(mapContainer, options, text);
		myMap.show();
    	myMap.activateMarker();
	});

});



Ext.namespace("Vpc.Advanced");
Vpc.Advanced.GoogleMap = function(mapContainer, options, text){
		var input = mapContainer.down("form.fromAddress input");
		mapContainer.down("form.fromAddress").on('submit', function(e) {
			this.setMapDir(input.getValue());
			e.stopEvent();
		}, this);
		this.mapContainer = mapContainer;
		this.options = options;
		this.text = text;

		var container = mapContainer.down(".container");
		container.setWidth(parseInt(options.width));
		container.setHeight(parseInt(options.height));

		var input = mapContainer.down("form.fromAddress input");
		input.dom.value = 'Ihr Abfahrtsort: PLZ, Ort, Straße';
		//input.set({value:'Ihr Abfahrtsort: PLZ, Ort, Straße'}); // auskommentiert wegen problemen mit safari
		input.on('focus', function() {
			if (this.getValue() == 'Ihr Abfahrtsort: PLZ, Ort, Straße'){
				/*this.set({
					value: ''
				});*/
				input.dom.value = '';
				this.removeClass('textBefore');
				this.addClass('textOn');
			}
		}, input);
		input.on('blur', function() {
			if (this.getValue()=='') {
				/*this.set({
					value:'Ihr Abfahrtsort: PLZ, Ort, Straße'});*/
					input.dom.value = 'Ihr Abfahrtsort: PLZ, Ort, Straße';
					this.removeClass('textOn');
					this.addClass('textBefore');

			}
			this.addClass('textBefore');
		}, input);
};

Vpc.Advanced.GoogleMap.prototype = {

	show : function()
	{
		this.map = new GMap2(this.mapContainer.down(".container").dom);
		this.geocoder = new GClientGeocoder();
		if (this.options.zoom_properties == '0')
			this.map.addControl(new GLargeMapControl());
		else if (this.options.zoom_properties == '1')
			this.map.addControl(new GSmallMapControl());

		if (parseInt(this.options.scale))
        	this.map.addControl(new GScaleControl(),
								new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(64,15)));

		if (parseInt(this.options.satelite))
			this.map.addControl(new GMapTypeControl());

		if (parseInt(this.options.overview))
			this.map.addControl(new GOverviewMapControl());


		this.map.setCenter(new GLatLng(parseFloat(this.options.longitude),
										parseFloat(this.options.latitude)),
										parseInt(this.options.zoom));
										this.mapDir = new GDirections(this.map,
												this.mapContainer.down(".mapDir").dom);

	},

	activateMarker : function (){
		this.marker = new GMarker(new GLatLng(parseFloat(this.options.longitude),
								  parseFloat(this.options.latitude)), {draggable: false});
		this.map.addOverlay(this.marker);
		this.windowsize = parseInt(this.options.width) * 0.8;
		this.marker.openInfoWindowHtml(this.text, {maxWidth: this.windowsize});
		GEvent.addListener(this.marker, 'click',this.showWindow.createDelegate(this));
	},

	showWindow : function (){
		this.marker.openInfoWindowHtml(this.text, {maxWidth: this.windowsize});
	},

	setMapDir : function (fromAddress) {
		this.map.closeInfoWindow();
        var gcoder = new GClientGeocoder();
        gcoder.setBaseCountryCode('AT');
        gcoder.getLocations(fromAddress, this.testCallback.createDelegate(this));
 	},
	testCallback : function(o) {
		if (!o.Placemark) {
            alert('Eingegebener Ort konnte nicht gefunden werden.');
        } else {
            this.useFrom(o.Placemark[0], false);
            this.suggestLocations(o.Placemark);
        }
    },
	useFrom : function(Placemark, rewriteInput){
		if (typeof Placemark != 'object') {
                    Placemark = this.suggestPlacemarks[Placemark];
                }
                var pos = Placemark.Point.coordinates[1] +','+ Placemark.Point.coordinates[0];
                this.mapDir.load('from: ' + pos + ' to: ' + this.options.longitude + ', ' +
									this.options.latitude, { 'locale': 'de_AT' });
				if (rewriteInput) mapContainer.down("form.fromAddress").set({
					value: Placemark.address
				});
                	this.mapContainer.down(".mapDirSuggestParent").setStyle({display:"none"});
	},
	suggestLocations : function(Placemark){
		this.suggestPlacemarks = Placemark;
                var el = this.mapContainer.down(".mapDirSuggestParent ul.mapDirSuggest");
                var elParent = this.mapContainer.down(".mapDirSuggestParent");
                if (Placemark.length > 1) {
					el.remove();
                    elParent.setStyle({display:"block"});
					el = elParent.createChild({tag: 'ul'});
					el.addClass('mapDirSuggest');
                    for (var i=0; i<10; i++) {
                        if (!Placemark[i]) { break; }
						var a = el.createChild({tag: 'li'}).createChild({tag: 'a',
												href: '#', html: Placemark[i].address, rel:i});
						a.on('click', function(e, el){
							this.useFrom(Placemark[el.rel], true);
							e.stopEvent();
						}, this);
					}
                } else if (elParent) {
                    elParent.setStyle({display:"none"});
                }
	}
}
{'fraction_non_alphanumeric': 0.1598791893998441, 'fraction_numerical': 0.003117692907248636, 'mean_word_length': 3.2052437525604263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5267719', 'n_tokens_mistral': 3807, 'n_tokens_neox': 3320, 'n_words': 524}