File: jquery.jush.js

package info (click to toggle)
libjs-jush 2.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 992 kB
  • sloc: javascript: 6,929; php: 12; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(function ($) {
	
	// include jush.js here
	
	$.jush = jush;
	
	/** Highlight element content
	* @param [string]
	* @return jQuery
	* @this jQuery
	*/
	$.fn.jush = function (language) {
		return this.each(function () {
			var lang = language;
			var $this = $(this);
			if (!lang) {
				var match = /(^|\s)(?:jush-|language-)(\S+)/.exec($this.attr('class'));
				lang = (match ? match[2] : 'htm');
			}
			$this.html(jush.highlight(lang, $this.text()));
		});
	}
	
})(jQuery);