<commit_before>L.OpenStreetBugs = L.FeatureGroup.extend({
	options : {
		serverURL : "http://openstreetbugs.schokokeks.org/api/0.1/",
		readonly : false,
		setCookie : true,
		username : "NoName",
		cookieLifetime : 1000,
		cookiePath : null,
		permalinkZoom : 14,
		permalinkUrl: null,
		opacity : 0.7,
		showOpen: true,
		showClosed: true,
		iconOpen: "http://openstreetbugs.schokokeks.org/client/open_bug_marker.png",
		iconClosed:"http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png",
		iconActive: undefined,
		editArea: 0.01,
		popupOptions: {autoPan: false},
	},

	initialize : function(options)
	{
		var tmp = L.Util.extend({}, this.options.popupOptions, (options || {}).popupOptions)
		L.Util.setOptions(this, options)
		this.options.popupOptions = tmp;

		putAJAXMarker.layers.push(this);

		this.bugs = {};
		this._layers = {};

		var username = this.get_cookie("osbUsername");
		if (username)
			this.options.username = username;

		L.OpenStreetBugs.setCSS();
	},

	onAdd : function(map)
	{
		this._map = map;
		this._map.on("moveend", this.loadBugs, this);
		this._iterateLayers(map.addLayer, map);
		this.loadBugs();
		if (!this.options.readonly) {
			map.doubleClickZoom.disable();
			map.on('dblclick', this.addBug, this);
		}
	},

	onRemove : function(map)
	{
		this._map.off("moveend", this.loadBugs, this);
		this._iterateLayers(map.removeLayer, map);
		delete this._map;
		if (!this.options.readonly) {
			map.doubleClickZoom.enable();
			map.off('dblclick', this.addBug, this);
		}
	},

	set_cookie : function(name, value)
	{
		var expires = (new Date((new Date()).getTime() + 604800000)).toGMTString(); // one week from now
		document.cookie = name+"="+escape(value)+";";
	},

	get_cookie : function(name)
	{
		var cookies = (document.cookie || '').split(/;\s*/);<commit_msg>add function fnOn in osb<commit_after>L.OpenStreetBugs = L.FeatureGroup.extend({
	options : {
		serverURL : "http://openstreetbugs.schokokeks.org/api/0.1/",
		readonly : false,
		setCookie : true,
		username : "NoName",
		cookieLifetime : 1000,
		cookiePath : null,
		permalinkZoom : 14,
		permalinkUrl: null,
		opacity : 0.7,
		showOpen: true,
		showClosed: true,
		iconOpen: "http://openstreetbugs.schokokeks.org/client/open_bug_marker.png",
		iconClosed:"http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png",
		iconActive: undefined,
		editArea: 0.01,
		popupOptions: {autoPan: false},
		fnOnAdd: undefined,
		fnOnRemove: undefined,
	},

	initialize : function(options)
	{
		var tmp = L.Util.extend({}, this.options.popupOptions, (options || {}).popupOptions)
		L.Util.setOptions(this, options)
		this.options.popupOptions = tmp;

		putAJAXMarker.layers.push(this);

		this.bugs = {};
		this._layers = {};

		var username = this.get_cookie("osbUsername");
		if (username)
			this.options.username = username;

		L.OpenStreetBugs.setCSS();
	},

	onAdd : function(map)
	{
		this._map = map;
		this._map.on("moveend", this.loadBugs, this);
		this._iterateLayers(map.addLayer, map);
		this.loadBugs();
		if (!this.options.readonly) {
			map.doubleClickZoom.disable();
			map.on('dblclick', this.addBug, this);
		}
		if (this.options.fnOnAdd) this.options.fnOnAdd();
	},

	onRemove : function(map)
	{
		this._map.off("moveend", this.loadBugs, this);
		this._iterateLayers(map.removeLayer, map);
		delete this._map;
		if (!this.options.readonly) {
			map.doubleClickZoom.enable();
			map.off('dblclick', this.addBug, this);
		}
		if (this.options.fnOnRemove) this.options.fnOnRemove();
	},

	set_cookie : function(name, value)
	{
		var expires = (new Date((new Date()).getTime() + 604800000)).toGMTString(); // one week from now
		document.cookie = name+"="+escape(value)+";";
	},

	get_cookie : function(name)
	{
		var cookies = (document.cookie || '').split(/;\s*/);
{'fraction_non_alphanumeric': 0.16675461741424802, 'fraction_numerical': 0.011609498680738786, 'mean_word_length': 4.1438263229308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7212981', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1360, 'n_words': 233}