aboutsummaryrefslogtreecommitdiffstats
path: root/demos/functional/js
diff options
context:
space:
mode:
Diffstat (limited to 'demos/functional/js')
-rw-r--r--demos/functional/js/beautify.js533
-rw-r--r--demos/functional/js/behaviour.functionaldemos.js13
-rw-r--r--demos/functional/js/behaviour.js205
-rw-r--r--demos/functional/js/chili-recipes.js163
-rw-r--r--demos/functional/js/functional.demo.js175
-rw-r--r--demos/functional/js/jquery.chili.pack.js12
6 files changed, 1101 insertions, 0 deletions
diff --git a/demos/functional/js/beautify.js b/demos/functional/js/beautify.js
new file mode 100644
index 000000000..6c6ef29b4
--- /dev/null
+++ b/demos/functional/js/beautify.js
@@ -0,0 +1,533 @@
+/*
+
+ JS Beautifier
+---------------
+ $Date: 2008-04-21 16:13:36 +0300 (Mon, 21 Apr 2008) $
+ $Revision: 53 $
+
+
+ Written by Einars "elfz" Lielmanis, <elfz@laacz.lv>
+ http://elfz.laacz.lv/beautify/
+
+ Originally converted to javascript by Vital, <vital76@gmail.com>
+ http://my.opera.com/Vital/blog/2007/11/21/javascript-beautify-on-javascript-translated
+
+
+ You are free to use this in any way you want, in case you find this useful or working for you.
+
+ Usage:
+ js_beautify(js_source_text);
+
+*/
+
+
+function js_beautify(js_source_text, indent_size, indent_character)
+{
+
+ var input, output, token_text, last_type, last_text, last_word, current_mode, modes, indent_level, indent_string;
+ var whitespace, wordchar, punct, parser_pos, line_starters, in_case;
+ var prefix, token_type;
+
+ function print_newline(ignore_repeated)
+ {
+ ignore_repeated = typeof ignore_repeated === 'undefined' ? true: ignore_repeated;
+
+ // remove trailing whitespace and indent
+ while (output.length && (output[output.length - 1] === ' ' || output[output.length - 1] === indent_string)) {
+ output.pop();
+ }
+
+ if (!output.length) {
+ return; // no newline on start of file
+ }
+
+ if (output[output.length - 1] !== "\n" || !ignore_repeated) {
+ output.push("\n");
+ }
+ for (var i = 0; i < indent_level; i++) {
+ output.push(indent_string);
+ }
+ }
+
+
+
+ function print_space()
+ {
+ var last_output = output.length ? output[output.length - 1] : ' ';
+ if (last_output !== ' ' && last_output !== '\n' && last_output !== indent_string) { // prevent occassional duplicate space
+ output.push(' ');
+ }
+ }
+
+
+ function print_token()
+ {
+ output.push(token_text);
+ }
+
+ function indent()
+ {
+ indent_level++;
+ }
+
+
+ function unindent()
+ {
+ if (indent_level) {
+ indent_level--;
+ }
+ }
+
+
+ function remove_indent()
+ {
+ if (output.length && output[output.length - 1] === indent_string) {
+ output.pop();
+ }
+ }
+
+
+ function set_mode(mode)
+ {
+ modes.push(current_mode);
+ current_mode = mode;
+ }
+
+
+ function restore_mode()
+ {
+ current_mode = modes.pop();
+ }
+
+
+ function in_array(what, arr)
+ {
+ for (var i = 0; i < arr.length; i++)
+ {
+ if (arr[i] === what) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+
+ function get_next_token()
+ {
+ var n_newlines = 0;
+ var c = '';
+
+ do {
+ if (parser_pos >= input.length) {
+ return ['', 'TK_EOF'];
+ }
+ c = input.charAt(parser_pos);
+
+ parser_pos += 1;
+ if (c === "\n") {
+ n_newlines += 1;
+ }
+ }
+ while (in_array(c, whitespace));
+
+ if (n_newlines > 1) {
+ for (var i = 0; i < 2; i++) {
+ print_newline(i === 0);
+ }
+ }
+ var wanted_newline = (n_newlines === 1);
+
+
+ if (in_array(c, wordchar)) {
+ if (parser_pos < input.length) {
+ while (in_array(input.charAt(parser_pos), wordchar)) {
+ c += input.charAt(parser_pos);
+ parser_pos += 1;
+ if (parser_pos === input.length) {
+ break;
+ }
+ }
+ }
+
+ // small and surprisingly unugly hack for 1E-10 representation
+ if (parser_pos !== input.length && c.match(/^[0-9]+[Ee]$/) && input.charAt(parser_pos) === '-') {
+ parser_pos += 1;
+
+ var t = get_next_token(parser_pos);
+ c += '-' + t[0];
+ return [c, 'TK_WORD'];
+ }
+
+ if (c === 'in') { // hack for 'in' operator
+ return [c, 'TK_OPERATOR'];
+ }
+ return [c, 'TK_WORD'];
+ }
+
+ if (c === '(' || c === '[') {
+ return [c, 'TK_START_EXPR'];
+ }
+
+ if (c === ')' || c === ']') {
+ return [c, 'TK_END_EXPR'];
+ }
+
+ if (c === '{') {
+ return [c, 'TK_START_BLOCK'];
+ }
+
+ if (c === '}') {
+ return [c, 'TK_END_BLOCK'];
+ }
+
+ if (c === ';') {
+ return [c, 'TK_END_COMMAND'];
+ }
+
+ if (c === '/') {
+ var comment = '';
+ // peek for comment /* ... */
+ if (input.charAt(parser_pos) === '*') {
+ parser_pos += 1;
+ if (parser_pos < input.length) {
+ while (! (input.charAt(parser_pos) === '*' && input.charAt(parser_pos + 1) && input.charAt(parser_pos + 1) === '/') && parser_pos < input.length) {
+ comment += input.charAt(parser_pos);
+ parser_pos += 1;
+ if (parser_pos >= input.length) {
+ break;
+ }
+ }
+ }
+ parser_pos += 2;
+ return ['/*' + comment + '*/', 'TK_BLOCK_COMMENT'];
+ }
+ // peek for comment // ...
+ if (input.charAt(parser_pos) === '/') {
+ comment = c;
+ while (input.charAt(parser_pos) !== "\x0d" && input.charAt(parser_pos) !== "\x0a") {
+ comment += input.charAt(parser_pos);
+ parser_pos += 1;
+ if (parser_pos >= input.length) {
+ break;
+ }
+ }
+ parser_pos += 1;
+ if (wanted_newline) {
+ print_newline();
+ }
+ return [comment, 'TK_COMMENT'];
+ }
+
+ }
+
+ if (c === "'" || // string
+ c === '"' || // string
+ (c === '/' &&
+ ((last_type === 'TK_WORD' && last_text === 'return') || (last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK' || last_type === 'TK_OPERATOR' || last_type === 'TK_EOF' || last_type === 'TK_END_COMMAND')))) { // regexp
+ var sep = c;
+ var esc = false;
+ c = '';
+
+ if (parser_pos < input.length) {
+
+ while (esc || input.charAt(parser_pos) !== sep) {
+ c += input.charAt(parser_pos);
+ if (!esc) {
+ esc = input.charAt(parser_pos) === '\\';
+ } else {
+ esc = false;
+ }
+ parser_pos += 1;
+ if (parser_pos >= input.length) {
+ break;
+ }
+ }
+
+ }
+
+ parser_pos += 1;
+ if (last_type === 'TK_END_COMMAND') {
+ print_newline();
+ }
+ return [sep + c + sep, 'TK_STRING'];
+ }
+
+ if (in_array(c, punct)) {
+ while (parser_pos < input.length && in_array(c + input.charAt(parser_pos), punct)) {
+ c += input.charAt(parser_pos);
+ parser_pos += 1;
+ if (parser_pos >= input.length) {
+ break;
+ }
+ }
+ return [c, 'TK_OPERATOR'];
+ }
+
+ return [c, 'TK_UNKNOWN'];
+ }
+
+
+ //----------------------------------
+
+ indent_character = indent_character || ' ';
+ indent_size = indent_size || 4;
+
+ indent_string = '';
+ while (indent_size--) {
+ indent_string += indent_character;
+ }
+
+ input = js_source_text;
+
+ last_word = ''; // last 'TK_WORD' passed
+ last_type = 'TK_START_EXPR'; // last token type
+ last_text = ''; // last token text
+ output = [];
+
+ whitespace = "\n\r\t ".split('');
+ wordchar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'.split('');
+ punct = '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |='.split(' ');
+
+ // words which should always start on new line.
+ line_starters = 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function'.split(',');
+
+ // states showing if we are currently in expression (i.e. "if" case) - 'EXPRESSION', or in usual block (like, procedure), 'BLOCK'.
+ // some formatting depends on that.
+ current_mode = 'BLOCK';
+ modes = [current_mode];
+
+ indent_level = 0;
+ parser_pos = 0; // parser position
+ in_case = false; // flag for parser that case/default has been processed, and next colon needs special attention
+ while (true) {
+ var t = get_next_token(parser_pos);
+ token_text = t[0];
+ token_type = t[1];
+ if (token_type === 'TK_EOF') {
+ break;
+ }
+
+ switch (token_type) {
+
+ case 'TK_START_EXPR':
+
+ set_mode('EXPRESSION');
+ if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR') {
+ // do nothing on (( and )( and ][ and ]( ..
+ } else if (last_type !== 'TK_WORD' && last_type !== 'TK_OPERATOR') {
+ print_space();
+ } else if (in_array(last_word, line_starters) && last_word !== 'function') {
+ print_space();
+ }
+ print_token();
+ break;
+
+ case 'TK_END_EXPR':
+
+ print_token();
+ restore_mode();
+ break;
+
+ case 'TK_START_BLOCK':
+
+ set_mode('BLOCK');
+ if (last_type !== 'TK_OPERATOR' && last_type !== 'TK_START_EXPR') {
+ if (last_type === 'TK_START_BLOCK') {
+ print_newline();
+ } else {
+ print_space();
+ }
+ }
+ print_token();
+ indent();
+ break;
+
+ case 'TK_END_BLOCK':
+ if (last_type === 'TK_START_BLOCK') {
+ // nothing
+ unindent();
+ } else {
+ unindent();
+ print_newline();
+ }
+ print_token();
+ restore_mode();
+ break;
+
+ case 'TK_WORD':
+
+ if (token_text === 'case' || token_text === 'default') {
+ if (last_text === ':') {
+ // switch cases following one another
+ remove_indent();
+ } else {
+ // case statement starts in the same line where switch
+ unindent();
+ print_newline();
+ indent();
+ }
+ print_token();
+ in_case = true;
+ break;
+ }
+
+ prefix = 'NONE';
+ if (last_type === 'TK_END_BLOCK') {
+ if (!in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) {
+ prefix = 'NEWLINE';
+ } else {
+ prefix = 'SPACE';
+ print_space();
+ }
+ } else if (last_type === 'TK_END_COMMAND' && current_mode === 'BLOCK') {
+ prefix = 'NEWLINE';
+ } else if (last_type === 'TK_END_COMMAND' && current_mode === 'EXPRESSION') {
+ prefix = 'SPACE';
+ } else if (last_type === 'TK_WORD') {
+ prefix = 'SPACE';
+ } else if (last_type === 'TK_START_BLOCK') {
+ prefix = 'NEWLINE';
+ } else if (last_type === 'TK_END_EXPR') {
+ print_space();
+ prefix = 'NEWLINE';
+ }
+
+ if (in_array(token_text, line_starters) || prefix === 'NEWLINE') {
+
+ if (last_text === 'else') {
+ // no need to force newline on else break
+ print_space();
+ } else if ((last_type === 'TK_START_EXPR' || last_text === '=') && token_text === 'function') {
+ // no need to force newline on 'function': (function
+ // DONOTHING
+ } else if (last_type === 'TK_WORD' && (last_text === 'return' || last_text === 'throw')) {
+ // no newline between 'return nnn'
+ print_space();
+ } else if (last_type !== 'TK_END_EXPR') {
+ if ((last_type !== 'TK_START_EXPR' || token_text !== 'var') && last_text !== ':') {
+ // no need to force newline on 'var': for (var x = 0...)
+ if (token_text === 'if' && last_type === 'TK_WORD' && last_word === 'else') {
+ // no newline for } else if {
+ print_space();
+ } else {
+ print_newline();
+ }
+ }
+ }
+ } else if (prefix === 'SPACE') {
+ print_space();
+ }
+ print_token();
+ last_word = token_text;
+ break;
+
+ case 'TK_END_COMMAND':
+
+ print_token();
+ break;
+
+ case 'TK_STRING':
+
+ if (last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK') {
+ print_newline();
+ } else if (last_type === 'TK_WORD') {
+ print_space();
+ }
+ print_token();
+ break;
+
+ case 'TK_OPERATOR':
+
+ var start_delim = true;
+ var end_delim = true;
+
+ if (token_text === ':' && in_case) {
+ print_token(); // colon really asks for separate treatment
+ print_newline();
+ break;
+ }
+
+ in_case = false;
+
+ if (token_text === ',') {
+ if (last_type === 'TK_END_BLOCK') {
+ print_token();
+ print_newline();
+ } else {
+ if (current_mode === 'BLOCK') {
+ print_token();
+ print_newline();
+ } else {
+ print_token();
+ print_space();
+ }
+ }
+ break;
+ } else if (token_text === '--' || token_text === '++') { // unary operators special case
+ if (last_text === ';') {
+ // space for (;; ++i)
+ start_delim = true;
+ end_delim = false;
+ } else {
+ start_delim = false;
+ end_delim = false;
+ }
+ } else if (token_text === '!' && last_type === 'TK_START_EXPR') {
+ // special case handling: if (!a)
+ start_delim = false;
+ end_delim = false;
+ } else if (last_type === 'TK_OPERATOR') {
+ start_delim = false;
+ end_delim = false;
+ } else if (last_type === 'TK_END_EXPR') {
+ start_delim = true;
+ end_delim = true;
+ } else if (token_text === '.') {
+ // decimal digits or object.property
+ start_delim = false;
+ end_delim = false;
+
+ } else if (token_text === ':') {
+ // zz: xx
+ // can't differentiate ternary op, so for now it's a ? b: c; without space before colon
+ start_delim = false;
+ }
+ if (start_delim) {
+ print_space();
+ }
+
+ print_token();
+
+ if (end_delim) {
+ print_space();
+ }
+ break;
+
+ case 'TK_BLOCK_COMMENT':
+
+ print_newline();
+ print_token();
+ print_newline();
+ break;
+
+ case 'TK_COMMENT':
+
+ // print_newline();
+ print_space();
+ print_token();
+ print_newline();
+ break;
+
+ case 'TK_UNKNOWN':
+ print_token();
+ break;
+ }
+
+ last_type = token_type;
+ last_text = token_text;
+ }
+
+ return output.join('');
+
+}
diff --git a/demos/functional/js/behaviour.functionaldemos.js b/demos/functional/js/behaviour.functionaldemos.js
new file mode 100644
index 000000000..8e375db28
--- /dev/null
+++ b/demos/functional/js/behaviour.functionaldemos.js
@@ -0,0 +1,13 @@
+$(document).ready(function() {
+
+ $('.component-links a').click(function() {
+ var comp = $(this).attr('href').replace(/^#/, "");
+ loadDemo(comp);
+ });
+
+ // hash listener
+ if (location.hash) {
+ loadDemo(location.hash.replace(/^#/, ""));
+ }
+
+}); \ No newline at end of file
diff --git a/demos/functional/js/behaviour.js b/demos/functional/js/behaviour.js
new file mode 100644
index 000000000..2ac0305f7
--- /dev/null
+++ b/demos/functional/js/behaviour.js
@@ -0,0 +1,205 @@
+$(document).ready(function() {
+
+ // link demos
+
+ $(".demoflow div.wrapper").click(function() {
+
+ var demo = $(this).children('img').attr('_demo');
+
+ if (demo) {
+ location.href = '/repository/real-world/' + demo;
+ }else {
+ //alert('Under construction!');
+ }
+
+ });
+
+ if ($("div.demoflow").size()) {
+
+ var inst = new $.ui.carousel($("div.demoflow")[0], { height: 200, width: 310 });
+
+ $("div.demoflow-button-left, div.demoflow-button-right").bind("mousedown", function() {
+ var right = this.className.indexOf("right") == -1;
+ if(inst.autoRotator) window.clearInterval(inst.autoRotator);
+ inst.timer = window.setInterval(function() { inst.rotate(right ? "right" : null); }, 13);
+ })
+ .bind("mouseup", function() {
+ window.clearInterval(inst.timer);
+ });
+
+ $('.demoflow div.shadow').hover(function() {
+ this._lastopacity = $(this).css('opacity');
+ $(this).stop().animate({opacity: 0 }, 300);
+ }, function() {
+ $(this).stop().animate({opacity: this._lastopacity }, 300);
+ });
+
+
+ window.setTimeout(function() {
+ inst.element.animate({ opacity: 1 },2000); inst.rotate(0,2000,0.45);
+ window.setTimeout(function() {
+ inst.autoRotator = window.setInterval(function() { inst.rotate(0,2000,0.45); },5000);
+ },3000);
+ },0);
+
+ }
+
+ $('a').click(function(){
+ this.blur();
+ });
+
+ // smooth hover effects by DragonInteractive
+ var hover = hoverEffects();
+ hover.init();
+
+});
+
+ $.ui.carousel = function(element, options) {
+
+ this.element = $(element);
+ this.options = $.extend({}, options);
+ var self = this;
+
+ $.extend(this, {
+ start: Math.PI/2,
+ step: 2*Math.PI/$("> *", this.element).length,
+ radiusX: 400,
+ radiusY: -45,
+ paddingX: this.element.outerWidth() / 2,
+ paddingY: this.element.outerHeight() / 2
+ });
+
+ $("> *", this.element).css({ position: "absolute", top: 0, left: 0, zIndex: 1 });
+ this.rotate();
+ this.rotate("right");
+
+ this.element.parent().bind("mousewheel", function(e,delta) {
+ if(self.autoRotator) window.clearInterval(self.autoRotator);
+ self.rotate(delta < 0 ? "right" : "left");
+ return false;
+ });
+
+ };
+
+ $.ui.carousel.prototype.rotate = function(d,ani,speed) {
+
+ this.start = this.start + (d == "right" ? -(speed || 0.03) : (speed || 0.03));
+ var o = this.options;
+ var self = this;
+
+ setTimeout(function(){
+ $("> *", self.element).each(function(i) {
+ var angle = self.start + i * self.step;
+ var x = self.radiusX * Math.cos(angle);
+ var y = self.radiusY * Math.sin(angle);
+ var _self = this;
+
+ var width = o.width * ((self.radiusY+y) / (2 * self.radiusY));
+ width = (width * width * width) / (o.width * o.width); //This makes the pieces smaller
+ var height = parseInt(width * o.height / o.width);
+
+ //This is highly custom - it will hide the elements at the back
+ $(_self).css({ visibility: height < 30 ? "hidden" : "visible" });
+ if(height < 30 && !ani) return; //This imrpoves the speed, but cannot be used with animation
+
+
+ if(ani) {
+ $(_self).animate({
+ top: Math.round(self.paddingY + y - height/2) + "px",
+ left: Math.round(self.paddingX + x - width/2) + "px",
+ width: Math.round(width) + "px",
+ height: Math.round(height) + "px"
+ },{ duration: ani, easing: "easeOutQuad" });
+ $(_self).css({ zIndex: Math.round(parseInt(100 * (self.radiusY+y) / (2 * self.radiusY))) });
+ } else {
+ $(_self).css({
+ top: self.paddingY + y - height/2 + "px",
+ left: self.paddingX + x - width/2 + "px",
+ width: width + "px",
+ height: height + "px",
+ zIndex: parseInt(100 * (self.radiusY+y) / (2 * self.radiusY))
+ });
+ }
+
+ $("div.shadow",_self).css({ opacity: 1 - (width / o.width) });
+
+ });
+ }, 0);
+ }
+
+
+/**
+ * All credit here goes to DragonInteractive and Yuri Vishnevsky
+ */
+var hoverEffects = function() {
+ var me = this;
+ var args = arguments;
+ var self = {
+ c: {
+ navItems: '.download .click-to-download, #launch-pad .launch-pad-button, div.demoflow-button-left, div.demoflow-button-right',
+ navSpeed: ($.browser.safari ? 600: 350),
+ snOpeningSpeed: ($.browser.safari ? 400: 250),
+ snOpeningTimeout: 150,
+ snClosingSpeed: function() {
+ if (self.subnavHovered()) return 123450;
+ return 150
+ },
+ snClosingTimeout: 700
+ },
+ init: function() {
+ //$('.bg', this.c.navItems).css({
+ // 'opacity': 0
+ //});
+ this.initHoverFades()
+ },
+ subnavHovered: function() {
+ var hovered = false;
+ $(self.c.navItems).each(function() {
+ if (this.hovered) hovered = true
+ });
+ return hovered
+ },
+ initHoverFades: function() {
+ //$('#navigation .bg').css('opacity', 0);
+ $(self.c.navItems).hover(function() {
+ self.fadeNavIn.apply(this)
+ },
+ function() {
+ var el = this;
+ setTimeout(function() {
+ if (!el.open) self.fadeNavOut.apply(el)
+ },
+ 10)
+ })
+ },
+ fadeNavIn: function() {
+ $('.bg', this).stop().animate({
+ 'opacity': 1
+ },
+ self.c.navSpeed)
+ },
+ fadeNavOut: function() {
+ $('.bg', this).stop().animate({
+ 'opacity': 0
+ },
+ self.c.navSpeed)
+ },
+ initSubmenus: function() {
+ $(this.c.navItems).hover(function() {
+ $(self.c.navItems).not(this).each(function() {
+ self.fadeNavOut.apply(this);
+ });
+ this.hovered = true;
+ var el = this;
+ self.fadeNavIn.apply(el);
+ },
+ function() {
+ this.hovered = false;
+ var el = this;
+ if (!el.open) self.fadeNavOut.apply(el);
+ })
+ }
+ };
+
+ return self;
+}; \ No newline at end of file
diff --git a/demos/functional/js/chili-recipes.js b/demos/functional/js/chili-recipes.js
new file mode 100644
index 000000000..727ffa09c
--- /dev/null
+++ b/demos/functional/js/chili-recipes.js
@@ -0,0 +1,163 @@
+/*
+===============================================================================
+Chili is the jQuery code highlighter plugin
+...............................................................................
+ Copyright 2007 / Andrea Ercolino
+-------------------------------------------------------------------------------
+LICENSE: http://www.opensource.org/licenses/mit-license.php
+WEBSITE: http://noteslog.com/chili/
+===============================================================================
+*/
+
+/*
+this file shows how to configure a static setup
+it must be linked from the head of a page like:
+<script type="text/javascript" src="chili/recipes.js"></script>
+*/
+
+ChiliBook.recipeLoading = false;
+
+ChiliBook.recipes[ "jquery.js" ] =
+{
+ steps:
+ {
+ mlcom : { exp: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\// }
+ , com : { exp: /\/\/.*/ }
+ , regexp : { exp: /\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*/ }
+ , string : { exp: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/ }
+ , numbers : { exp: /\b[+-]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?\b/ }
+ , keywords: { exp: /\b(arguments|break|case|catch|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|try|typeof|var|void|while|with)\b/ }
+ , global : { exp: /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/ }
+
+ , "jquery utilities" : {
+ exp : /(?:\$\.browser|\$\.each|\$\.extend|\$\.grep|\$\.map|\$\.merge|\$\.trim)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="global">$$</span></span>'
+ }
+ ,"jquery private" : {
+ exp : /(?:\$\.find|\$\.parents|\$\.sibling|\.domManip|\.eventTesting|\.extend|\.get|\.init|\.jquery|\.pushStack)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="private">$$</span></span>'
+ }
+ ,"jquery ajax" : {
+ exp : /(?:\$\.ajax|\$\.ajaxSetup|\$\.ajaxTimeout|\$\.get|\$\.getIfModified|\$\.getJSON|\$\.getScript|\$\.post|.ajaxComplete|.ajaxError|.ajaxSend|.ajaxStart|.ajaxStop|.ajaxSuccess|.load|.loadIfModified|.serialize)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="ajax">$$</span></span>'
+ }
+ , "jquery object" : {
+ exp : /jQuery|\$(?=\W)/
+ , replacement: '<span class="jquery" title="$0"><span class="object">$$</span></span>'
+ }
+ ,"jquery core" : {
+ exp : /\$\.extend|\$\.noConflict|\.(?:each|eq|get|gt|index|lt|size)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="core">$$</span></span>'
+ }
+ ,"jquery css" : {
+ exp : /\.(?:css|height|width)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="css">$$</span></span>'
+ }
+ ,"jquery attributes" : {
+ exp : /\.(?:addClass|attr|html|removeAttr|removeClass|text|toggleClass|val)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="attributes">$$</span></span>'
+ }
+ ,"jquery traversing" : {
+ exp : /\.(?:add|children|contains|end|filter|find|is|next|not|parent|parents|prev|siblings)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="traversing">$$</span></span>'
+ }
+ ,"jquery manipulation": {
+ exp : /\.(?:after|append|appendTo|before|clone|empty|insertAfter|insertBefore|prepend|prependTo|remove|wrap)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="manipulation">$$</span></span>'
+ }
+ ,"jquery effects" : {
+ exp : /\.(?:animate|fadeIn|fadeOut|fadeTo|hide|show|slideDown|slideToggle|slideUp|toggle)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="effects">$$</span></span>'
+ }
+ ,"jquery events" : {
+ exp : /\.(?:bind|blur|change|click|dblclick|error|focus|hover|keydown|keypress|keyup|load|mousedown|mousemove|mouseout|mouseover|mouseup|one|ready|resize|scroll|select|submit|toggle|trigger|unbind|unload)\b/
+ , replacement: '<span class="jquery" title="$0"><span class="events">$$</span></span>'
+ }
+ }
+};
+
+ChiliBook.recipes[ "html.js" ] =
+{
+ steps: {
+ mlcom : { exp: /\<!--(?:\w|\W)*?--\>/ }
+ , tag : { exp: /(?:\<\!?[\w:]+)|(?:\>)|(?:\<\/[\w:]+\>)|(?:\/\>)/ }
+ , php : { exp: /(?:\<\?php\s)|(?:\<\?)|(?:\?\>)/ }
+ , aname : { exp: /\s+?[\w-]+:?\w+(?=\s*=)/ }
+ , avalue: { exp: /(=\s*)(([\"\'])(?:(?:[^\3\\]*?(?:\3\3|\\.))*?[^\3\\]*?)\3)/
+ , replacement: '$1<span class="$0">$2</span>' }
+ , entity: { exp: /&[\w#]+?;/ }
+ }
+};
+
+ChiliBook.recipes[ "javascript.js" ] =
+{
+ steps: {
+ mlcom : { exp: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\// }
+ , com : { exp: /\/\/.*/ }
+ , regexp : { exp: /\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*/ }
+ , string : { exp: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/ }
+ , numbers : { exp: /\b[+-]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?\b/ }
+ , keywords: { exp: /\b(arguments|break|case|catch|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|try|typeof|var|void|while|with)\b/ }
+ , global : { exp: /\b(toString|valueOf|window|self|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/ }
+ }
+};
+
+ChiliBook.recipes[ "mysql.js" ] =
+{
+ ignoreCase: true
+ , steps: {
+ mlcom : { exp: /\/\*[^*]*\*+([^\/][^*]*\*+)*\// }
+ , com : { exp: /(?:--\s+.*)|(?:[^\\]\#.*)/ }
+ , string : { exp: /([\"\'])(?:(?:[^\1\\\r\n]*?(?:\1\1|\\.))*[^\1\\\r\n]*?)\1/ }
+ , quid : { exp: /(`)(?:(?:[^\1\\\r\n]*?(?:\1\1|\\.))*[^\1\\\r\n]*?)\1/ }
+ , value : { exp: /\b(?:NULL|TRUE|FALSE)\b/ }
+ , number : { exp: /\b[+-]?(\d*\.?\d+|\d+\.?\d*)([eE][+-]?\d+)?\b/ }
+ , hexnum : { exp: /\b0[xX][\dA-Fa-f]+\b|\b[xX]([\'\"])[\dA-Fa-f]+\1/ }
+ , op : { exp: /!=|&&|<|<<|<=|<=>|<>|=|>|>=|>>|\|\|/ }
+ , variable : { exp: /@([$.\w]+|([`\"\'])(?:(?:[^\2\\\r\n]*?(?:\2\2|\\.))*[^\2\\\r\n]*?)\2)/
+ , replacement: '<span class="keyword">@</span><span class="variable">$1</span>' }
+ , keyword : { exp: /\b(?:A(?:CTION|DD|FTER|G(?:AINST|GREGATE)|L(?:GORITHM|L|TER)|N(?:ALYZE|D|Y)|S(?:C(?:II|)|ENSITIVE|)|UTO_INCREMENT|VG(?:_ROW_LENGTH|))|B(?:ACKUP|DB|E(?:FORE|GIN|RKELEYDB|TWEEN)|I(?:GINT|N(?:ARY|LOG)|T)|LOB|O(?:OL(?:EAN|)|TH)|TREE|Y(?:TE|))|C(?:A(?:CHE|LL|S(?:CADE(?:D|)|E))|H(?:A(?:IN|NGE(?:D|)|R(?:ACTER|SET|))|ECK(?:SUM|))|IPHER|L(?:IENT|OSE)|O(?:DE|L(?:LAT(?:E|ION)|UMN(?:S|))|M(?:M(?:ENT|IT(?:TED|))|P(?:ACT|RESSED))|N(?:CURRENT|DITION|NECTION|S(?:ISTENT|TRAINT)|T(?:AINS|INUE)|VERT))|R(?:EATE|OSS)|U(?:BE|R(?:RENT_(?:DATE|TIME(?:STAMP|)|USER)|SOR)))|D(?:A(?:T(?:A(?:BASE(?:S|)|)|E(?:TIME|))|Y(?:_(?:HOUR|MI(?:CROSECOND|NUTE)|SECOND)|))|E(?:ALLOCATE|C(?:IMAL|LARE|)|F(?:AULT|INER)|L(?:AY(?:ED|_KEY_WRITE)|ETE)|S(?:C(?:RIBE|)|_KEY_FILE)|TERMINISTIC)|I(?:RECTORY|S(?:ABLE|CARD|TINCT(?:ROW|))|V)|O(?:UBLE|)|ROP|U(?:AL|MPFILE|PLICATE)|YNAMIC)|E(?:ACH|LSE(?:IF|)|N(?:ABLE|CLOSED|D|GINE(?:S|)|UM)|RRORS|SCAPE(?:D|)|VENTS|X(?:ECUTE|I(?:STS|T)|P(?:ANSION|LAIN)|TENDED))|F(?:A(?:LSE|ST)|ETCH|I(?:ELDS|LE|RST|XED)|L(?:OAT(?:4|8|)|USH)|O(?:R(?:CE|EIGN|)|UND)|R(?:AC_SECOND|OM)|U(?:LL(?:TEXT|)|NCTION))|G(?:E(?:OMETRY(?:COLLECTION|)|T_FORMAT)|LOBAL|R(?:ANT(?:S|)|OUP))|H(?:A(?:NDLER|SH|VING)|ELP|IGH_PRIORITY|O(?:STS|UR(?:_(?:MI(?:CROSECOND|NUTE)|SECOND)|)))|I(?:DENTIFIED|F|GNORE|MPORT|N(?:DEX(?:ES|)|FILE|N(?:ER|O(?:BASE|DB))|OUT|SE(?:NSITIVE|RT(?:_METHOD|))|T(?:1|2|3|4|8|E(?:GER|RVAL)|O|)|VOKER|)|O_THREAD|S(?:OLATION|SUER|)|TERATE)|JOIN|K(?:EY(?:S|)|ILL)|L(?:A(?:NGUAGE|ST)|E(?:A(?:DING|VE(?:S|))|FT|VEL)|I(?:KE|MIT|NES(?:TRING|))|O(?:AD|C(?:AL(?:TIME(?:STAMP|)|)|K(?:S|))|GS|NG(?:BLOB|TEXT|)|OP|W_PRIORITY))|M(?:A(?:STER(?:_(?:CONNECT_RETRY|HOST|LOG_(?:FILE|POS)|P(?:ASSWORD|ORT)|S(?:ERVER_ID|SL(?:_(?:C(?:A(?:PATH|)|ERT|IPHER)|KEY)|))|USER)|)|TCH|X_(?:CONNECTIONS_PER_HOUR|QUERIES_PER_HOUR|ROWS|U(?:PDATES_PER_HOUR|SER_CONNECTIONS)))|E(?:DIUM(?:BLOB|INT|TEXT|)|RGE)|I(?:CROSECOND|DDLEINT|GRATE|N(?:UTE(?:_(?:MICROSECOND|SECOND)|)|_ROWS))|O(?:D(?:E|IF(?:IES|Y)|)|NTH)|U(?:LTI(?:LINESTRING|PO(?:INT|LYGON))|TEX))|N(?:A(?:ME(?:S|)|T(?:IONAL|URAL))|CHAR|DB(?:CLUSTER|)|E(?:W|XT)|O(?:NE|T|_WRITE_TO_BINLOG|)|U(?:LL|MERIC)|VARCHAR)|O(?:FFSET|LD_PASSWORD|N(?:E(?:_SHOT|)|)|P(?:EN|TI(?:MIZE|ON(?:ALLY|)))|R(?:DER|)|UT(?:ER|FILE|))|P(?:A(?:CK_KEYS|RTIAL|SSWORD)|HASE|O(?:INT|LYGON)|R(?:E(?:CISION|PARE|V)|I(?:MARY|VILEGES)|OCE(?:DURE|SS(?:LIST|)))|URGE)|QU(?:ARTER|ERY|ICK)|R(?:AID(?:0|_(?:CHUNKS(?:IZE|)|TYPE))|E(?:A(?:D(?:S|)|L)|COVER|DUNDANT|FERENCES|GEXP|L(?:AY_(?:LOG_(?:FILE|POS)|THREAD)|EASE|OAD)|NAME|P(?:AIR|EAT(?:ABLE|)|L(?:ACE|ICATION))|QUIRE|S(?:ET|T(?:ORE|RICT)|UME)|TURN(?:S|)|VOKE)|IGHT|LIKE|O(?:LL(?:BACK|UP)|UTINE|W(?:S|_FORMAT|))|TREE)|S(?:AVEPOINT|CHEMA(?:S|)|E(?:C(?:OND(?:_MICROSECOND|)|URITY)|LECT|NSITIVE|PARATOR|RIAL(?:IZABLE|)|SSION|T)|H(?:ARE|OW|UTDOWN)|I(?:GNED|MPLE)|LAVE|MALLINT|NAPSHOT|O(?:ME|NAME|UNDS)|P(?:ATIAL|ECIFIC)|QL(?:EXCEPTION|STATE|WARNING|_(?:B(?:IG_RESULT|UFFER_RESULT)|CA(?:CHE|LC_FOUND_ROWS)|NO_CACHE|SMALL_RESULT|T(?:HREAD|SI_(?:DAY|FRAC_SECOND|HOUR|M(?:INUTE|ONTH)|QUARTER|SECOND|WEEK|YEAR)))|)|SL|T(?:A(?:RT(?:ING|)|TUS)|O(?:P|RAGE)|R(?:AIGHT_JOIN|I(?:NG|PED)))|U(?:BJECT|PER|SPEND))|T(?:ABLE(?:S(?:PACE|)|)|E(?:MP(?:ORARY|TABLE)|RMINATED|XT)|HEN|I(?:ME(?:STAMP(?:ADD|DIFF|)|)|NY(?:BLOB|INT|TEXT))|O|R(?:A(?:ILING|NSACTION)|IGGER(?:S|)|U(?:E|NCATE))|YPE(?:S|))|U(?:N(?:COMMITTED|D(?:EFINED|O)|I(?:CODE|ON|QUE)|KNOWN|LOCK|SIGNED|TIL)|P(?:DATE|GRADE)|S(?:AGE|E(?:R(?:_RESOURCES|)|_FRM|)|ING)|TC_(?:DATE|TIME(?:STAMP|)))|V(?:A(?:LUE(?:S|)|R(?:BINARY|CHAR(?:ACTER|)|IABLES|YING))|IEW)|W(?:ARNINGS|EEK|H(?:E(?:N|RE)|ILE)|ITH|ORK|RITE)|X(?:509|A|OR)|YEAR(?:_MONTH|)|ZEROFILL)\b/ }
+ , func : { exp: /\b(?:A(?:BS|COS|DD(?:DATE|TIME)|ES_(?:DECRYPT|ENCRYPT)|REA|S(?:BINARY|IN|TEXT|WK(?:B|T))|TAN(?:2|))|B(?:ENCHMARK|I(?:N|T_(?:AND|COUNT|LENGTH|OR|XOR)))|C(?:AST|E(?:IL(?:ING|)|NTROID)|HAR(?:ACTER_LENGTH|_LENGTH)|O(?:ALESCE|ERCIBILITY|MPRESS|N(?:CAT(?:_WS|)|NECTION_ID|V(?:ERT_TZ|))|S|T|UNT)|R(?:C32|OSSES)|UR(?:DATE|TIME))|D(?:A(?:TE(?:DIFF|_(?:ADD|FORMAT|SUB))|Y(?:NAME|OF(?:MONTH|WEEK|YEAR)))|E(?:CODE|GREES|S_(?:DECRYPT|ENCRYPT))|I(?:MENSION|SJOINT))|E(?:LT|N(?:C(?:ODE|RYPT)|DPOINT|VELOPE)|QUALS|X(?:P(?:ORT_SET|)|T(?:ERIORRING|RACT)))|F(?:I(?:ELD|ND_IN_SET)|LOOR|O(?:RMAT|UND_ROWS)|ROM_(?:DAYS|UNIXTIME))|G(?:E(?:OM(?:COLLFROM(?:TEXT|WKB)|ETRY(?:COLLECTIONFROM(?:TEXT|WKB)|FROM(?:TEXT|WKB)|N|TYPE)|FROM(?:TEXT|WKB))|T_LOCK)|LENGTH|R(?:EATEST|OUP_(?:CONCAT|UNIQUE_USERS)))|HEX|I(?:FNULL|N(?:ET_(?:ATON|NTOA)|STR|TER(?:IORRINGN|SECTS))|S(?:CLOSED|EMPTY|NULL|SIMPLE|_(?:FREE_LOCK|USED_LOCK)))|L(?:AST_(?:DAY|INSERT_ID)|CASE|E(?:AST|NGTH)|INE(?:FROM(?:TEXT|WKB)|STRINGFROM(?:TEXT|WKB))|N|O(?:AD_FILE|CATE|G(?:10|2|)|WER)|PAD|TRIM)|M(?:A(?:KE(?:DATE|TIME|_SET)|STER_POS_WAIT|X)|BR(?:CONTAINS|DISJOINT|EQUAL|INTERSECTS|OVERLAPS|TOUCHES|WITHIN)|D5|I(?:D|N)|LINEFROM(?:TEXT|WKB)|ONTHNAME|PO(?:INTFROM(?:TEXT|WKB)|LYFROM(?:TEXT|WKB))|ULTI(?:LINESTRINGFROM(?:TEXT|WKB)|PO(?:INTFROM(?:TEXT|WKB)|LYGONFROM(?:TEXT|WKB))))|N(?:AME_CONST|OW|U(?:LLIF|M(?:GEOMETRIES|INTERIORRINGS|POINTS)))|O(?:CT(?:ET_LENGTH|)|RD|VERLAPS)|P(?:ERIOD_(?:ADD|DIFF)|I|O(?:INT(?:FROM(?:TEXT|WKB)|N)|LY(?:FROM(?:TEXT|WKB)|GONFROM(?:TEXT|WKB))|SITION|W(?:ER|)))|QUOTE|R(?:A(?:DIANS|ND)|E(?:LEASE_LOCK|VERSE)|O(?:UND|W_COUNT)|PAD|TRIM)|S(?:E(?:C_TO_TIME|SSION_USER)|HA(?:1|)|I(?:GN|N)|LEEP|OUNDEX|PACE|QRT|RID|T(?:ARTPOINT|D(?:DEV(?:_(?:POP|SAMP)|)|)|R(?:CMP|_TO_DATE))|U(?:B(?:DATE|STR(?:ING(?:_INDEX|)|)|TIME)|M)|YS(?:DATE|TEM_USER))|T(?:AN|IME(?:DIFF|_(?:FORMAT|TO_SEC))|O(?:UCHES|_DAYS)|RIM)|U(?:CASE|N(?:COMPRESS(?:ED_LENGTH|)|HEX|I(?:QUE_USERS|X_TIMESTAMP))|PPER|UID)|V(?:AR(?:IANCE|_(?:POP|SAMP))|ERSION)|W(?:EEK(?:DAY|OFYEAR)|ITHIN)|X|Y(?:EARWEEK|))(?=\()/ }
+ , id : { exp: /[$\w]+/ }
+ }
+};
+
+
+ChiliBook.recipes[ "php.js" ] =
+{
+ steps: {
+ mlcom : { exp: /\/\*[^*]*\*+([^\/][^*]*\*+)*\// }
+ , com : { exp: /(?:\/\/.*)|(?:[^\\]\#.*)/ }
+ , string1 : { exp: /\'[^\'\\]*(?:\\.[^\'\\]*)*\'/ }
+ , string2 : { exp: /\"[^\"\\]*(?:\\.[^\"\\]*)*\"/ }
+ , value : { exp: /\b(?:[Nn][Uu][Ll][Ll]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])\b/ }
+ , number : { exp: /\b[+-]?(\d*\.?\d+|\d+\.?\d*)([eE][+-]?\d+)?\b/ }
+ , const1 : { exp: /\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|VERSION))|__COMPILER_HALT_OFFSET__)\b/ }
+ , const2 : { exp: /\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR))\b/ }
+ , global : { exp: /(?:\$GLOBALS|\$_COOKIE|\$_ENV|\$_FILES|\$_GET|\$_POST|\$_REQUEST|\$_SERVER|\$_SESSION|\$php_errormsg)\b/ }
+ , keyword : { exp: /\b(?:__CLASS__|__FILE__|__FUNCTION__|__LINE__|__METHOD__|abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exception|exit|extends|extends|final|for|foreach|function|global|if|implements|include|include_once|interface|isset|list|new|old_function|or|php_user_filter|print|private|protected|public|require|require_once|return|static|switch|this|throw|try|unset|use|var|while|xor)\b/ }
+ , variable: { exp: /\$(\w+)/
+ , replacement: '<span class="keyword">$</span><span class="variable">$1</span>' }
+ , heredoc : { exp: /(\<\<\<\s*)(\w+)((?:(?!\2).*\n)+)(\2)\b/
+ , replacement: '<span class="keyword">$1</span><span class="string1">$2</span><span class="string2">$3</span><span class="string1">$4</span>' }
+ }
+};
+
+ChiliBook.recipes[ "css.js" ] =
+{
+ steps: {
+ mlcom : { exp: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\// }
+ , string: { exp: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/ }
+ , number: { exp: /(?:\b[+-]?(?:\d*\.?\d+|\d+\.?\d*))(?:%|(?:(?:px|pt|em|)\b))/ }
+ , attrib: { exp: /\b(?:z-index|x-height|word-spacing|widths|width|widows|white-space|volume|voice-family|visibility|vertical-align|units-per-em|unicode-range|unicode-bidi|text-transform|text-shadow|text-indent|text-decoration|text-align|table-layout|stress|stemv|stemh|src|speech-rate|speak-punctuation|speak-numeral|speak-header|speak|slope|size|right|richness|quotes|position|play-during|pitch-range|pitch|pause-before|pause-after|pause|page-break-inside|page-break-before|page-break-after|page|padding-top|padding-right|padding-left|padding-bottom|padding|overflow|outline-width|outline-style|outline-color|outline|orphans|min-width|min-height|max-width|max-height|mathline|marks|marker-offset|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|height|font-weight|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-family|font|float|empty-cells|elevation|display|direction|descent|definition-src|cursor|cue-before|cue-after|cue|counter-reset|counter-increment|content|color|clip|clear|centerline|caption-side|cap-height|bottom|border-width|border-top-width|border-top-style|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-left-width|border-left-style|border-left-color|border-left|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-color|border-bottom|border|bbox|baseline|background-repeat|background-position|background-image|background-color|background-attachment|background|azimuth|ascent)\b/ }
+ , value : { exp: /\b(?:xx-small|xx-large|x-soft|x-small|x-slow|x-low|x-loud|x-large|x-high|x-fast|wider|wait|w-resize|visible|url|uppercase|upper-roman|upper-latin|upper-alpha|underline|ultra-expanded|ultra-condensed|tv|tty|transparent|top|thin|thick|text-top|text-bottom|table-row-group|table-row|table-header-group|table-footer-group|table-column-group|table-column|table-cell|table-caption|sw-resize|super|sub|status-bar|static|square|spell-out|speech|solid|soft|smaller|small-caption|small-caps|small|slower|slow|silent|show|separate|semi-expanded|semi-condensed|se-resize|scroll|screen|s-resize|run-in|rtl|rightwards|right-side|right|ridge|rgb|repeat-y|repeat-x|repeat|relative|projection|print|pre|portrait|pointer|overline|outside|outset|open-quote|once|oblique|nw-resize|nowrap|normal|none|no-repeat|no-open-quote|no-close-quote|ne-resize|narrower|n-resize|move|mix|middle|message-box|medium|marker|ltr|lowercase|lower-roman|lower-latin|lower-greek|lower-alpha|lower|low|loud|local|list-item|line-through|lighter|level|leftwards|left-side|left|larger|large|landscape|justify|italic|invert|inside|inset|inline-table|inline|icon|higher|high|hide|hidden|help|hebrew|handheld|groove|format|fixed|faster|fast|far-right|far-left|fantasy|extra-expanded|extra-condensed|expanded|embossed|embed|e-resize|double|dotted|disc|digits|default|decimal-leading-zero|decimal|dashed|cursive|crosshair|cross|crop|counters|counter|continuous|condensed|compact|collapse|code|close-quote|circle|center-right|center-left|center|caption|capitalize|braille|bottom|both|bolder|bold|block|blink|bidi-override|below|behind|baseline|avoid|auto|aural|attr|armenian|always|all|absolute|above)\b/ }
+ , color : { exp: /(?:\#[a-zA-Z0-9]{3,6})|(?:yellow|white|teal|silver|red|purple|olive|navy|maroon|lime|green|gray|fuchsia|blue|black|aqua)/ }
+ }
+};
+
+
+
+
+
+ChiliBook.elementPath = '.colored';
+ChiliBook.elementClass = 'colored'; \ No newline at end of file
diff --git a/demos/functional/js/functional.demo.js b/demos/functional/js/functional.demo.js
new file mode 100644
index 000000000..330ffce9e
--- /dev/null
+++ b/demos/functional/js/functional.demo.js
@@ -0,0 +1,175 @@
+var uid = 0;
+
+/**
+ * Render a demo template page
+ * @author Eduardo Lundgren (braeker)
+ * @param {Object} model
+ */
+var uiRenderDemo = function(model) {
+
+ var title = model.title, renderAt = $(model.renderAt);
+
+ function nl2br( str ) {
+ return str.replace(/([^>])\n/g, '$1<br />\n');
+ }
+
+ var js2html = function(code) {
+ var src = (js_beautify(code) || "");
+
+ //if ($.browser.msie)
+ // src = src.replace(/([^>])\n/g, '$1<br />\n');
+
+ return src;
+ };
+
+ renderAt.append(
+ '<h3>'+ title +'</h3>'
+ );
+
+ $.each(model.demos, function(i, demo) {
+
+ /**
+ * Rendering each demo
+ */
+
+ if (!demo) return;
+
+ var uiHtmlRendered = $('<div class="ui-html-rendered"></div>');
+
+ if (model.onRenderStart) model.onRenderStart.apply(window);
+
+ var gid = 'ui-gen-'+uid++, demoBox = $('<div id="'+gid+'"></div>');
+
+ renderAt.append(demoBox);
+
+ var detailsHtml = $(
+ '<br><div class="ui-details"><div class="menutitle">'+demo.title+'</div></div>'
+ );
+
+ var descBox = $(
+ '<div class="ui-demo-description">'+(demo.desc||'')+'</div>'
+ );
+
+ var optionsBox = $(
+ '<div class="ui-demo-options"><label for="select-'+gid+'">Try more options on the fly: </label></div>'
+ );
+
+ var codesBox = $(
+ '<div id="code-'+gid+'"></div>'
+ )
+ .css({display: 'none'});
+
+ var sourceTmpl = $(
+ '<div></div>'
+ );
+
+ var preTmpl = $(
+ '<span style="white-space: pre;"></span>'
+ );
+
+ var codeTmpl = $(
+ '<code></code>'
+ );
+
+ var htmlCode = '', sourceHtml = sourceTmpl.clone(), sourceJs = sourceTmpl.clone(), entitiesHtml = function(html) {
+ return html.replace(/</g,"&lt;").replace(/>/g,"&gt;");
+ };
+
+ // Render simple HTML
+ if (typeof demo.html == 'string') {
+ uiHtmlRendered.html(demo.html);
+ htmlCode = demo.html;
+ }
+ // Render data html by URL
+ if (typeof demo.html == 'object' && demo.html.url) {
+
+ uiHtmlRendered.html("<img src='/images/ajax-loader.gif'>");
+
+ $.ajax({
+ type: "GET",
+ url: demo.html.url,
+ cache: false,
+ success: function(data) {
+ uiHtmlRendered.html(data);
+ htmlCode = data;
+
+ // set html code view
+ sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
+
+ $.each(demo.options, function(x, o) {
+ // eval the first source of <select>
+ if (!x) jQuery.globalEval(o.source);
+ });
+
+ $('#'+gid).find('.colored.html').chili();
+
+ // fire renderEnd callback to ajax async transactions
+ if (model.onRenderEnd) model.onRenderEnd.apply(window);
+ }
+ });
+
+ }
+ // set html code view
+ sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
+
+ var select = $('<select id="select-'+ gid+'"></select>').change(function() {
+ var ecode = decodeURIComponent($(this).val());
+
+ jQuery.globalEval(demo.destroy);
+ jQuery.globalEval(ecode);
+
+ sourceJs.html(preTmpl.html( codeTmpl.clone().addClass('colored javascript').html(js2html(ecode, 4)) ));
+ $('.colored.javascript').chili();
+ });
+
+ var a = $('<a>View Source</a>').attr('href', 'javascript:void(0);').addClass('link-view-source').toggle(function() {
+ var self = this;
+ $(codesBox).show("fast");
+ $(this).text("Hide Source");
+ },
+ function() {
+ $(codesBox).hide();
+ $(this).text("Show Source");
+ });
+
+ demoBox.append(
+ detailsHtml, descBox, uiHtmlRendered, optionsBox.append(
+ select, a, '<br>', codesBox.append('<br>JavaScript:<br>', sourceJs, '<br>HTML:<br>', sourceHtml)
+ )
+ );
+
+ // population select with the demo options
+ $.each(demo.options, function(x, o) {
+ if (o && o.desc) {
+ var source = encodeURIComponent(o.source);
+ select.append($('<option>' + o.desc + '</option>').val(source));
+ // eval the first source of <select>
+ if (!x) {
+ sourceJs.html(preTmpl.html(codeTmpl.clone().addClass('colored javascript').html(js2html(o.source, 4))));
+ jQuery.globalEval(o.source);
+ }
+ }
+ });
+
+ $('#'+gid).find('.colored.javascript').chili();
+ $('#'+gid).find('.colored.html').chili();
+
+ // fire renderEnd callback to direct-html-render
+ if (typeof demo.html != 'object' && model.onRenderEnd) model.onRenderEnd.apply(window);
+
+ });
+};
+
+var loadDemo = function(comp) {
+
+ $('#containerDemo').html("<img src='images/ajax-loader.gif'>");
+
+ $("#containerDemo").ajaxError(function(request, settings){
+ $(this).html("Ops, there is no template file for this component.");
+ });
+
+ $.get('templates/'+comp+'.html', function(data) {
+ $('#containerDemo').html(data);
+ });
+
+}; \ No newline at end of file
diff --git a/demos/functional/js/jquery.chili.pack.js b/demos/functional/js/jquery.chili.pack.js
new file mode 100644
index 000000000..2e18c066e
--- /dev/null
+++ b/demos/functional/js/jquery.chili.pack.js
@@ -0,0 +1,12 @@
+/*
+===============================================================================
+Chili is the jQuery code highlighter plugin
+...............................................................................
+LICENSE: http://www.opensource.org/licenses/mit-license.php
+WEBSITE: http://noteslog.com/chili/
+
+ Copyright 2007 / Andrea Ercolino
+===============================================================================
+*/
+
+(function($){ChiliBook={version:"1.9",automatic:true,automaticSelector:"code",codeLanguage:function(a){var b=$(a).attr("class");return b?b:''},metadataSelector:"object.chili",recipeLoading:true,recipeFolder:"",stylesheetLoading:true,stylesheetFolder:"",defaultReplacement:'<span class="$0">$$</span>',replaceSpace:"&#160;",replaceTab:"&#160;&#160;&#160;&#160;",replaceNewLine:"&#160;<br/>",recipes:{},queue:{},preFixCopy:document.selection&&document.selection.createRange,preContent:"",preElement:null};$.metaobjects=function(c){c=$.extend({context:document,clean:true,selector:'object.metaobject'},c);function jsValue(a){eval('value = '+a+";");return a}return $(c.selector,c.context).each(function(){var b={target:this.parentNode};$('> param[@name=metaparam]',this).each(function(){$.extend(b,jsValue(this.value))});$('> param',this).not('[@name=metaparam]').each(function(){var a=this.name,value=jsValue(this.value);$(b.target).each(function(){this[a]=value})});if(c.clean){$(this).remove()}})};$.fn.chili=function(r){var s=$.extend({},ChiliBook,r||{});function cook(k,l){function prepareStep(a,b){var c=(typeof b.exp=="string")?b.exp:b.exp.source;o.push({stepName:a,exp:"("+c+")",length:1+(c.replace(/\\./g,"%").replace(/\[.*?\]/g,"%").match(/\((?!\?)/g)||[]).length,replacement:(b.replacement)?b.replacement:s.defaultReplacement})}function knowHow(){var b=1;var c=[];for(var i=0;i<o.length;i++){var d=o[i].exp;d=d.replace(/\\\\|\\(\d+)/g,function(m,a){return!a?m:"\\"+(b+1+parseInt(a,10))});c.push(d);b+=o[i].length}var e='((?:\\s|\\S)*?)';var f='((?:\\s|\\S)+)';var g='(?:'+c.join("|")+')';g=e+g+'|'+f;return new RegExp(g,(l.ignoreCase)?"gi":"g")}function escapeHTML(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function replaceSpaces(b){return b.replace(/ +/g,function(a){return a.replace(/ /g,n)})}function filter(a){a=escapeHTML(a);if(n){a=replaceSpaces(a)}return a}function chef(){var i=0;var j=2;var c=arguments[1];var d=arguments[arguments.length-3];if(!d){var e;while(e=o[i++]){var f=arguments;if(f[j]){var g=/(\\\$)|(?:\$\$)|(?:\$(\d+))/g;var h=e.replacement.replace(g,function(m,a,K){var b='';if(a){return"$"}else if(!K){return filter(f[j])}else if(K=="0"){return e.stepName}else{return filter(f[j+parseInt(K,10)])}});return filter(c)+h}else{j+=e.length}}}else{return filter(d)}}var n=s.replaceSpace;var o=[];for(var p in l.steps){prepareStep(p,l.steps[p])}var q=k.replace(knowHow(),chef);return q}function checkCSS(a){if(!s.queue[a]){var e=document.createElement("link");e.rel="stylesheet";e.type="text/css";e.href=a;document.getElementsByTagName("head")[0].appendChild(e);s.queue[a]=true}}function makeDish(a,b){var c=s.recipes[b];if(!c){return}$el=$(a);var d=$el.text();if(!d){return}d=d.replace(/\r\n?/g,"\n");var e=cook(d,c);if(s.replaceTab){e=e.replace(/\t/g,s.replaceTab)}if(s.replaceNewLine){e=e.replace(/\n/g,s.replaceNewLine)}a.innerHTML=e;if(ChiliBook.preFixCopy){$el.parents().filter("pre").bind("mousedown",function(){ChiliBook.preElement=this}).bind("mouseup",function(){if(ChiliBook.preElement==this){ChiliBook.preContent=document.selection.createRange().htmlText}})}}function getPath(a,b){var c={recipeFolder:s.recipeFolder,recipeFile:a+".js",stylesheetFolder:s.stylesheetFolder,stylesheetFile:a+".css"};var d;if(b&&typeof b=="object"){d=$.extend(c,b)}else{d=c}return{recipe:d.recipeFolder+d.recipeFile,stylesheet:d.stylesheetFolder+d.stylesheetFile}}if(s.metadataSelector){$.metaobjects({context:this,selector:s.metadataSelector})}this.each(function(){var b=this;var c=s.codeLanguage(b);if(''!=c){var d=getPath(c,b.chili);if(s.recipeLoading||b.chili){if(!s.queue[d.recipe]){try{s.queue[d.recipe]=[b];$.getJSON(d.recipe,function(a){a.path=d.recipe;s.recipes[d.recipe]=a;if(s.stylesheetLoading){checkCSS(d.stylesheet)}var q=s.queue[d.recipe];for(var i=0,iTop=q.length;i<iTop;i++){makeDish(q[i],d.recipe)}})}catch(recipeNotAvailable){alert("the recipe for '"+c+"' was not found in '"+d.recipe+"'")}}else{s.queue[d.recipe].push(b)}makeDish(b,d.recipe)}else{makeDish(b,d.recipe)}}});return this};$(function(){if(ChiliBook.automatic){if(ChiliBook.elementPath){ChiliBook.automaticSelector=ChiliBook.elementPath;if(ChiliBook.elementClass){ChiliBook.codeLanguage=function(a){var b=new RegExp("\\b"+ChiliBook.elementClass+"\\b","gi");var c=$(a).attr("class");if(!c){return''}var d=$.trim(c.replace(b,""));return d}}}$(ChiliBook.automaticSelector).chili()}if(ChiliBook.preFixCopy){function preformatted(a){if(''==a){return""}do{var b=(new Date()).valueOf()}while(a.indexOf(b)>-1);a=a.replace(/\<br[^>]*?\>/ig,b);var c=document.createElement('<pre>');c.innerHTML=a;a=c.innerText.replace(new RegExp(b,"g"),'\r\n');return a}$("body").bind("copy",function(){if(''!=ChiliBook.preContent){window.clipboardData.setData('Text',preformatted(ChiliBook.preContent));event.returnValue=false}}).bind("mousedown",function(){ChiliBook.preContent=""}).bind("mouseup",function(){ChiliBook.preElement=null})}})})(jQuery); \ No newline at end of file