Private
Server IP : 195.201.23.43  /  Your IP : 18.217.252.137
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lijnvissersterborchtmeulebeke/public_html/media/com_finder/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/lijnvissersterborchtmeulebeke/public_html/media/com_finder/js/highlighter.js
var Highlighter = new Class({
	options: {
		autoUnhighlight: true,
		caseSensitive: false,
		startElement: false,
		endElement: false,
		elements: new Array(),
		className: 'highlight',
		onlyWords: true,
		tag: 'span'
	},
	initialize: function (options) {
		this.setOptions(options);
		this.getElements(this.options.startElement, this.options.endElement);
		this.words = [];
	},
	highlight: function (words) {
		if (words.constructor === String) {
			words = [words];
		}
		if (this.options.autoUnhighlight) {
			this.unhighlight(words);
		}
		var pattern = this.options.onlyWords ? '\b' + pattern + '\b' : '(' + words.join('\\b|\\b') + ')';
		var regex = new RegExp(pattern, this.options.caseSensitive ? '' : 'i');
		this.options.elements.each(function (el) {
			this.recurse(el, regex, this.options.className);
		}, this);
		return this;
	},
	unhighlight: function (words) {
		if (words.constructor === String) {
			words = [words];
		}
		words.each(function (word) {
			word = (this.options.caseSensitive ? word : word.toUpperCase());
			if (this.words[word]) {
				var elements = $$(this.words[word]);
				elements.setProperty('class', '');
				elements.each(function (el) {
					var tn = document.createTextNode(el.getText());
					el.getParent().replaceChild(tn, el);
				});
			}
		}, this);
		return this;
	},
	recurse: function (node, regex, klass) {
		if (node.nodeType === 3) {
			var match = node.data.match(regex);
			if (match) {
				var highlight = new Element(this.options.tag);
				highlight.addClass(klass);
				var wordNode = node.splitText(match.index);
				wordNode.splitText(match[0].length);
				var wordClone = wordNode.cloneNode(true);
				highlight.appendChild(wordClone);
				wordNode.parentNode.replaceChild(highlight, wordNode);
				highlight.setProperty('rel', highlight.get('text'));
				var comparer = highlight.get('text');
				if (!this.options.caseSensitive) {
					comparer = highlight.get('text').toUpperCase();
				}
				if (!this.words[comparer]) {
					this.words[comparer] = [];
				}
				this.words[comparer].push(highlight);
				return 1;
			}
		} else if ((node.nodeType === 1 && node.childNodes) && !/(script|style|textarea|iframe)/i.test(node.tagName) && !(node.tagName === this.options.tag.toUpperCase() && node.className === klass)) {
			for (var i = 0; i < node.childNodes.length; i++) {
				i += this.recurse(node.childNodes[i], regex, klass);
			}
		}
		return 0;
	},
	getElements: function (start, end) {
		var next = start.getNext();
		if (next.id != end.id) {
			this.options.elements.include(next);
			this.getElements(next, end);
		}
	}
});
Highlighter.implement(new Options);
window.addEvent('domready', function () {
	var start = document.id('highlighter-start');
	var end = document.id('highlighter-end');
	if (!start || !end || !window.highlight) {
		return true;
	}
	highlighter = new Highlighter({
		startElement: start,
		endElement: end,
		autoUnhighlight: true,
		onlyWords: false
	}).highlight(window.highlight);
	start.dispose();
	end.dispose();
});
Private