diff --git a/css/console.css b/css/console.css deleted file mode 100644 index f139358b..00000000 --- a/css/console.css +++ /dev/null @@ -1,55 +0,0 @@ -.error-msg { - color: crimson; -} - -.log-msg{ - color: #444; -} - -.error-msg, .log-msg { - display : block; - padding : 10px; - margin : 10px; - font : 16px "Droid Sans Mono"; - background : beige; - -webkit-border-radius : 5px; - -moz-border-radius : 5px; - border-radius : 5px; -} - -.jqconsole { - padding : 10px; - padding-bottom : 10px; - background : #fffdf9; -} - -.jqconsole-cursor { - background-color: #999; -} -.jqconsole-blurred .jqconsole-cursor { - background-color: #666; -} -.jqconsole-prompt { - color: #4a473a -} -.jqconsole-old-prompt { - font-weight : normal; - color : #b7b4a8; -} - -.jqconsole-prompt, .jqconsole-old-prompt { - margin: 10px; -} - -.brace { - color: #00FFFF; -} -.paran { - color: #FF00FF; -} -.bracket { - color: #FFFF00; -} -.jqconsole-composition { - background-color: red; -} diff --git a/json/modules.json b/json/modules.json index e15e44e4..4eebfee7 100644 --- a/json/modules.json +++ b/json/modules.json @@ -8,7 +8,7 @@ "contact", "socket", "terminal", - "console", [{ + "konsole", [{ "name": "remote", "data": [{ "name": "jquery", diff --git a/lib/client/console.js b/lib/client/console.js deleted file mode 100644 index 9ff97c20..00000000 --- a/lib/client/console.js +++ /dev/null @@ -1,220 +0,0 @@ -var CloudCmd, Util, join, DOM, CloudFunc, $; - -(function(CloudCmd, Util, join, DOM, CloudFunc) { - 'use strict'; - - CloudCmd.Console = ConsoleProto; - - function ConsoleProto() { - var Name = 'Console', - Buffer = { - log : '', - error : '' - }, - Loading, - jqconsole, - - log = Util.exec.with(write, 'log'), - error = Util.exec.with(write, 'error'), - - Element, - MouseBinded, - Socket, - Images = DOM.Images, - Notify = DOM.Notify, - - CHANNEL = CloudFunc.CHANNEL_CONSOLE, - - Console = this; - - function init() { - Loading = true; - - Util.exec.series([ - DOM.loadJquery, - CloudCmd.View, - load, - CloudCmd.Socket, - function(callback) { - Socket = CloudCmd.Socket; - Util.exec(callback); - }, - Console.show, - addListeners, - ]); - } - - this.show = show; - this.clear = clear; - - // Handle a command. - function handler(command) { - if (command) - Socket.emit(CHANNEL, command); - else - jqconsole.Prompt(true, handler); - } - - function show(callback) { - if (!Loading) { - Images.showLoad({top:true}); - - if (!Element) { - Element = DOM.load({ - name : 'div', - className : 'console' - }); - - jqconsole = $(Element).jqconsole('', '> '); - - addShortCuts(jqconsole); - } - - CloudCmd.View.show(Element, { - afterShow: function() { - var console = jqconsole.$console, - input = jqconsole.$input_source, - - focus = function() { - var x = window.scrollX, - y = window.scrollY; - - input.focus(); - window.scrollTo(x,y); - }; - - focus(); - - if (!MouseBinded) { - MouseBinded = true; - - console.mouseup(function() { - var top, - isSelection = '' + window.getSelection(); - - if (!isSelection) { - top = console.scrollTop(); - - focus(); - console.scrollTop(top); - } - }); - } - - Util.exec(callback); - } - }); - } - } - - function write(status, msg) { - var isContain; - - if (msg) { - Buffer[status] += msg; - isContain = Util.isContainStr(Buffer[status], '\n'); - - if (jqconsole && isContain) { - jqconsole.Write(Buffer[status], status + '-msg'); - Notify.send(Buffer[status]); - Buffer[status] = ''; - } - } - } - - function addShortCuts(jqconsole) { - jqconsole.RegisterShortcut('Z', function() { - jqconsole.SetPromptText(''); - }); - - jqconsole.RegisterShortcut('L', clear); - - jqconsole.RegisterShortcut('P', function() { - var command = jqconsole.GetPromptText(); - - command += DOM.getCurrentDirPath(); - jqconsole.SetPromptText(command); - }); - } - - function clear() { - jqconsole.Reset(); - addShortCuts(jqconsole); - jqconsole.Prompt(true, handler); - } - - function load(callback) { - var dir = CloudCmd.LIBDIRCLIENT + 'console/', - jsPath = dir + 'lib/', - - css = join([ - '/css/console.css', - dir + 'css/ansi.css', - ]), - - files = [ - jsPath + 'jqconsole.js', - css - ]; - - DOM.load.parallel(files, function() { - Util.timeEnd(Name + ' load'); - Loading = false; - - Util.exec(callback); - }); - - Util.time(Name + ' load'); - } - - function isPrompt() { - var state = jqconsole.GetState(), - is = state === 'prompt'; - - return is; - } - - function addListeners(callback) { - var options = { - 'connect' : function() { - log(Socket.CONNECTED); - }, - - 'disconnect': function() { - var is = isPrompt(); - - error(Socket.DISCONNECTED); - - if (is) - jqconsole.AbortPrompt(); - } - }; - - options[CHANNEL] = onMessage; - - Socket.on(options); - - Util.exec(callback); - } - - function onMessage(json) { - var is = isPrompt(); - - if (json) { - Util.log(json); - - log(json.stdout); - error(json.stderr); - - if (json.path) - jqconsole.SetPromptLabel(json.path + '> '); - } - - if (!is) - jqconsole.Prompt(true, handler); - } - - init(); - } - -})(CloudCmd, Util, join, DOM, CloudFunc); diff --git a/lib/client/console/Cakefile b/lib/client/console/Cakefile deleted file mode 100644 index 8c3a3300..00000000 --- a/lib/client/console/Cakefile +++ /dev/null @@ -1,16 +0,0 @@ -{spawn, exec} = require 'child_process' - -task 'watch', 'Build and watch the CoffeeScript source files', -> - coffee = spawn 'coffee', ['-cw', '-o', 'lib', 'src'] - test = spawn 'coffee', ['-cw', 'test'] - log = (d)-> console.log d.toString() - coffee.stdout.on 'data', log - test.stdout.on 'data', log - -task 'build', 'Build minified file with uglify', -> - console.log 'building...' - exec 'uglifyjs -m -o jqconsole.min.js lib/jqconsole.js', (err, res)-> - if err - console.error 'failed with', err - else - console.log 'build complete' diff --git a/lib/client/console/ChangeLog b/lib/client/console/ChangeLog deleted file mode 100644 index bf4f4ec2..00000000 --- a/lib/client/console/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -2011.08.28, Version 2.4.2 - -* Fix for issue #13 . -* Add optional parameter "escape" to the Write method, see README for more -info. - -20011.10.9, Version 2.5 - -* Added mobile support. -* Follow the cursor's position when the window is scrolled away. -* Add async_multiline option in prompt, see README for more info. -* Add Dump method that would dump the console's text content. -* Add GetState method that gets the current state of the console. -* Publicize MoveToStart and MoveToEnd methods. - -2011.11.1, Version 2.5.1 - -* Added Disable/Enable functionality and methods. -* Added IsDisabled method. - -2011.11.3, Version 2.5.2 - -* Added multibyte character input support, issue #19. - -2011.11.4, Version 2.6 - -* Fix safari paste. Issue #15. -* Created constants and minifier friendliness. Issue #14. - -2011.11.19, Version 2.6.1 - -* Fix issues #20, #21 -* Implement feature #22 -* Add built-in css for ease of use. - -2011.12.6, Version 2.6.2 -* Fix issue #23. - -2011.12.16 Version 2.6.3 -* Fix issue #24. - -2011.12.28 Version 2.7 -* Implement ANSI graphics, Issue #12 -* Fix issue #25 - -2012.3.7 Version 2.7.1 -* Fix issue #26 -* Complete issue #12 by adding stacking graphics support. - -2012.10.28 Version 2.7.2 -* Add set / get History methods. -* Add Append method. - -2012.11.10 Version 2.7.3 -* Allow empty string in prompt. - -2012.12.13 Version 2.7.4 -* Fix issue #36 -* Fix issue #35 - -2013.1.21 Version 2.7.5 -* Add SetPromptLabel method. - -2013.1.22 Version 2.7.6 -* Continue label argument in SetPromptLabel method. - -2013.1.26 Version 2.7.7 -* Support for middle click paste on linux. #47. - -2013.8.5 Version 2.7.8 -* Fix issue #51. - -2014.2.3 Version 2.8.0 -* Remove browser sniffing. Fix #37 #42 #53 -* Update android support. Fix #41 -* Add wrapper div for padding/styling of console. Fix #40 - -2014.2.8 Version 2.9.0 -* Fixed `GetColumn` method to return the column number up until the cursor. -* `Dump`: Add header contents in console dump and remove extra spaces. - -2014.2.8 Version 2.10.0 -* Add `Clear` method to clear the console - diff --git a/lib/client/console/README.md b/lib/client/console/README.md deleted file mode 100644 index 9ad7b073..00000000 --- a/lib/client/console/README.md +++ /dev/null @@ -1,730 +0,0 @@ -#jq-console - -A jQuery terminal plugin written in CoffeeScript. - -This project was spawned because of our need for a simple web terminal plugin -for the repl.it project. It tries to simulate a low level terminal by providing (almost) -raw input/output streams as well as input and output states. - -Version 2.0 adds baked-in support for rich multi-line prompting and operation -queueing. - - -##Tested Browsers - -The plugin has been tested on the following browsers: - -* IE 9+ -* Chrome -* Firefox -* Opera -* iOS Safari and Chrome -* Android Chrome - - -##Getting Started - -###Echo example - -```css - /* The console container element */ - #console { - position: absolute; - width: 400px; - height: 500px; - background-color:black; - } - /* The inner console element. */ - .jqconsole { - padding: 10px; - } - /* The cursor. */ - .jqconsole-cursor { - background-color: gray; - } - /* The cursor color when the console looses focus. */ - .jqconsole-blurred .jqconsole-cursor { - background-color: #666; - } - /* The current prompt text color */ - .jqconsole-prompt { - color: #0d0; - } - /* The command history */ - .jqconsole-old-prompt { - color: #0b0; - font-weight: normal; - } - /* The text color when in input mode. */ - .jqconsole-input { - color: #dd0; - } - /* Previously entered input. */ - .jqconsole-old-input { - color: #bb0; - font-weight: normal; - } - /* The text color of the output. */ - .jqconsole-output { - color: white; - } -``` - -```html -
- - - -``` - - -###Instantiating - -```javascript - $(div).jqconsole(welcomeString, promptLabel, continueLabel); -``` - -* `div` is the div element or selector. Note that this element must be - explicity sized and positioned `absolute` or `relative`. -* `welcomeString` is the string to be shown when the terminal is first rendered. -* `promptLabel` is the label to be shown before the input when using Prompt(). -* `continueLabel` is the label to be shown before the continued lines of the - input when using Prompt(). - -##Configuration - -There isn't much initial configuration needed, because the user must supply -options and callbacks with each state change. There are a few config methods -provided to create custom shortcuts and change indentation width: - -###jqconsole.RegisterShortcut -Registers a callback for a keyboard shortcut. -Takes two arguments: - - * __(int|string)__ *keyCode*: The code of the key pressing which (when Ctrl is - held) will trigger this shortcut. If a string is provided, the ASCII code - of the first character is taken. - - * __function__ *callback*: A function called when the shortcut is pressed; - "this" will point to the JQConsole object. - - - Example: - - // Ctrl+R: resets the console. - jqconsole.RegisterShortcut('R', function() { - this.Reset(); - }); - -###jqconsole.SetIndentWidth -Sets the number of spaces inserted when indenting and removed when unindenting. -Takes one argument: - - * __int__ *width*: The number of spaces in each indentation level. - - - Example: - - // Sets the indent width to 4 spaces. - jqconsole.SetIndentWidth(4); - -###jqconsole.RegisterMatching -Registers an opening and closing characters to match and wraps each of the -opening and closing characters with a span with the specified class. -Takes one parameters: - - * __char__ *open*: The opening character of a "block". - * __char__ *close*: The closing character of a "block". - * __string__ *class*: The css class that is applied to the matched characters. - - - Example: - - jqconsole.RegisterMatching('{', '}', 'brackets'); - -##Usage - -Unlike most terminal plugins, jq-console gives you complete low-level control -over the execution; you have to call the appropriate methods to start input -or output: - -###jqconsole.Input: -Asks user for input. If another input or prompt operation is currently underway, -the new input operation is enqueued and will be called when the current -operation and all previously enqueued operations finish. Takes one argument: - - * __function__ *input_callback*: A function called with the user's input when - the user presses Enter and the input operation is complete. - - - Example: - - // Echo the input. - jqconsole.Input(function(input) { - jqconsole.Write(input); - }); - - -###jqconsole.Prompt -Asks user for input. If another input or prompt operation is currently underway -the new prompt operation is enqueued and will be called when the current -peration and all previously enqueued operations finish. Takes three arguments: - - * __bool__ *history_enabled*: Whether this input should use history. If true, - the user can select the input from history, and their input will also be - added as a new history item. - - * __function__ *result_callback*: A function called with the user's input when - the user presses Enter and the prompt operation is complete. - - * __function__ *multiline_callback*: If specified, this function is called when - the user presses Enter to check whether the input should continue to the - next line. The function must return one of the following values: - - * `false`: the input operation is completed. - - * `0`: the input continues to the next line with the current indent. - - * `N` (int): the input continues to the next line, and the current - indent is adjusted by `N`, e.g. `-2` to unindent two levels. - - - * __bool__ *async_multiline*: Whether the multiline callback function should - be treated as an asynchronous operation and be passed a continuation - function that should be called with one of the return values mentioned - above: `false`/`0`/`N`. - - - Example: - - jqconsole.Prompt(true, function(input) { - // Alert the user with the command. - alert(input); - }, function (input) { - // Continue if the last character is a backslash. - return /\\$/.test(input); - }); - -###jqconsole.AbortPrompt -Aborts the current prompt operation and returns to output mode or the next -queued input/prompt operation. Takes no arguments. - - Example: - - jqconsole.Prompt(true, function(input) { - alert(input); - }); - // Give the user 2 seconds to enter the command. - setTimeout(function() { - jqconsole.AbortPrompt(); - }, 2000); - -###jqconsole.Write -Writes the given text to the console in a ``, with an -optional class. If a prompt is currently being shown, the text is inserted -before it. Takes two arguments: - - * __string__ *text*: The text to write. - - * __string__ *cls*: The class to give the span containing the text. Optional. - - * __bool__ *escape*: Whether the text to write should be html escaped. - Optional, defaults to true. - - - Examples: - - jqconsole.Write(output, 'my-output-class') - jqconsole.Write(err.message, 'my-error-class') - -###jqconsole.Append -Append the given node to the DOM. If a prompt is currently being shown, the -text is inserted before it. Takes a single argument: - - * __(string|Element)__ *node*: The DOM Element or html string to append to - the console just before the prompt. - - Example: - - // Add a div with the text 'hello' on a red background using jquery - jqconsole.Append($('
hello
').css('background-color', 'red')); - - // We can also use document.createElement - node = document.createElement("div"); - content = document.createTextNode("hello"); - node.appendChild(content); - jqconsole.Append(node); - - -###jqconsole.SetPromptText -Sets the text currently in the input prompt. Takes one parameter: - - * __string__ *text*: The text to put in the prompt. - - Examples: - - jqconsole.SetPromptText('ls') - jqconsole.SetPromptText('print [i ** 2 for i in range(10)]') - - -###jqconsole.SetPromptLabel -Replaces the main prompt label. Takes two parameters: - - * __string__ *main_label*: String to replace the main prompt label. - * __string__ *continuation_label*: String to replace the continuation prompt label. Optional. - - Examples: - - jqconsole.SetPromptLabel('$') - jqconsole.SetPromptLabel(' $','..') - - -###jqconsole.ClearPromptText -Clears all the text currently in the input prompt. Takes one parameter: - - * __bool__ *clear_label*: If specified and true, also clears the main prompt - label (e.g. ">>>"). - - - Example: - - jqconsole.ClearPromptText() - - -###jqconsole.GetPromptText -Returns the contents of the prompt. Takes one parameter: - - * __bool__ *full*: If specified and true, also includes the prompt labels - (e.g. ">>>"). - - - Examples: - - var currentCommand = jqconsole.GetPromptText() - var logEntry = jqconsole.GetPromptText(true) - - -###jqconsole.Reset -Resets the console to its initial state, cancelling all current and pending -operations. Takes no parameters. - - Example: - - jqconsole.Reset() - - -###jqconsole.GetColumn -Returns the 0-based number of the column on which the cursor currently is. -Takes no parameters. - - Example: - - // Show the current line and column in a status area. - $('#status').text(jqconsole.GetLine() + ', ' + jqconsole.GetColumn()) - - -###jqconsole.GetLine -Returns the 0-based number of the line on which the cursor currently is. -Takes no parameters. - - Example: - - // Show the current line and column in a status area. - $('#status').text(jqconsole.GetLine() + ', ' + jqconsole.GetColumn()) - -###jqconsole.Focus -Forces the focus onto the console so events can be captured. -Takes no parameters. - - Example: - - // Redirect focus to the console whenever the user clicks anywhere. - $(window).click(function() { - jqconsole.Focus(); - }) - - -###jqconsole.GetIndentWidth -Returns the number of spaces inserted when indenting. Takes no parameters. - - Example: - - jqconsole.SetIndentWidth(4); - console.assert(jqconsole.GetIndentWidth() == 4); - - -###jqconsole.UnRegisterMatching -Deletes a certain matching settings set by `jqconsole.RegisterMatching`. -Takes two paramaters: - - * __char__ *open*: The opening character of a "block". - * __char__ *close*: The closing character of a "block". - - - Example: - - jqconsole.UnRegisterMatching('{', '}'); - - -###jqconsole.Dump -Returns the text content of the console. - -###jqconsole.GetState -Returns the current state of the console. Could be one of the following: - - * Input: `"input"` - * Output: `"output"` - * Prompt: `"prompt"` - - - Example: - - jqconsole.GetState(); //output - - -###jqconsole.MoveToStart -Moves the cursor to the start of the current line. -Takes one parameter: - - * __bool__ *all_lines*: If true moves the cursor to the beginning of the first - line in the current prompt. Defaults to false. - - - Example: - - // Move to line start Ctrl+A. - jqconsole.RegisterShortcut('A', function() { - jqconsole.MoveToStart(); - handler(); - }); - - -###jqconsole.MoveToEnd -Moves the cursor to the end of the current line. -Takes one parameter: - - * __bool__ *all_lines*: If true moves the cursor to the end of the first - line in the current prompt. Defaults to false. - - Example: - - // Move to line end Ctrl+E. - jqconsole.RegisterShortcut('E', function() { - jqconsole.MoveToEnd(); - handler(); - }); - -###jqconsole.Disable -Disables input and focus on the console. - - -###jqconsole.Enable -Enables input and focus on the console. - - -###jqconsole.IsDisabled -Returns true if the console is disabled. - - -###jqconsole.GetHistory -Returns the contents of the history buffer. - - -###jqconsole.SetHistory -Set the history buffer to the given array. - -Takes one parameter: - - * __array__ *history*: The history buffer to use. - - Example: - - jqconsole.SetHistory(['a = 3', 'a + 3']); - - -###jqconsole.ResetHistory -Resets the console history. - - -###jqconsole.ResetMatchings -Resets the character matching configuration. - - -###jqconsole.ResetShortcuts -Resets the shortcut configuration. - - -###jqconsole.Clear -Clears the console's content excluding the current prompt - -##Default Key Config - -The console responds to the followind keys and key combinations by default: - -* `Delete`: Delete the following character. -* `Ctrl+Delete`: Delete the following word. -* `Backspace`: Delete the preceding character. -* `Ctrl+Backspace`: Delete the preceding word. -* `Ctrl+Left`: Move one word to the left. -* `Ctrl+Right`: Move one word to the right. -* `Home`: Move to the beginning of the current line. -* `Ctrl+Home`: Move to the beginnig of the first line. -* `End`: Move to the end of the current line. -* `Ctrl+End`: Move to the end of the last line. -* `Shift+Up`, `Ctrl+Up`: Move cursor to the line above the current one. -* `Shift+Down`, `Ctrl+Down`: Move cursor to the line below the current one. -* `Tab`: Indent. -* `Shift+Tab`: Unindent. -* `Up`: Previous history item. -* `Down`: Next history item. -* `Enter`: Finish input/prompt operation. See Input() and Prompt() for details. -* `Shift+Enter`: New line. -* `Page Up`: Scroll console one page up. -* `Page Down`: Scroll console one page down. - -##ANSI escape code SGR support - -jq-console implements a large subset of the ANSI escape code graphics. -Using the `.Write` method you could add style to the console using -the following syntax: - -`ASCII 27 (decimal) or 0x1b (hex)` `[` `SGR code` `m` - -Example: - - jqconsole.Write('\033[31mRed Text'); - -Note that the third parameter `escape` must be true which defaults to it. - -You'll need to include the `ansi.css` file for default effects or create your -own using the css classes from the table below. - -###SGR -[Reference](http://en.wikipedia.org/wiki/ANSI_escape_code#graphics). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeEffectClass
0Reset / Normal
1Bold`jqconsole-ansi-bold`
2Faint`jqconsole-ansi-lighter`
3Italic`jqconsole-ansi-italic`
4Line below text`jqconsole-ansi-underline`
5Blink: 1s delay`jqconsole-ansi-blink`
6Blink: 0.5s delay`jqconsole-ansi-blink-rapid`
8Hide text`jqconsole-ansi-hidden`
9Line through text`jqconsole-ansi-line-through`
10Remove all fonts
11-19Add custom font`jqconsole-ansi-fonts-{N}` where N is code - 10
20Add Fraktur font (not implemented in ansi.css)`jqconsole-ansi-fraktur`
21Remove Bold and Faint effects
22Same as 21
23Remove italic and fraktur effects
24Remove underline effect
25Remove blinking effect(s).
28Reveal text
29Remove line-through effect
30-37Set foreground color to color from the color table belowjqconsole-ansi-color-{COLOR} where {COLOR} is the color name
39Restore default foreground color
40-47Set background color to color from the color table below`jqconsole-ansi-background-color-{COLOR}` where {COLOR} is the color name
49Restore default background color
51Adds a frame around the text`jqconsole-ansi-framed`
53Line above textjqconsole-ansi-overline
54Remove frame effect
55Remove over-line effect
- -###Colors -[Reference](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Code offsetColor
0Black
1Red
2Green
3Yellow
4Blue
5Magenta
6Cyan
7White
- -##CSS Classes - -Several CSS classes are provided to help stylize the console: - -* `jqconsole`: The main console container. -* `jqconsole, jqconsole-blurred`: The main console container, when not in focus. -* `jqconsole-cursor`: The cursor. -* `jqconsole-header`: The welcome message at the top of the console. -* `jqconsole-input`: The prompt area during input. May have multiple lines. -* `jqconsole-old-input`: Previously-entered inputs. -* `jqconsole-prompt`: The prompt area during prompting. May have multiple lines. -* `jqconsole-old-prompt`: Previously-entered prompts. -* `jqconsole-composition`: The div encapsulating the composition of multi-byte - characters. - - -Of course, custom classes may be specified when using `jqconsole.Write()` for -further customization. - - -##Contributors - -[Max Shawabkeh](http://max99x.com/) -[Amjad Masad](http://twitter.com/amasad) - -## License - -[MIT](http://opensource.org/licenses/MIT) \ No newline at end of file diff --git a/lib/client/console/css/ansi.css b/lib/client/console/css/ansi.css deleted file mode 100644 index 281dcf34..00000000 --- a/lib/client/console/css/ansi.css +++ /dev/null @@ -1,172 +0,0 @@ -.jqconsole-ansi-bold { - /* font-weight: bold; */ -} - -.jqconsole-ansi-lighter { - font-weight: lighter; -} - -.jqconsole-ansi-italic { - font-style: italic; -} - -.jqconsole-ansi-underline { - text-decoration: underline; -} - -@-webkit-keyframes blinker { - from { opacity: 1.0; } - to { opacity: 0.0; } -} - -@-moz-keyframes blinker { - from { opacity: 1.0; } - to { opacity: 0.0; } -} - -@-ms-keyframes blinker { - from { opacity: 1.0; } - to { opacity: 0.0; } -} - -@-o-keyframes blinker { - from { opacity: 1.0; } - to { opacity: 0.0; } -} - -.jqconsole-ansi-blink { - -webkit-animation-name: blinker; - -moz-animation-name: blinker; - -ms-animation-name: blinker; - -o-animation-name: blinker; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - -o-animation-iteration-count: infinite; - -webkit-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -ms-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -o-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -moz-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -webkit-animation-duration: 1s; - -moz-animation-duration: 1s; - -o-animation-duration: 1s; - -ms-animation-duration: 1s; -} - -.jqconsole-ansi-blink-rapid { - -webkit-animation-name: blinker; - -moz-animation-name: blinker; - -ms-animation-name: blinker; - -o-animation-name: blinker; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - -o-animation-iteration-count: infinite; - -webkit-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -ms-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -o-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -moz-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -webkit-animation-duration: 0.5s; - -moz-animation-duration: 0.5s; - -o-animation-duration: 0.5s; - -ms-animation-duration: 0.5s; -} - - -.jqconsole-ansi-hidden { - visibility:hidden; -} - -.jqconsole-ansi-line-through { - text-decoration: line-through; -} - -.jqconsole-ansi-fonts-1 { - -} -.jqconsole-ansi-fonts-2 { - -} -.jqconsole-ansi-fonts-3 { - -} -.jqconsole-ansi-fonts-4 { - -} -.jqconsole-ansi-fonts-5 { - -} -.jqconsole-ansi-fonts-6 { - -} -.jqconsole-ansi-fonts-7 { - -} -.jqconsole-ansi-fonts-8 { - -} -.jqconsole-ansi-fonts-9 { - -} - -.jqconsole-ansi-fraktur { - -} - -.jqconsole-ansi-color-black { - color: black; -} -.jqconsole-ansi-color-red { - color: red; -} -.jqconsole-ansi-color-green { - color: green; -} -.jqconsole-ansi-color-yellow { - color: yellow; -} -.jqconsole-ansi-color-blue { - color: rgb(49,123,249); -} -.jqconsole-ansi-color-magenta { - color: magenta; -} -.jqconsole-ansi-color-cyan { - color: cyan; -} -.jqconsole-ansi-color-white { - color: white; -} - -.jqconsole-ansi-background-color-black { - background-color: black; -} -.jqconsole-ansi-background-color-red { - background-color: red; -} -.jqconsole-ansi-background-color-green { - background-color: green; -} -.jqconsole-ansi-background-color-yellow { - background-color: yellow; -} -.jqconsole-ansi-background-color-blue { - background-color: blue; -} -.jqconsole-ansi-background-color-magenta { - background-color: magenta; -} -.jqconsole-ansi-background-color-cyan { - background-color: cyan; -} -.jqconsole-ansi-background-color-white { - background-color: white; -} - -.jqconsole-ansi-framed { - border: 1px solid; -} -.jqconsole-ansi-overline { - text-decoration: overline; -} - diff --git a/lib/client/console/demos/echo.html b/lib/client/console/demos/echo.html deleted file mode 100644 index 264e3f02..00000000 --- a/lib/client/console/demos/echo.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - -
- - - - - diff --git a/lib/client/console/demos/index.html b/lib/client/console/demos/index.html deleted file mode 100644 index 6f57b493..00000000 --- a/lib/client/console/demos/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - -
- - - - - diff --git a/lib/client/console/jqconsole.jquery.json b/lib/client/console/jqconsole.jquery.json deleted file mode 100644 index c3919fef..00000000 --- a/lib/client/console/jqconsole.jquery.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "jqconsole", - "version": "2.8.0", - "title": "Feature complete web terminal.", - "author": { - "name": "Amjad Masad", - "email": "amjad.masad@gmail.com", - "url": "http://amasad.me" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://opensource.org/licenses/MIT" - } - ], - "description": "A jQuery terminal plugin with raw input/output streams as well as input and output states and support for rich multi-line prompting and operation queueing.", - "keywords": ["terminal", "console", "emulator", "REPL", "repl.it"], - "demo": "http://repl.it/", - "dependencies": { - "jquery": ">=1.5" - } -} diff --git a/lib/client/console/karma.conf.js b/lib/client/console/karma.conf.js deleted file mode 100644 index 48c021ac..00000000 --- a/lib/client/console/karma.conf.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = function(config) { - config.set({ - frameworks: ["mocha"], - files: [ - 'test/vendor/*.js', - 'lib/*.js', - 'test/setup.coffee', - 'test/ansi-test.coffee', - 'test/jqconsole-test.coffee', - 'test/prompt-test.coffee', - 'test/shortcuts-test.coffee', - 'test/history-test.coffee', - 'test/matching-test.coffee', - 'test/misc-test.coffee', - ], - browsers: ['Chrome'], - reporters: ['dots', 'coverage'], - preprocessors: { - 'lib/*.js': ['coverage'], - 'test/*.coffee': ['coffee'] - }, - coffeePreprocessor: { - // options passed to the coffee compiler - options: { - bare: false, - } - }, - coverageReporter: { - type : 'html', - dir : 'coverage/' - } - }); -}; diff --git a/lib/client/console/lib/jqconsole.js b/lib/client/console/lib/jqconsole.js deleted file mode 100644 index 96a16f4f..00000000 --- a/lib/client/console/lib/jqconsole.js +++ /dev/null @@ -1,1489 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -/* -Copyrights 2011, the repl.it project. -Licensed under the MIT license -*/ - - -(function() { - var $, Ansi, CLASS_ANSI, CLASS_BLURRED, CLASS_CURSOR, CLASS_HEADER, CLASS_INPUT, CLASS_OLD_PROMPT, CLASS_PREFIX, CLASS_PROMPT, DEFAULT_INDENT_WIDTH, DEFAULT_PROMPT_CONINUE_LABEL, DEFAULT_PROMPT_LABEL, EMPTY_DIV, EMPTY_SELECTOR, EMPTY_SPAN, ESCAPE_CHAR, ESCAPE_SYNTAX, E_KEYPRESS, JQConsole, KEY_BACKSPACE, KEY_DELETE, KEY_DOWN, KEY_END, KEY_ENTER, KEY_HOME, KEY_LEFT, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_RIGHT, KEY_TAB, KEY_UP, NEWLINE, STATE_INPUT, STATE_OUTPUT, STATE_PROMPT, spanHtml, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __slice = [].slice; - - $ = jQuery; - - STATE_INPUT = 0; - - STATE_OUTPUT = 1; - - STATE_PROMPT = 2; - - KEY_ENTER = 13; - - KEY_TAB = 9; - - KEY_DELETE = 46; - - KEY_BACKSPACE = 8; - - KEY_LEFT = 37; - - KEY_RIGHT = 39; - - KEY_UP = 38; - - KEY_DOWN = 40; - - KEY_HOME = 36; - - KEY_END = 35; - - KEY_PAGE_UP = 33; - - KEY_PAGE_DOWN = 34; - - CLASS_PREFIX = 'jqconsole-'; - - CLASS_CURSOR = "" + CLASS_PREFIX + "cursor"; - - CLASS_HEADER = "" + CLASS_PREFIX + "header"; - - CLASS_PROMPT = "" + CLASS_PREFIX + "prompt"; - - CLASS_OLD_PROMPT = "" + CLASS_PREFIX + "old-prompt"; - - CLASS_INPUT = "" + CLASS_PREFIX + "input"; - - CLASS_BLURRED = "" + CLASS_PREFIX + "blurred"; - - E_KEYPRESS = 'keypress'; - - EMPTY_SPAN = ''; - - EMPTY_DIV = '
'; - - EMPTY_SELECTOR = ':empty'; - - NEWLINE = '\n'; - - DEFAULT_PROMPT_LABEL = '>>> '; - - DEFAULT_PROMPT_CONINUE_LABEL = '... '; - - DEFAULT_INDENT_WIDTH = 2; - - CLASS_ANSI = "" + CLASS_PREFIX + "ansi-"; - - ESCAPE_CHAR = '\x1B'; - - ESCAPE_SYNTAX = /\[(\d*)(?:;(\d*))*m/; - - Ansi = (function() { - Ansi.prototype.COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']; - - function Ansi() { - this.stylize = __bind(this.stylize, this); - this._closeSpan = __bind(this._closeSpan, this); - this._openSpan = __bind(this._openSpan, this); - this.getClasses = __bind(this.getClasses, this); - this._style = __bind(this._style, this); - this._color = __bind(this._color, this); - this._remove = __bind(this._remove, this); - this._append = __bind(this._append, this); - this.klasses = []; - } - - Ansi.prototype._append = function(klass) { - klass = "" + CLASS_ANSI + klass; - if (this.klasses.indexOf(klass) === -1) { - return this.klasses.push(klass); - } - }; - - Ansi.prototype._remove = function() { - var cls, klass, klasses, _i, _len, _results; - klasses = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - _results = []; - for (_i = 0, _len = klasses.length; _i < _len; _i++) { - klass = klasses[_i]; - if (klass === 'fonts' || klass === 'color' || klass === 'background-color') { - _results.push(this.klasses = (function() { - var _j, _len1, _ref, _results1; - _ref = this.klasses; - _results1 = []; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - cls = _ref[_j]; - if (cls.indexOf(klass) !== CLASS_ANSI.length) { - _results1.push(cls); - } - } - return _results1; - }).call(this)); - } else { - klass = "" + CLASS_ANSI + klass; - _results.push(this.klasses = (function() { - var _j, _len1, _ref, _results1; - _ref = this.klasses; - _results1 = []; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - cls = _ref[_j]; - if (cls !== klass) { - _results1.push(cls); - } - } - return _results1; - }).call(this)); - } - } - return _results; - }; - - Ansi.prototype._color = function(i) { - return this.COLORS[i]; - }; - - Ansi.prototype._style = function(code) { - if (code === '') { - code = 0; - } - code = parseInt(code); - if (isNaN(code)) { - return; - } - switch (code) { - case 0: - return this.klasses = []; - case 1: - return this._append('bold'); - case 2: - return this._append('lighter'); - case 3: - return this._append('italic'); - case 4: - return this._append('underline'); - case 5: - return this._append('blink'); - case 6: - return this._append('blink-rapid'); - case 8: - return this._append('hidden'); - case 9: - return this._append('line-through'); - case 10: - return this._remove('fonts'); - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - this._remove('fonts'); - return this._append("fonts-" + (code - 10)); - case 20: - return this._append('fraktur'); - case 21: - return this._remove('bold', 'lighter'); - case 22: - return this._remove('bold', 'lighter'); - case 23: - return this._remove('italic', 'fraktur'); - case 24: - return this._remove('underline'); - case 25: - return this._remove('blink', 'blink-rapid'); - case 28: - return this._remove('hidden'); - case 29: - return this._remove('line-through'); - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - this._remove('color'); - return this._append('color-' + this._color(code - 30)); - case 39: - return this._remove('color'); - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - this._remove('background-color'); - return this._append('background-color-' + this._color(code - 40)); - case 49: - return this._remove('background-color'); - case 51: - return this._append('framed'); - case 53: - return this._append('overline'); - case 54: - return this._remove('framed'); - case 55: - return this._remove('overline'); - } - }; - - Ansi.prototype.getClasses = function() { - return this.klasses.join(' '); - }; - - Ansi.prototype._openSpan = function(text) { - return "" + text; - }; - - Ansi.prototype._closeSpan = function(text) { - return "" + text + ""; - }; - - Ansi.prototype.stylize = function(text) { - var code, d, i, _i, _len, _ref; - text = this._openSpan(text); - i = 0; - while ((i = text.indexOf(ESCAPE_CHAR, i)) && i !== -1) { - if (d = text.slice(i).match(ESCAPE_SYNTAX)) { - _ref = d.slice(1); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - code = _ref[_i]; - this._style(code); - } - text = this._closeSpan(text.slice(0, i)) + this._openSpan(text.slice(i + 1 + d[0].length)); - } else { - i++; - } - } - return this._closeSpan(text); - }; - - return Ansi; - - })(); - - spanHtml = function(klass, content) { - return "" + (content || '') + ""; - }; - - JQConsole = (function() { - function JQConsole(outer_container, header, prompt_label, prompt_continue_label) { - this._HideComposition = __bind(this._HideComposition, this); - this._ShowComposition = __bind(this._ShowComposition, this); - this._UpdateComposition = __bind(this._UpdateComposition, this); - this._EndComposition = __bind(this._EndComposition, this); - this._StartComposition = __bind(this._StartComposition, this); - this._CheckComposition = __bind(this._CheckComposition, this); - this._ProcessMatch = __bind(this._ProcessMatch, this); - this._HandleKey = __bind(this._HandleKey, this); - this._HandleChar = __bind(this._HandleChar, this); - this.isMobile = !!navigator.userAgent.match(/iPhone|iPad|iPod|Android/i); - this.isIos = !!navigator.userAgent.match(/iPhone|iPad|iPod/i); - this.isAndroid = !!navigator.userAgent.match(/Android/i); - this.$window = $(window); - this.header = header || ''; - this.prompt_label_main = typeof prompt_label === 'string' ? prompt_label : DEFAULT_PROMPT_LABEL; - this.prompt_label_continue = prompt_continue_label || DEFAULT_PROMPT_CONINUE_LABEL; - this.indent_width = DEFAULT_INDENT_WIDTH; - this.state = STATE_OUTPUT; - this.input_queue = []; - this.input_callback = null; - this.multiline_callback = null; - this.history = []; - this.history_index = 0; - this.history_new = ''; - this.history_active = false; - this.shortcuts = {}; - this.$container = $('
').appendTo(outer_container); - this.$container.css({ - 'top': 0, - 'left': 0, - 'right': 0, - 'bottom': 0, - 'position': 'absolute', - 'overflow': 'auto' - }); - this.$console = $('
').appendTo(this.$container);
-      this.$console.css({
-        'margin': 0,
-        'position': 'relative',
-        'min-height': '100%',
-        'box-sizing': 'border-box',
-        '-moz-box-sizing': 'border-box',
-        '-webkit-box-sizing': 'border-box'
-      });
-      this.$console_focused = true;
-      this.$input_container = $(EMPTY_DIV).appendTo(this.$container);
-      this.$input_container.css({
-        position: 'absolute',
-        width: 1,
-        height: 0,
-        overflow: 'hidden'
-      });
-      this.$input_source = this.isAndroid ? $('') : $('";
-  support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
-})();
-var strundefined = typeof undefined;
-
-
-
-support.focusinBubbles = "onfocusin" in window;
-
-
-var
-  rkeyEvent = /^key/,
-  rmouseEvent = /^(?:mouse|contextmenu)|click/,
-  rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
-  rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
-
-function returnTrue() {
-  return true;
-}
-
-function returnFalse() {
-  return false;
-}
-
-function safeActiveElement() {
-  try {
-    return document.activeElement;
-  } catch ( err ) { }
-}
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
-  global: {},
-
-  add: function( elem, types, handler, data, selector ) {
-
-    var handleObjIn, eventHandle, tmp,
-      events, t, handleObj,
-      special, handlers, type, namespaces, origType,
-      elemData = data_priv.get( elem );
-
-    // Don't attach events to noData or text/comment nodes (but allow plain objects)
-    if ( !elemData ) {
-      return;
-    }
-
-    // Caller can pass in an object of custom data in lieu of the handler
-    if ( handler.handler ) {
-      handleObjIn = handler;
-      handler = handleObjIn.handler;
-      selector = handleObjIn.selector;
-    }
-
-    // Make sure that the handler has a unique ID, used to find/remove it later
-    if ( !handler.guid ) {
-      handler.guid = jQuery.guid++;
-    }
-
-    // Init the element's event structure and main handler, if this is the first
-    if ( !(events = elemData.events) ) {
-      events = elemData.events = {};
-    }
-    if ( !(eventHandle = elemData.handle) ) {
-      eventHandle = elemData.handle = function( e ) {
-        // Discard the second event of a jQuery.event.trigger() and
-        // when an event is called after a page has unloaded
-        return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
-          jQuery.event.dispatch.apply( elem, arguments ) : undefined;
-      };
-    }
-
-    // Handle multiple events separated by a space
-    types = ( types || "" ).match( rnotwhite ) || [ "" ];
-    t = types.length;
-    while ( t-- ) {
-      tmp = rtypenamespace.exec( types[t] ) || [];
-      type = origType = tmp[1];
-      namespaces = ( tmp[2] || "" ).split( "." ).sort();
-
-      // There *must* be a type, no attaching namespace-only handlers
-      if ( !type ) {
-        continue;
-      }
-
-      // If event changes its type, use the special event handlers for the changed type
-      special = jQuery.event.special[ type ] || {};
-
-      // If selector defined, determine special event api type, otherwise given type
-      type = ( selector ? special.delegateType : special.bindType ) || type;
-
-      // Update special based on newly reset type
-      special = jQuery.event.special[ type ] || {};
-
-      // handleObj is passed to all event handlers
-      handleObj = jQuery.extend({
-        type: type,
-        origType: origType,
-        data: data,
-        handler: handler,
-        guid: handler.guid,
-        selector: selector,
-        needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
-        namespace: namespaces.join(".")
-      }, handleObjIn );
-
-      // Init the event handler queue if we're the first
-      if ( !(handlers = events[ type ]) ) {
-        handlers = events[ type ] = [];
-        handlers.delegateCount = 0;
-
-        // Only use addEventListener if the special events handler returns false
-        if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
-          if ( elem.addEventListener ) {
-            elem.addEventListener( type, eventHandle, false );
-          }
-        }
-      }
-
-      if ( special.add ) {
-        special.add.call( elem, handleObj );
-
-        if ( !handleObj.handler.guid ) {
-          handleObj.handler.guid = handler.guid;
-        }
-      }
-
-      // Add to the element's handler list, delegates in front
-      if ( selector ) {
-        handlers.splice( handlers.delegateCount++, 0, handleObj );
-      } else {
-        handlers.push( handleObj );
-      }
-
-      // Keep track of which events have ever been used, for event optimization
-      jQuery.event.global[ type ] = true;
-    }
-
-  },
-
-  // Detach an event or set of events from an element
-  remove: function( elem, types, handler, selector, mappedTypes ) {
-
-    var j, origCount, tmp,
-      events, t, handleObj,
-      special, handlers, type, namespaces, origType,
-      elemData = data_priv.hasData( elem ) && data_priv.get( elem );
-
-    if ( !elemData || !(events = elemData.events) ) {
-      return;
-    }
-
-    // Once for each type.namespace in types; type may be omitted
-    types = ( types || "" ).match( rnotwhite ) || [ "" ];
-    t = types.length;
-    while ( t-- ) {
-      tmp = rtypenamespace.exec( types[t] ) || [];
-      type = origType = tmp[1];
-      namespaces = ( tmp[2] || "" ).split( "." ).sort();
-
-      // Unbind all events (on this namespace, if provided) for the element
-      if ( !type ) {
-        for ( type in events ) {
-          jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
-        }
-        continue;
-      }
-
-      special = jQuery.event.special[ type ] || {};
-      type = ( selector ? special.delegateType : special.bindType ) || type;
-      handlers = events[ type ] || [];
-      tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
-
-      // Remove matching events
-      origCount = j = handlers.length;
-      while ( j-- ) {
-        handleObj = handlers[ j ];
-
-        if ( ( mappedTypes || origType === handleObj.origType ) &&
-          ( !handler || handler.guid === handleObj.guid ) &&
-          ( !tmp || tmp.test( handleObj.namespace ) ) &&
-          ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
-          handlers.splice( j, 1 );
-
-          if ( handleObj.selector ) {
-            handlers.delegateCount--;
-          }
-          if ( special.remove ) {
-            special.remove.call( elem, handleObj );
-          }
-        }
-      }
-
-      // Remove generic event handler if we removed something and no more handlers exist
-      // (avoids potential for endless recursion during removal of special event handlers)
-      if ( origCount && !handlers.length ) {
-        if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
-          jQuery.removeEvent( elem, type, elemData.handle );
-        }
-
-        delete events[ type ];
-      }
-    }
-
-    // Remove the expando if it's no longer used
-    if ( jQuery.isEmptyObject( events ) ) {
-      delete elemData.handle;
-      data_priv.remove( elem, "events" );
-    }
-  },
-
-  trigger: function( event, data, elem, onlyHandlers ) {
-
-    var i, cur, tmp, bubbleType, ontype, handle, special,
-      eventPath = [ elem || document ],
-      type = hasOwn.call( event, "type" ) ? event.type : event,
-      namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
-
-    cur = tmp = elem = elem || document;
-
-    // Don't do events on text and comment nodes
-    if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
-      return;
-    }
-
-    // focus/blur morphs to focusin/out; ensure we're not firing them right now
-    if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
-      return;
-    }
-
-    if ( type.indexOf(".") >= 0 ) {
-      // Namespaced trigger; create a regexp to match event type in handle()
-      namespaces = type.split(".");
-      type = namespaces.shift();
-      namespaces.sort();
-    }
-    ontype = type.indexOf(":") < 0 && "on" + type;
-
-    // Caller can pass in a jQuery.Event object, Object, or just an event type string
-    event = event[ jQuery.expando ] ?
-      event :
-      new jQuery.Event( type, typeof event === "object" && event );
-
-    // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
-    event.isTrigger = onlyHandlers ? 2 : 3;
-    event.namespace = namespaces.join(".");
-    event.namespace_re = event.namespace ?
-      new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
-      null;
-
-    // Clean up the event in case it is being reused
-    event.result = undefined;
-    if ( !event.target ) {
-      event.target = elem;
-    }
-
-    // Clone any incoming data and prepend the event, creating the handler arg list
-    data = data == null ?
-      [ event ] :
-      jQuery.makeArray( data, [ event ] );
-
-    // Allow special events to draw outside the lines
-    special = jQuery.event.special[ type ] || {};
-    if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
-      return;
-    }
-
-    // Determine event propagation path in advance, per W3C events spec (#9951)
-    // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
-    if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
-      bubbleType = special.delegateType || type;
-      if ( !rfocusMorph.test( bubbleType + type ) ) {
-        cur = cur.parentNode;
-      }
-      for ( ; cur; cur = cur.parentNode ) {
-        eventPath.push( cur );
-        tmp = cur;
-      }
-
-      // Only add window if we got to document (e.g., not plain obj or detached DOM)
-      if ( tmp === (elem.ownerDocument || document) ) {
-        eventPath.push( tmp.defaultView || tmp.parentWindow || window );
-      }
-    }
-
-    // Fire handlers on the event path
-    i = 0;
-    while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
-
-      event.type = i > 1 ?
-        bubbleType :
-        special.bindType || type;
-
-      // jQuery handler
-      handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
-      if ( handle ) {
-        handle.apply( cur, data );
-      }
-
-      // Native handler
-      handle = ontype && cur[ ontype ];
-      if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
-        event.result = handle.apply( cur, data );
-        if ( event.result === false ) {
-          event.preventDefault();
-        }
-      }
-    }
-    event.type = type;
-
-    // If nobody prevented the default action, do it now
-    if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
-      if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
-        jQuery.acceptData( elem ) ) {
-
-        // Call a native DOM method on the target with the same name name as the event.
-        // Don't do default actions on window, that's where global variables be (#6170)
-        if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
-
-          // Don't re-trigger an onFOO event when we call its FOO() method
-          tmp = elem[ ontype ];
-
-          if ( tmp ) {
-            elem[ ontype ] = null;
-          }
-
-          // Prevent re-triggering of the same event, since we already bubbled it above
-          jQuery.event.triggered = type;
-          elem[ type ]();
-          jQuery.event.triggered = undefined;
-
-          if ( tmp ) {
-            elem[ ontype ] = tmp;
-          }
-        }
-      }
-    }
-
-    return event.result;
-  },
-
-  dispatch: function( event ) {
-
-    // Make a writable jQuery.Event from the native event object
-    event = jQuery.event.fix( event );
-
-    var i, j, ret, matched, handleObj,
-      handlerQueue = [],
-      args = slice.call( arguments ),
-      handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
-      special = jQuery.event.special[ event.type ] || {};
-
-    // Use the fix-ed jQuery.Event rather than the (read-only) native event
-    args[0] = event;
-    event.delegateTarget = this;
-
-    // Call the preDispatch hook for the mapped type, and let it bail if desired
-    if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
-      return;
-    }
-
-    // Determine handlers
-    handlerQueue = jQuery.event.handlers.call( this, event, handlers );
-
-    // Run delegates first; they may want to stop propagation beneath us
-    i = 0;
-    while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
-      event.currentTarget = matched.elem;
-
-      j = 0;
-      while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
-
-        // Triggered event must either 1) have no namespace, or
-        // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
-        if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
-
-          event.handleObj = handleObj;
-          event.data = handleObj.data;
-
-          ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
-              .apply( matched.elem, args );
-
-          if ( ret !== undefined ) {
-            if ( (event.result = ret) === false ) {
-              event.preventDefault();
-              event.stopPropagation();
-            }
-          }
-        }
-      }
-    }
-
-    // Call the postDispatch hook for the mapped type
-    if ( special.postDispatch ) {
-      special.postDispatch.call( this, event );
-    }
-
-    return event.result;
-  },
-
-  handlers: function( event, handlers ) {
-    var i, matches, sel, handleObj,
-      handlerQueue = [],
-      delegateCount = handlers.delegateCount,
-      cur = event.target;
-
-    // Find delegate handlers
-    // Black-hole SVG  instance trees (#13180)
-    // Avoid non-left-click bubbling in Firefox (#3861)
-    if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
-
-      for ( ; cur !== this; cur = cur.parentNode || this ) {
-
-        // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
-        if ( cur.disabled !== true || event.type !== "click" ) {
-          matches = [];
-          for ( i = 0; i < delegateCount; i++ ) {
-            handleObj = handlers[ i ];
-
-            // Don't conflict with Object.prototype properties (#13203)
-            sel = handleObj.selector + " ";
-
-            if ( matches[ sel ] === undefined ) {
-              matches[ sel ] = handleObj.needsContext ?
-                jQuery( sel, this ).index( cur ) >= 0 :
-                jQuery.find( sel, this, null, [ cur ] ).length;
-            }
-            if ( matches[ sel ] ) {
-              matches.push( handleObj );
-            }
-          }
-          if ( matches.length ) {
-            handlerQueue.push({ elem: cur, handlers: matches });
-          }
-        }
-      }
-    }
-
-    // Add the remaining (directly-bound) handlers
-    if ( delegateCount < handlers.length ) {
-      handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
-    }
-
-    return handlerQueue;
-  },
-
-  // Includes some event props shared by KeyEvent and MouseEvent
-  props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
-  fixHooks: {},
-
-  keyHooks: {
-    props: "char charCode key keyCode".split(" "),
-    filter: function( event, original ) {
-
-      // Add which for key events
-      if ( event.which == null ) {
-        event.which = original.charCode != null ? original.charCode : original.keyCode;
-      }
-
-      return event;
-    }
-  },
-
-  mouseHooks: {
-    props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
-    filter: function( event, original ) {
-      var eventDoc, doc, body,
-        button = original.button;
-
-      // Calculate pageX/Y if missing and clientX/Y available
-      if ( event.pageX == null && original.clientX != null ) {
-        eventDoc = event.target.ownerDocument || document;
-        doc = eventDoc.documentElement;
-        body = eventDoc.body;
-
-        event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
-        event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
-      }
-
-      // Add which for click: 1 === left; 2 === middle; 3 === right
-      // Note: button is not normalized, so don't use it
-      if ( !event.which && button !== undefined ) {
-        event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
-      }
-
-      return event;
-    }
-  },
-
-  fix: function( event ) {
-    if ( event[ jQuery.expando ] ) {
-      return event;
-    }
-
-    // Create a writable copy of the event object and normalize some properties
-    var i, prop, copy,
-      type = event.type,
-      originalEvent = event,
-      fixHook = this.fixHooks[ type ];
-
-    if ( !fixHook ) {
-      this.fixHooks[ type ] = fixHook =
-        rmouseEvent.test( type ) ? this.mouseHooks :
-        rkeyEvent.test( type ) ? this.keyHooks :
-        {};
-    }
-    copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
-    event = new jQuery.Event( originalEvent );
-
-    i = copy.length;
-    while ( i-- ) {
-      prop = copy[ i ];
-      event[ prop ] = originalEvent[ prop ];
-    }
-
-    // Support: Cordova 2.5 (WebKit) (#13255)
-    // All events should have a target; Cordova deviceready doesn't
-    if ( !event.target ) {
-      event.target = document;
-    }
-
-    // Support: Safari 6.0+, Chrome < 28
-    // Target should not be a text node (#504, #13143)
-    if ( event.target.nodeType === 3 ) {
-      event.target = event.target.parentNode;
-    }
-
-    return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
-  },
-
-  special: {
-    load: {
-      // Prevent triggered image.load events from bubbling to window.load
-      noBubble: true
-    },
-    focus: {
-      // Fire native event if possible so blur/focus sequence is correct
-      trigger: function() {
-        if ( this !== safeActiveElement() && this.focus ) {
-          this.focus();
-          return false;
-        }
-      },
-      delegateType: "focusin"
-    },
-    blur: {
-      trigger: function() {
-        if ( this === safeActiveElement() && this.blur ) {
-          this.blur();
-          return false;
-        }
-      },
-      delegateType: "focusout"
-    },
-    click: {
-      // For checkbox, fire native event so checked state will be right
-      trigger: function() {
-        if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
-          this.click();
-          return false;
-        }
-      },
-
-      // For cross-browser consistency, don't fire native .click() on links
-      _default: function( event ) {
-        return jQuery.nodeName( event.target, "a" );
-      }
-    },
-
-    beforeunload: {
-      postDispatch: function( event ) {
-
-        // Support: Firefox 20+
-        // Firefox doesn't alert if the returnValue field is not set.
-        if ( event.result !== undefined ) {
-          event.originalEvent.returnValue = event.result;
-        }
-      }
-    }
-  },
-
-  simulate: function( type, elem, event, bubble ) {
-    // Piggyback on a donor event to simulate a different one.
-    // Fake originalEvent to avoid donor's stopPropagation, but if the
-    // simulated event prevents default then we do the same on the donor.
-    var e = jQuery.extend(
-      new jQuery.Event(),
-      event,
-      {
-        type: type,
-        isSimulated: true,
-        originalEvent: {}
-      }
-    );
-    if ( bubble ) {
-      jQuery.event.trigger( e, null, elem );
-    } else {
-      jQuery.event.dispatch.call( elem, e );
-    }
-    if ( e.isDefaultPrevented() ) {
-      event.preventDefault();
-    }
-  }
-};
-
-jQuery.removeEvent = function( elem, type, handle ) {
-  if ( elem.removeEventListener ) {
-    elem.removeEventListener( type, handle, false );
-  }
-};
-
-jQuery.Event = function( src, props ) {
-  // Allow instantiation without the 'new' keyword
-  if ( !(this instanceof jQuery.Event) ) {
-    return new jQuery.Event( src, props );
-  }
-
-  // Event object
-  if ( src && src.type ) {
-    this.originalEvent = src;
-    this.type = src.type;
-
-    // Events bubbling up the document may have been marked as prevented
-    // by a handler lower down the tree; reflect the correct value.
-    this.isDefaultPrevented = src.defaultPrevented ||
-        // Support: Android < 4.0
-        src.defaultPrevented === undefined &&
-        src.getPreventDefault && src.getPreventDefault() ?
-      returnTrue :
-      returnFalse;
-
-  // Event type
-  } else {
-    this.type = src;
-  }
-
-  // Put explicitly provided properties onto the event object
-  if ( props ) {
-    jQuery.extend( this, props );
-  }
-
-  // Create a timestamp if incoming event doesn't have one
-  this.timeStamp = src && src.timeStamp || jQuery.now();
-
-  // Mark it as fixed
-  this[ jQuery.expando ] = true;
-};
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
-  isDefaultPrevented: returnFalse,
-  isPropagationStopped: returnFalse,
-  isImmediatePropagationStopped: returnFalse,
-
-  preventDefault: function() {
-    var e = this.originalEvent;
-
-    this.isDefaultPrevented = returnTrue;
-
-    if ( e && e.preventDefault ) {
-      e.preventDefault();
-    }
-  },
-  stopPropagation: function() {
-    var e = this.originalEvent;
-
-    this.isPropagationStopped = returnTrue;
-
-    if ( e && e.stopPropagation ) {
-      e.stopPropagation();
-    }
-  },
-  stopImmediatePropagation: function() {
-    this.isImmediatePropagationStopped = returnTrue;
-    this.stopPropagation();
-  }
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-// Support: Chrome 15+
-jQuery.each({
-  mouseenter: "mouseover",
-  mouseleave: "mouseout"
-}, function( orig, fix ) {
-  jQuery.event.special[ orig ] = {
-    delegateType: fix,
-    bindType: fix,
-
-    handle: function( event ) {
-      var ret,
-        target = this,
-        related = event.relatedTarget,
-        handleObj = event.handleObj;
-
-      // For mousenter/leave call the handler if related is outside the target.
-      // NB: No relatedTarget if the mouse left/entered the browser window
-      if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
-        event.type = handleObj.origType;
-        ret = handleObj.handler.apply( this, arguments );
-        event.type = fix;
-      }
-      return ret;
-    }
-  };
-});
-
-// Create "bubbling" focus and blur events
-// Support: Firefox, Chrome, Safari
-if ( !support.focusinBubbles ) {
-  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
-    // Attach a single capturing handler on the document while someone wants focusin/focusout
-    var handler = function( event ) {
-        jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
-      };
-
-    jQuery.event.special[ fix ] = {
-      setup: function() {
-        var doc = this.ownerDocument || this,
-          attaches = data_priv.access( doc, fix );
-
-        if ( !attaches ) {
-          doc.addEventListener( orig, handler, true );
-        }
-        data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
-      },
-      teardown: function() {
-        var doc = this.ownerDocument || this,
-          attaches = data_priv.access( doc, fix ) - 1;
-
-        if ( !attaches ) {
-          doc.removeEventListener( orig, handler, true );
-          data_priv.remove( doc, fix );
-
-        } else {
-          data_priv.access( doc, fix, attaches );
-        }
-      }
-    };
-  });
-}
-
-jQuery.fn.extend({
-
-  on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
-    var origFn, type;
-
-    // Types can be a map of types/handlers
-    if ( typeof types === "object" ) {
-      // ( types-Object, selector, data )
-      if ( typeof selector !== "string" ) {
-        // ( types-Object, data )
-        data = data || selector;
-        selector = undefined;
-      }
-      for ( type in types ) {
-        this.on( type, selector, data, types[ type ], one );
-      }
-      return this;
-    }
-
-    if ( data == null && fn == null ) {
-      // ( types, fn )
-      fn = selector;
-      data = selector = undefined;
-    } else if ( fn == null ) {
-      if ( typeof selector === "string" ) {
-        // ( types, selector, fn )
-        fn = data;
-        data = undefined;
-      } else {
-        // ( types, data, fn )
-        fn = data;
-        data = selector;
-        selector = undefined;
-      }
-    }
-    if ( fn === false ) {
-      fn = returnFalse;
-    } else if ( !fn ) {
-      return this;
-    }
-
-    if ( one === 1 ) {
-      origFn = fn;
-      fn = function( event ) {
-        // Can use an empty set, since event contains the info
-        jQuery().off( event );
-        return origFn.apply( this, arguments );
-      };
-      // Use same guid so caller can remove using origFn
-      fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
-    }
-    return this.each( function() {
-      jQuery.event.add( this, types, fn, data, selector );
-    });
-  },
-  one: function( types, selector, data, fn ) {
-    return this.on( types, selector, data, fn, 1 );
-  },
-  off: function( types, selector, fn ) {
-    var handleObj, type;
-    if ( types && types.preventDefault && types.handleObj ) {
-      // ( event )  dispatched jQuery.Event
-      handleObj = types.handleObj;
-      jQuery( types.delegateTarget ).off(
-        handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
-        handleObj.selector,
-        handleObj.handler
-      );
-      return this;
-    }
-    if ( typeof types === "object" ) {
-      // ( types-object [, selector] )
-      for ( type in types ) {
-        this.off( type, selector, types[ type ] );
-      }
-      return this;
-    }
-    if ( selector === false || typeof selector === "function" ) {
-      // ( types [, fn] )
-      fn = selector;
-      selector = undefined;
-    }
-    if ( fn === false ) {
-      fn = returnFalse;
-    }
-    return this.each(function() {
-      jQuery.event.remove( this, types, fn, selector );
-    });
-  },
-
-  trigger: function( type, data ) {
-    return this.each(function() {
-      jQuery.event.trigger( type, data, this );
-    });
-  },
-  triggerHandler: function( type, data ) {
-    var elem = this[0];
-    if ( elem ) {
-      return jQuery.event.trigger( type, data, elem, true );
-    }
-  }
-});
-
-
-var
-  rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
-  rtagName = /<([\w:]+)/,
-  rhtml = /<|&#?\w+;/,
-  rnoInnerhtml = /<(?:script|style|link)/i,
-  // checked="checked" or checked
-  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
-  rscriptType = /^$|\/(?:java|ecma)script/i,
-  rscriptTypeMasked = /^true\/(.*)/,
-  rcleanScript = /^\s*\s*$/g,
-
-  // We have to close these tags to support XHTML (#13200)
-  wrapMap = {
-
-    // Support: IE 9
-    option: [ 1, "" ],
-
-    thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] - }; - -// Support: IE 9 -wrapMap.optgroup = wrapMap.option; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: 1.x compatibility -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - - if ( match ) { - elem.type = match[ 1 ]; - } else { - elem.removeAttribute("type"); - } - - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - data_priv.set( - elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) - ); - } -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( data_priv.hasData( src ) ) { - pdataOld = data_priv.access( src ); - pdataCur = data_priv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( data_user.hasData( src ) ) { - udataOld = data_user.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - data_user.set( dest, udataCur ); - } -} - -function getAll( context, tag ) { - var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : - context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : - []; - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], ret ) : - ret; -} - -// Support: IE >= 9 -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); - - // Support: IE >= 9 - // Fix Cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var elem, tmp, tag, wrap, contains, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - // Support: QtWebKit - // jQuery.merge because push.apply(_, arraylike) throws - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: QtWebKit - // jQuery.merge because push.apply(_, arraylike) throws - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Fixes #12346 - // Support: Webkit, IE - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; - }, - - cleanData: function( elems ) { - var data, elem, events, type, key, j, - special = jQuery.event.special, - i = 0; - - for ( ; (elem = elems[ i ]) !== undefined; i++ ) { - if ( jQuery.acceptData( elem ) ) { - key = elem[ data_priv.expando ]; - - if ( key && (data = data_priv.cache[ key ]) ) { - events = Object.keys( data.events || {} ); - if ( events.length ) { - for ( j = 0; (type = events[j]) !== undefined; j++ ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - if ( data_priv.cache[ key ] ) { - // Discard any remaining `private` data - delete data_priv.cache[ key ]; - } - } - } - // Discard any remaining `user` data - delete data_user.cache[ elem[ data_user.expando ] ]; - } - } -}); - -jQuery.fn.extend({ - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each(function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - }); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - remove: function( selector, keepData /* Internal Use Only */ ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map(function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var arg = arguments[ 0 ]; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - arg = this.parentNode; - - jQuery.cleanData( getAll( this ) ); - - if ( arg ) { - arg.replaceChild( elem, this ); - } - }); - - // Force removal if there was no new content (e.g., from empty arguments) - return arg && (arg.length || arg.nodeType) ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[ 0 ], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - self.domManip( args, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - // Support: QtWebKit - // jQuery.merge because push.apply(_, arraylike) throws - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); - } - } - } - } - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: QtWebKit - // .get() because push.apply(_, arraylike) throws - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - - -var iframe, - elemdisplay = {}; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle ? - - // Use of this method is a temporary fix (more like optmization) until something better comes along, - // since it was removed from specification and supported only in FF - window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); - - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); - - return display; -} - -/** - * Try to determine the default display value of an element - * @param {String} nodeName - */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = (iframe || jQuery( "