├── README.md ├── static ├── js │ ├── jquery.js │ ├── LICENSE-LZMA │ ├── helpers.js │ ├── lzma.js │ └── glsl.js ├── css │ ├── resizer.png │ ├── default.css │ └── codemirror.css └── index.html ├── server ├── assets │ ├── js │ │ ├── lzma.js │ │ ├── glsl.js │ │ ├── codemirror.js │ │ ├── helpers.js │ │ ├── diffview.js │ │ ├── difflib.js │ │ └── jquery.js │ ├── css │ │ ├── default.css │ │ ├── codemirror.css │ │ ├── resizer.png │ │ └── diffview.css │ ├── gallery.html │ └── diff.html ├── main.rb └── model.rb ├── config.ru ├── Gemfile ├── Gemfile.lock └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/js/jquery.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /server/assets/js/lzma.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /server/assets/js/glsl.js: -------------------------------------------------------------------------------- 1 | ../../../static/js/glsl.js -------------------------------------------------------------------------------- /server/assets/css/default.css: -------------------------------------------------------------------------------- 1 | ../../../static/css/default.css -------------------------------------------------------------------------------- /server/assets/js/codemirror.js: -------------------------------------------------------------------------------- 1 | ../../../static/js/codemirror.js -------------------------------------------------------------------------------- /server/assets/css/codemirror.css: -------------------------------------------------------------------------------- 1 | ../../../static/css/codemirror.css -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | 2 | $: << './server' 3 | 4 | require 'main' 5 | run Sinatra::Application 6 | 7 | -------------------------------------------------------------------------------- /static/css/resizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emackey/glsl-sandbox/master/static/css/resizer.png -------------------------------------------------------------------------------- /server/assets/css/resizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emackey/glsl-sandbox/master/server/assets/css/resizer.png -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'sinatra' 4 | gem 'mongo' 5 | gem 'bson_ext' 6 | gem 'json' 7 | gem 'cloudinary' 8 | 9 | -------------------------------------------------------------------------------- /static/css/default.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-keyword {color: #bbf;} 2 | .cm-s-default span.cm-number {color: #fbb;} 3 | .cm-s-default span.cm-def {color: #55f;} 4 | .cm-s-default span.cm-comment {color: #8ff;} 5 | .cm-s-default span.cm-operator {color: #5b5;} 6 | .cm-s-default span.cm-meta {color: #8f8;} 7 | .cm-s-default span.cm-qualifier {color: #888;} 8 | .cm-s-default span.cm-builtin {color: #fbf;} 9 | .cm-s-default span.cm-bracket {color: #bbb;} 10 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | aws_cf_signer (0.1.1) 5 | bson (1.4.0) 6 | bson_ext (1.4.0) 7 | cloudinary (1.0.37) 8 | aws_cf_signer 9 | rest-client 10 | json (1.6.1) 11 | mime-types (1.19) 12 | mongo (1.4.0) 13 | bson (= 1.4.0) 14 | rack (1.3.5) 15 | rack-protection (1.1.4) 16 | rack 17 | rest-client (1.6.7) 18 | mime-types (>= 1.16) 19 | sinatra (1.3.1) 20 | rack (~> 1.3, >= 1.3.4) 21 | rack-protection (~> 1.1, >= 1.1.2) 22 | tilt (~> 1.3, >= 1.3.3) 23 | tilt (1.3.3) 24 | 25 | PLATFORMS 26 | ruby 27 | 28 | DEPENDENCIES 29 | bson_ext 30 | cloudinary 31 | json 32 | mongo 33 | sinatra 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Mr.doob 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/js/LICENSE-LZMA: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Nathan Rugg 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /server/main.rb: -------------------------------------------------------------------------------- 1 | 2 | require 'rubygems' 3 | require 'sinatra' 4 | require 'mongo' 5 | require 'json' 6 | require 'erb' 7 | require 'cloudinary' 8 | 9 | $: << './server' 10 | 11 | require 'model' 12 | 13 | require 'pp' 14 | 15 | configure do 16 | set :public_folder, 'server/assets' 17 | 18 | GALLERY=ERB.new(File.read('server/assets/gallery.html')) 19 | 20 | $glsl=GlslDatabase.new 21 | 22 | EFFECTS_PER_PAGE=50 23 | end 24 | 25 | get '/' do 26 | if(params[:page]) 27 | page=params[:page].to_i 28 | else 29 | page=0 30 | end 31 | 32 | ef=$glsl.get_page(page, EFFECTS_PER_PAGE) 33 | 34 | GALLERY.result(ef.bind) 35 | end 36 | 37 | get '/e' do 38 | send_file 'static/index.html' 39 | end 40 | 41 | get %r{/item/(\d+)([/.](\d+))?} do 42 | code_id=params[:captures][0].to_i 43 | if params[:captures][1] 44 | version_id=params[:captures][2].to_i 45 | else 46 | version_id=nil 47 | end 48 | 49 | $glsl.get_code_json(code_id, version_id) 50 | end 51 | 52 | post '/e' do 53 | body=request.body.read 54 | $glsl.save_effect(body) 55 | end 56 | 57 | get '/diff' do 58 | send_file 'server/assets/diff.html' 59 | end 60 | 61 | 62 | # redirects 63 | 64 | get '/new' do 65 | redirect '/e', 301 66 | end 67 | 68 | get %r{^/(\d+)(/(\d+))?$} do 69 | url="/e##{params[:captures][0]}" 70 | url+=".#{params[:captures][2]}" if params[:captures][1] 71 | redirect url, 301 72 | end 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /static/js/helpers.js: -------------------------------------------------------------------------------- 1 | 2 | function initialize_compressor() { 3 | compressor=new LZMA( "js/lzma_worker.js" ); 4 | return compressor; 5 | } 6 | 7 | function initialize_helper() { 8 | } 9 | 10 | function load_url_code() { 11 | if ( window.location.hash ) { 12 | 13 | var hash = window.location.hash.substr( 1 ); 14 | var version = hash.substr( 0, 2 ); 15 | 16 | if ( version == 'A/' ) { 17 | 18 | // LZMA 19 | 20 | readURL( hash.substr( 2 ) ); 21 | 22 | } else { 23 | 24 | // Basic format 25 | 26 | code.value = decodeURIComponent( hash ); 27 | 28 | } 29 | 30 | } else { 31 | 32 | readURL( '5d000001009a0200000000000000119a48c65ab5aec1f910f780dfdfe473e599a211a90304ab6aa581b342b344db4e71099beb79352b3c442c8dee970ffb4d054491e356b4f55882c2f3554393fe6662cf2c348a3f51dcce7b5760290bbc5c1b937d382ba6cdd0a9b35cf7fd57cebd800501c16f80f61ad4501d00a2ca4e63c8dc38b7b03703cba8d68914c6f2c6598f2f7008faee0e4b4cf4276eea6d0fb93df9188dae5b7f6db2579246363efaf9145f13206ee5b908e90eb4f6e19254a0f4fda81b31c2d3fd00e78e5b5fb5d5e51df87412a667211e121d77f3becd58d5960f9b77d8b826d4c6bce27a589f7158944441ae8fa5a297f23f0e7707f84fcbe0557976aaca9c97b99d3252a8b85b2a4ecb10d9b3cb65f6a5d75240f8bde39ed692b559c61276fe260578' ); 33 | 34 | } 35 | } 36 | 37 | function setURL( shaderString ) { 38 | 39 | compressor.compress( shaderString, 1, function( bytes ) { 40 | 41 | var hex = convertBytesToHex( bytes ); 42 | window.location.replace( '#A/' + hex ); 43 | 44 | }, 45 | dummyFunction ); 46 | 47 | } 48 | 49 | function readURL( hash ) { 50 | 51 | var bytes = convertHexToBytes( hash ); 52 | 53 | compressor.decompress( bytes, function( text ) { 54 | 55 | compileOnChangeCode = false; // Prevent compile timer start 56 | code.setValue(text); 57 | compile(); 58 | compileOnChangeCode = true; 59 | 60 | }, 61 | dummyFunction ); 62 | 63 | } 64 | 65 | function convertHexToBytes( text ) { 66 | 67 | var tmpHex, array = []; 68 | 69 | for ( var i = 0; i < text.length; i += 2 ) { 70 | 71 | tmpHex = text.substring( i, i + 2 ); 72 | array.push( parseInt( tmpHex, 16 ) ); 73 | 74 | } 75 | 76 | return array; 77 | 78 | } 79 | 80 | function convertBytesToHex( byteArray ) { 81 | 82 | var tmpHex, hex = ""; 83 | 84 | for ( var i = 0, il = byteArray.length; i < il; i ++ ) { 85 | 86 | if ( byteArray[ i ] < 0 ) { 87 | 88 | byteArray[ i ] = byteArray[ i ] + 256; 89 | 90 | } 91 | 92 | tmpHex = byteArray[ i ].toString( 16 ); 93 | 94 | // add leading zero 95 | 96 | if ( tmpHex.length == 1 ) tmpHex = "0" + tmpHex; 97 | 98 | hex += tmpHex; 99 | 100 | } 101 | 102 | return hex; 103 | 104 | } 105 | 106 | // dummy functions for saveButton 107 | function set_save_button(visibility) { 108 | } 109 | 110 | function set_parent_button(visibility) { 111 | } 112 | 113 | function add_server_buttons() { 114 | } 115 | 116 | -------------------------------------------------------------------------------- /server/assets/css/diffview.css: -------------------------------------------------------------------------------- 1 | /*** 2 | This is part of jsdifflib v1.0. 3 | 4 | Copyright (c) 2007, Snowtide Informatics Systems, Inc. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the name of the Snowtide Informatics Systems nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | DAMAGE. 29 | ***/ 30 | /* Author: Chas Emerick */ 31 | table.diff { 32 | border-collapse:collapse; 33 | border:1px solid darkgray 34 | } 35 | table.diff tbody { 36 | font-family:Courier, monospace 37 | } 38 | table.diff tbody th { 39 | font-family:verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif; 40 | background:#EED; 41 | font-size:11px; 42 | font-weight:normal; 43 | border:1px solid #BBC; 44 | color:#886; 45 | padding:.3em .5em .1em 2em; 46 | text-align:right; 47 | vertical-align:top 48 | } 49 | table.diff thead { 50 | border-bottom:1px solid #BBC; 51 | background:#EFEFEF; 52 | font-family:Verdana 53 | } 54 | table.diff thead th.texttitle { 55 | text-align:left 56 | } 57 | table.diff tbody td { 58 | padding:0px .4em; 59 | padding-top:.4em; 60 | vertical-align:top; 61 | } 62 | table.diff .empty { 63 | background-color:#DDD; 64 | } 65 | table.diff .replace { 66 | background-color:#FD8 67 | } 68 | table.diff .delete { 69 | background-color:#E99; 70 | } 71 | table.diff .skip { 72 | background-color:#EFEFEF; 73 | border:1px solid #AAA; 74 | border-right:1px solid #BBC; 75 | } 76 | table.diff .insert { 77 | background-color:#9E9 78 | } 79 | table.diff th.author { 80 | text-align:right; 81 | border-top:1px solid #BBC; 82 | background:#EFEFEF 83 | } -------------------------------------------------------------------------------- /server/assets/gallery.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GLSL Sandbox Gallery 5 | 6 | 7 | 71 | 72 | 73 | 74 | 75 | 81 | 82 | 89 | 90 |
91 | <% if previous_page %> 92 | Previous page 93 | 94 | <% if next_page %> 95 |    96 | <% end %> 97 | 98 | <% end %> 99 | 100 | <% if next_page %> 101 | Next page 102 | <% end %> 103 |
104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /static/css/codemirror.css: -------------------------------------------------------------------------------- 1 | .CodeMirror { 2 | color: white; 3 | text-shadow: rgba( 0, 0, 0, 1 ) 0px 1px 2px; 4 | background-color: transparent; 5 | position: absolute; left: 25px; top: 75px; 6 | padding: 12px; 7 | border: solid 1px transparent; 8 | border-radius: 5px; 9 | line-height: 1.1em; 10 | font-family: monospace; 11 | font-size: 14px; 12 | font-weight: bold; 13 | visibility: visible; 14 | 15 | /* transition between transparent and semi-transparent black on hover */ 16 | transition: background-color 500ms; 17 | -webkit-transition: background-color 500ms; 18 | -o-transition: background-color 500ms; 19 | -moz-transition: background-color 500ms; 20 | -ms-transition: background-color 500ms; 21 | } 22 | 23 | .CodeMirror:hover { 24 | background-color:rgba(0,0,0,.5); 25 | border: solid 1px rgba(128,128,128,.4); 26 | } 27 | 28 | .CodeMirror-scroll { 29 | overflow: auto; 30 | height: 100%; 31 | /* This is needed to prevent an IE[67] bug where the scrolled content 32 | is visible outside of the scrolling box. */ 33 | position: relative; 34 | } 35 | 36 | .CodeMirror-gutter { 37 | position: absolute; left: 0; top: 0; 38 | z-index: 10; 39 | /* background-color: #f7f7f7; */ 40 | /* border-right: 1px solid black; */ 41 | min-width: 2em; 42 | height: 100%; 43 | } 44 | .CodeMirror-gutter-text { 45 | color: #aaa; 46 | text-align: right; 47 | padding: .4em .4em .4em .4em; 48 | white-space: pre !important; 49 | } 50 | .CodeMirror-lines { 51 | padding: .4em; 52 | } 53 | 54 | .CodeMirror pre { 55 | -moz-border-radius: 0; 56 | -webkit-border-radius: 0; 57 | -o-border-radius: 0; 58 | border-radius: 0; 59 | border-width: 0; margin: 0; padding: 0; background: transparent; 60 | font-family: inherit; 61 | font-size: inherit; 62 | padding: 0; margin: 0; 63 | white-space: pre; 64 | word-wrap: normal; 65 | } 66 | 67 | .CodeMirror-wrap pre { 68 | word-wrap: break-word; 69 | white-space: pre-wrap; 70 | } 71 | .CodeMirror-wrap .CodeMirror-scroll { 72 | overflow-x: hidden; 73 | } 74 | 75 | .CodeMirror textarea { 76 | font-family: inherit !important; 77 | font-size: inherit !important; 78 | } 79 | 80 | .CodeMirror-cursor { 81 | z-index: 10; 82 | position: absolute; 83 | visibility: hidden; 84 | border-left: 1px solid white !important; 85 | } 86 | .CodeMirror-focused .CodeMirror-cursor { 87 | visibility: visible; 88 | } 89 | 90 | span.CodeMirror-selected { 91 | background: #ccc !important; 92 | color: HighlightText !important; 93 | } 94 | .CodeMirror-focused span.CodeMirror-selected { 95 | background: Highlight !important; 96 | } 97 | 98 | .CodeMirror-matchingbracket {color: #0f0 !important;} 99 | .CodeMirror-nonmatchingbracket {color: #f22 !important;} 100 | 101 | .CodeMirror pre.errorMarker { 102 | color: #f00; 103 | font-weight: bold; 104 | background: rgba(200, 100, 0, 0.5); 105 | border-radius: 3px; 106 | } 107 | .CodeMirror:hover pre.errorLine { 108 | background: rgba(200, 50, 0, 0.2); 109 | } 110 | 111 | .CodeMirror .resizer { 112 | display: block; 113 | position: absolute; 114 | bottom: 3px; 115 | right: 3px; 116 | width: 11px; 117 | height: 11px; 118 | background-image: url('resizer.png'); 119 | background-repeat: no-repeat; 120 | cursor: se-resize; 121 | } -------------------------------------------------------------------------------- /server/assets/js/helpers.js: -------------------------------------------------------------------------------- 1 | 2 | var saveButton, forkButton, parentButton, diffButton; 3 | var effect_owner=false; 4 | var original_code=''; 5 | var original_version=''; 6 | 7 | function initialize_compressor(){ 8 | return null; 9 | } 10 | 11 | function initialize_helper() { 12 | window.onhashchange = function() { load_url_code(); }; 13 | 14 | if (typeof localStorage !== 'undefined') { 15 | if ( !localStorage.getItem('glslsandbox_user') ) { 16 | localStorage.setItem('glslsandbox_user', generate_user_id()); 17 | } 18 | } else { 19 | // This fallback shouldn't be used by any browsers that are able to commit code. 20 | localStorage = { getItem: function(x) { return 'invalid_user'; } }; 21 | } 22 | } 23 | 24 | function generate_user_id() { 25 | return (Math.random()*0x10000000|0).toString(16); 26 | } 27 | 28 | function get_user_id() { 29 | return localStorage.getItem('glslsandbox_user'); 30 | } 31 | 32 | function am_i_owner() { 33 | return (effect_owner && effect_owner==get_user_id()); 34 | } 35 | 36 | function load_url_code() { 37 | if ( window.location.hash!='') { 38 | 39 | load_code(window.location.hash.substr(1)); 40 | 41 | } else { 42 | 43 | code.setValue(document.getElementById( 'example' ).text); 44 | original_code = document.getElementById( 'example' ).text; 45 | 46 | } 47 | } 48 | 49 | function add_server_buttons() { 50 | saveButton = document.createElement( 'button' ); 51 | saveButton.style.visibility = 'hidden'; 52 | saveButton.textContent = 'save'; 53 | saveButton.addEventListener( 'click', save, false ); 54 | toolbar.appendChild( saveButton ); 55 | 56 | parentButton = document.createElement( 'a' ); 57 | parentButton.style.visibility = 'hidden'; 58 | parentButton.textContent = 'parent'; 59 | parentButton.href = original_version; 60 | toolbar.appendChild( parentButton ); 61 | 62 | diffButton = document.createElement( 'a' ); 63 | diffButton.style.visibility = 'hidden'; 64 | diffButton.textContent = 'diff'; 65 | diffButton.href = '/'; 66 | toolbar.appendChild( diffButton ); 67 | 68 | set_parent_button('visible'); 69 | } 70 | 71 | function set_save_button(visibility) { 72 | if(original_code==code.getValue()) 73 | saveButton.style.visibility = 'hidden'; 74 | else 75 | saveButton.style.visibility = visibility; 76 | } 77 | 78 | function set_parent_button(visibility) { 79 | if(original_version=='') { 80 | parentButton.style.visibility = 'hidden'; 81 | diffButton.style.visibility = 'hidden'; 82 | } else { 83 | parentButton.style.visibility = visibility; 84 | diffButton.style.visibility = visibility; 85 | } 86 | } 87 | 88 | 89 | function get_img( width, height ) { 90 | canvas.width = width; 91 | canvas.height = height; 92 | parameters.screenWidth = width; 93 | parameters.screenHeight = height; 94 | 95 | gl.viewport( 0, 0, width, height ); 96 | createRenderTargets(); 97 | resetSurface(); 98 | 99 | render(); 100 | 101 | img=canvas.toDataURL('image/png'); 102 | 103 | onWindowResize(); 104 | 105 | return img; 106 | } 107 | 108 | function save() { 109 | img=get_img(200, 100); 110 | 111 | data={ 112 | "code": code.getValue(), 113 | "image": img, 114 | "user": get_user_id() 115 | } 116 | 117 | loc='/e'; 118 | 119 | if(am_i_owner()) 120 | data["code_id"]=window.location.hash.substr(1); 121 | else { 122 | data["parent"]=window.location.hash.substr(1); 123 | } 124 | 125 | $.post(loc, 126 | JSON.stringify(data), 127 | function(result) { 128 | window.location.replace('/e#'+result); 129 | load_url_code(); 130 | }, "text"); 131 | } 132 | 133 | function load_code(hash) { 134 | if (gl) { 135 | compileButton.title = ''; 136 | compileButton.style.color = '#ffff00'; 137 | compileButton.textContent = 'Loading...'; 138 | } 139 | set_save_button('hidden'); 140 | set_parent_button('hidden'); 141 | 142 | $.getJSON('/item/'+hash, function(result) { 143 | compileOnChangeCode = false; // Prevent compile timer start 144 | code.setValue(result['code']); 145 | original_code=code.getValue(); 146 | 147 | if(result['parent']) { 148 | original_version=result['parent']; 149 | parentButton.href = original_version; 150 | diffButton.href = 'diff#' + original_version.substring(3) + '-vs-' + hash; 151 | set_parent_button('visible'); 152 | } else { 153 | original_version=''; 154 | parentButton.href = '/'; 155 | diffButton.href = '/'; 156 | set_parent_button('hidden'); 157 | } 158 | 159 | effect_owner=result['user']; 160 | 161 | if(am_i_owner()) 162 | saveButton.textContent = 'save'; 163 | else 164 | saveButton.textContent = 'fork'; 165 | 166 | resetSurface(); 167 | compile(); 168 | compileOnChangeCode = true; 169 | }); 170 | } 171 | 172 | // dummy functions 173 | 174 | function setURL(fragment) { 175 | } 176 | 177 | -------------------------------------------------------------------------------- /static/js/lzma.js: -------------------------------------------------------------------------------- 1 | /// This code is licensed under the MIT License. See LICENSE for more details. 2 | 3 | /// Does the environment support web workers? If not, let's fake it. 4 | if (!Worker) { 5 | ///NOTE: IE8 needs onmessage to be created first, IE9 cannot, IE7- do not care. 6 | /*@cc_on 7 | /// Is this IE8-? 8 | @if (@_jscript_version < 9) 9 | var onmessage = function () {}; 10 | @end 11 | @*/ 12 | 13 | /// If this were a regular function statement, IE9 would run it first and therefore make the Worker variable truthy because of hoisting. 14 | var Worker = function(script) { 15 | var global_var, 16 | return_object = {}; 17 | 18 | /// Determine the global variable (it's called "window" in browsers, "global" in Node.js). 19 | if (typeof window !== "undefined") { 20 | global_var = window; 21 | } else if (global) { 22 | global_var = global; 23 | } 24 | 25 | /// Is the environment is browser? 26 | /// If not, create a require() function, if it doesn't have one. 27 | if (global_var.document && !global_var.require) { 28 | global_var.require = function (path) { 29 | var script_tag = document.createElement("script"); 30 | script_tag.type ="text/javascript"; 31 | script_tag.src = path; 32 | document.getElementsByTagName('head')[0].appendChild(script_tag); 33 | }; 34 | } 35 | 36 | /// Dummy onmessage() function. 37 | return_object.onmessage = function () {}; 38 | 39 | /// This is the function that the main script calls to post a message to the "worker." 40 | return_object.postMessage = function (message) { 41 | /// Delay the call just in case the "worker" script has not had time to load. 42 | setTimeout(function () { 43 | /// Call the global onmessage() created by the "worker." 44 | ///NOTE: Wrap the message in an object. 45 | global_var.onmessage({data: message}); 46 | }, 10); 47 | }; 48 | 49 | /// Create a global postMessage() function for the "worker" to call. 50 | global_var.postMessage = function (e) { 51 | ///NOTE: Wrap the message in an object. 52 | ///TODO: Add more properties. 53 | return_object.onmessage({data: e, type: "message"}); 54 | }; 55 | 56 | require(script); 57 | 58 | return return_object; 59 | }; 60 | } 61 | 62 | 63 | ///NOTE: The "this" keyword is the global context ("window" variable) if loaded via a 9 | 10 | 11 | 110 | 111 | 225 | 226 | 227 |

GLSL Sandbox

228 |
Powered by jsdifflib
229 |

diff

230 |
231 | 232 | 233 |     234 | 235 | 236 |
237 |
Loading...
238 | 239 | 240 | -------------------------------------------------------------------------------- /static/js/glsl.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("glsl", function(config, parserConfig) { 2 | var indentUnit = config.indentUnit, 3 | keywords = parserConfig.keywords || {}, 4 | builtins = parserConfig.builtins || {}, 5 | blockKeywords = parserConfig.blockKeywords || {}, 6 | atoms = parserConfig.atoms || {}, 7 | hooks = parserConfig.hooks || {}, 8 | multiLineStrings = parserConfig.multiLineStrings; 9 | var isOperatorChar = /[+\-*&%=<>!?|\/]/; 10 | 11 | var curPunc; 12 | 13 | function tokenBase(stream, state) { 14 | var ch = stream.next(); 15 | if (hooks[ch]) { 16 | var result = hooks[ch](stream, state); 17 | if (result !== false) return result; 18 | } 19 | if (ch == '"' || ch == "'") { 20 | state.tokenize = tokenString(ch); 21 | return state.tokenize(stream, state); 22 | } 23 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 24 | curPunc = ch; 25 | return "bracket"; 26 | } 27 | if (/\d/.test(ch)) { 28 | stream.eatWhile(/[\w\.]/); 29 | return "number"; 30 | } 31 | if (ch == "/") { 32 | if (stream.eat("*")) { 33 | state.tokenize = tokenComment; 34 | return tokenComment(stream, state); 35 | } 36 | if (stream.eat("/")) { 37 | stream.skipToEnd(); 38 | return "comment"; 39 | } 40 | } 41 | if (isOperatorChar.test(ch)) { 42 | stream.eatWhile(isOperatorChar); 43 | return "operator"; 44 | } 45 | stream.eatWhile(/[\w\$_]/); 46 | var cur = stream.current(); 47 | if (keywords.propertyIsEnumerable(cur)) { 48 | if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; 49 | return "keyword"; 50 | } 51 | if (builtins.propertyIsEnumerable(cur)) { 52 | return "builtin"; 53 | } 54 | if (atoms.propertyIsEnumerable(cur)) return "atom"; 55 | return "word"; 56 | } 57 | 58 | function tokenString(quote) { 59 | return function(stream, state) { 60 | var escaped = false, next, end = false; 61 | while ((next = stream.next()) != null) { 62 | if (next == quote && !escaped) {end = true; break;} 63 | escaped = !escaped && next == "\\"; 64 | } 65 | if (end || !(escaped || multiLineStrings)) 66 | state.tokenize = tokenBase; 67 | return "string"; 68 | }; 69 | } 70 | 71 | function tokenComment(stream, state) { 72 | var maybeEnd = false, ch; 73 | while (ch = stream.next()) { 74 | if (ch == "/" && maybeEnd) { 75 | state.tokenize = tokenBase; 76 | break; 77 | } 78 | maybeEnd = (ch == "*"); 79 | } 80 | return "comment"; 81 | } 82 | 83 | function Context(indented, column, type, align, prev) { 84 | this.indented = indented; 85 | this.column = column; 86 | this.type = type; 87 | this.align = align; 88 | this.prev = prev; 89 | } 90 | function pushContext(state, col, type) { 91 | return state.context = new Context(state.indented, col, type, null, state.context); 92 | } 93 | function popContext(state) { 94 | var t = state.context.type; 95 | if (t == ")" || t == "]" || t == "}") 96 | state.indented = state.context.indented; 97 | return state.context = state.context.prev; 98 | } 99 | 100 | // Interface 101 | 102 | return { 103 | startState: function(basecolumn) { 104 | return { 105 | tokenize: null, 106 | context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), 107 | indented: 0, 108 | startOfLine: true 109 | }; 110 | }, 111 | 112 | token: function(stream, state) { 113 | var ctx = state.context; 114 | if (stream.sol()) { 115 | if (ctx.align == null) ctx.align = false; 116 | state.indented = stream.indentation(); 117 | state.startOfLine = true; 118 | } 119 | if (stream.eatSpace()) return null; 120 | curPunc = null; 121 | var style = (state.tokenize || tokenBase)(stream, state); 122 | if (style == "comment" || style == "meta") return style; 123 | if (ctx.align == null) ctx.align = true; 124 | 125 | if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); 126 | else if (curPunc == "{") pushContext(state, stream.column(), "}"); 127 | else if (curPunc == "[") pushContext(state, stream.column(), "]"); 128 | else if (curPunc == "(") pushContext(state, stream.column(), ")"); 129 | else if (curPunc == "}") { 130 | while (ctx.type == "statement") ctx = popContext(state); 131 | if (ctx.type == "}") ctx = popContext(state); 132 | while (ctx.type == "statement") ctx = popContext(state); 133 | } 134 | else if (curPunc == ctx.type) popContext(state); 135 | else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) 136 | pushContext(state, stream.column(), "statement"); 137 | state.startOfLine = false; 138 | return style; 139 | }, 140 | 141 | indent: function(state, textAfter) { 142 | if (state.tokenize != tokenBase && state.tokenize != null) return 0; 143 | var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type; 144 | if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit); 145 | else if (ctx.align) return ctx.column + (closing ? 0 : 1); 146 | else return ctx.indented + (closing ? 0 : indentUnit); 147 | }, 148 | 149 | electricChars: "{}" 150 | }; 151 | }); 152 | 153 | (function() { 154 | function words(str) { 155 | var obj = {}, words = str.split(" "); 156 | for (var i = 0; i < words.length; ++i) obj[words[i]] = true; 157 | return obj; 158 | } 159 | var glslKeywords = "attribute const uniform varying break continue " + 160 | "do for while if else in out inout float int void bool true false " + 161 | "lowp mediump highp precision invariant discard return mat2 mat3 " + 162 | "mat4 vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 sampler2D " + 163 | "samplerCube struct gl_FragCoord gl_FragColor"; 164 | var glslBuiltins = "radians degrees sin cos tan asin acos atan pow " + 165 | "exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod " + 166 | "min max clamp mix step smoothstep length distance dot cross " + 167 | "normalize faceforward reflect refract matrixCompMult lessThan " + 168 | "lessThanEqual greaterThan greaterThanEqual equal notEqual any all " + 169 | "not dFdx dFdy fwidth texture2D texture2DProj texture2DLod " + 170 | "texture2DProjLod textureCube textureCubeLod"; 171 | 172 | function cppHook(stream, state) { 173 | if (!state.startOfLine) return false; 174 | stream.skipToEnd(); 175 | return "meta"; 176 | } 177 | 178 | // C#-style strings where "" escapes a quote. 179 | function tokenAtString(stream, state) { 180 | var next; 181 | while ((next = stream.next()) != null) { 182 | if (next == '"' && !stream.eat('"')) { 183 | state.tokenize = null; 184 | break; 185 | } 186 | } 187 | return "string"; 188 | } 189 | 190 | CodeMirror.defineMIME("text/x-glsl", { 191 | name: "glsl", 192 | keywords: words(glslKeywords), 193 | builtins: words(glslBuiltins), 194 | blockKeywords: words("case do else for if switch while struct"), 195 | atoms: words("null"), 196 | hooks: {"#": cppHook} 197 | }); 198 | }()); 199 | -------------------------------------------------------------------------------- /server/assets/js/diffview.js: -------------------------------------------------------------------------------- 1 | /*** 2 | This is part of jsdifflib v1.0. 3 | 4 | Copyright (c) 2007, Snowtide Informatics Systems, Inc. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the name of the Snowtide Informatics Systems nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | DAMAGE. 29 | ***/ 30 | /* Author: Chas Emerick */ 31 | diffview = { 32 | /** 33 | * Builds and returns a visual diff view. The single parameter, `params', should contain 34 | * the following values: 35 | * 36 | * - baseTextLines: the array of strings that was used as the base text input to SequenceMatcher 37 | * - newTextLines: the array of strings that was used as the new text input to SequenceMatcher 38 | * - opcodes: the array of arrays returned by SequenceMatcher.get_opcodes() 39 | * - baseTextName: the title to be displayed above the base text listing in the diff view; defaults 40 | * to "Base Text" 41 | * - newTextName: the title to be displayed above the new text listing in the diff view; defaults 42 | * to "New Text" 43 | * - contextSize: the number of lines of context to show around differences; by default, all lines 44 | * are shown 45 | * - viewType: if 0, a side-by-side diff view is generated (default); if 1, an inline diff view is 46 | * generated 47 | */ 48 | buildView: function (params) { 49 | var baseTextLines = params.baseTextLines; 50 | var newTextLines = params.newTextLines; 51 | var opcodes = params.opcodes; 52 | var baseTextName = params.baseTextName ? params.baseTextName : "Base Text"; 53 | var newTextName = params.newTextName ? params.newTextName : "New Text"; 54 | var contextSize = params.contextSize; 55 | var inline = (params.viewType == 0 || params.viewType == 1) ? params.viewType : 0; 56 | 57 | if (baseTextLines == null) 58 | throw "Cannot build diff view; baseTextLines is not defined."; 59 | if (newTextLines == null) 60 | throw "Cannot build diff view; newTextLines is not defined."; 61 | if (!opcodes) 62 | throw "Canno build diff view; opcodes is not defined."; 63 | 64 | function celt (name, clazz) { 65 | var e = document.createElement(name); 66 | e.className = clazz; 67 | return e; 68 | } 69 | 70 | function telt (name, text) { 71 | var e = document.createElement(name); 72 | e.appendChild(document.createTextNode(text)); 73 | return e; 74 | } 75 | 76 | function ctelt (name, clazz, text) { 77 | var e = document.createElement(name); 78 | e.className = clazz; 79 | e.appendChild(document.createTextNode(text)); 80 | return e; 81 | } 82 | 83 | var tdata = document.createElement("thead"); 84 | var node = document.createElement("tr"); 85 | tdata.appendChild(node); 86 | if (inline) { 87 | node.appendChild(document.createElement("th")); 88 | node.appendChild(document.createElement("th")); 89 | node.appendChild(ctelt("th", "texttitle", baseTextName + " vs. " + newTextName)); 90 | } else { 91 | node.appendChild(document.createElement("th")); 92 | node.appendChild(ctelt("th", "texttitle", baseTextName)); 93 | node.appendChild(document.createElement("th")); 94 | node.appendChild(ctelt("th", "texttitle", newTextName)); 95 | } 96 | tdata = [tdata]; 97 | 98 | var rows = []; 99 | var node2; 100 | 101 | /** 102 | * Adds two cells to the given row; if the given row corresponds to a real 103 | * line number (based on the line index tidx and the endpoint of the 104 | * range in question tend), then the cells will contain the line number 105 | * and the line of text from textLines at position tidx (with the class of 106 | * the second cell set to the name of the change represented), and tidx + 1 will 107 | * be returned. Otherwise, tidx is returned, and two empty cells are added 108 | * to the given row. 109 | */ 110 | function addCells (row, tidx, tend, textLines, change) { 111 | if (tidx < tend) { 112 | row.appendChild(telt("th", (tidx + 1).toString())); 113 | row.appendChild(ctelt("td", change, textLines[tidx].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0"))); 114 | return tidx + 1; 115 | } else { 116 | row.appendChild(document.createElement("th")); 117 | row.appendChild(celt("td", "empty")); 118 | return tidx; 119 | } 120 | } 121 | 122 | function addCellsInline (row, tidx, tidx2, textLines, change) { 123 | row.appendChild(telt("th", tidx == null ? "" : (tidx + 1).toString())); 124 | row.appendChild(telt("th", tidx2 == null ? "" : (tidx2 + 1).toString())); 125 | row.appendChild(ctelt("td", change, textLines[tidx != null ? tidx : tidx2].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0"))); 126 | } 127 | 128 | for (var idx = 0; idx < opcodes.length; idx++) { 129 | code = opcodes[idx]; 130 | change = code[0]; 131 | var b = code[1]; 132 | var be = code[2]; 133 | var n = code[3]; 134 | var ne = code[4]; 135 | var rowcnt = Math.max(be - b, ne - n); 136 | var toprows = []; 137 | var botrows = []; 138 | for (var i = 0; i < rowcnt; i++) { 139 | // jump ahead if we've alredy provided leading context or if this is the first range 140 | if (contextSize && opcodes.length > 1 && ((idx > 0 && i == contextSize) || (idx == 0 && i == 0)) && change=="equal") { 141 | var jump = rowcnt - ((idx == 0 ? 1 : 2) * contextSize); 142 | if (jump > 1) { 143 | toprows.push(node = document.createElement("tr")); 144 | 145 | b += jump; 146 | n += jump; 147 | i += jump - 1; 148 | node.appendChild(telt("th", "...")); 149 | if (!inline) node.appendChild(ctelt("td", "skip", "")); 150 | node.appendChild(telt("th", "...")); 151 | node.appendChild(ctelt("td", "skip", "")); 152 | 153 | // skip last lines if they're all equal 154 | if (idx + 1 == opcodes.length) { 155 | break; 156 | } else { 157 | continue; 158 | } 159 | } 160 | } 161 | 162 | toprows.push(node = document.createElement("tr")); 163 | if (inline) { 164 | if (change == "insert") { 165 | addCellsInline(node, null, n++, newTextLines, change); 166 | } else if (change == "replace") { 167 | botrows.push(node2 = document.createElement("tr")); 168 | if (b < be) addCellsInline(node, b++, null, baseTextLines, "delete"); 169 | if (n < ne) addCellsInline(node2, null, n++, newTextLines, "insert"); 170 | } else if (change == "delete") { 171 | addCellsInline(node, b++, null, baseTextLines, change); 172 | } else { 173 | // equal 174 | addCellsInline(node, b++, n++, baseTextLines, change); 175 | } 176 | } else { 177 | b = addCells(node, b, be, baseTextLines, change); 178 | n = addCells(node, n, ne, newTextLines, change); 179 | } 180 | } 181 | 182 | for (var i = 0; i < toprows.length; i++) rows.push(toprows[i]); 183 | for (var i = 0; i < botrows.length; i++) rows.push(botrows[i]); 184 | } 185 | 186 | rows.push(node = ctelt("th", "author", "diff view generated by ")); 187 | node.setAttribute("colspan", inline ? 3 : 4); 188 | node.appendChild(node2 = telt("a", "jsdifflib")); 189 | node2.setAttribute("href", "https://github.com/cemerick/jsdifflib"); 190 | 191 | tdata.push(node = document.createElement("tbody")); 192 | for (var idx in rows) node.appendChild(rows[idx]); 193 | 194 | node = celt("table", "diff" + (inline ? " inlinediff" : "")); 195 | for (var idx in tdata) node.appendChild(tdata[idx]); 196 | return node; 197 | } 198 | } -------------------------------------------------------------------------------- /server/assets/js/difflib.js: -------------------------------------------------------------------------------- 1 | /*** 2 | This is part of jsdifflib v1.0. 3 | 4 | Copyright (c) 2007, Snowtide Informatics Systems, Inc. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the name of the Snowtide Informatics Systems nor the names of its 16 | contributors may be used to endorse or promote products derived from this 17 | software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | DAMAGE. 29 | ***/ 30 | /* Author: Chas Emerick */ 31 | __whitespace = {" ":true, "\t":true, "\n":true, "\f":true, "\r":true}; 32 | 33 | difflib = { 34 | defaultJunkFunction: function (c) { 35 | return c in __whitespace; 36 | }, 37 | 38 | stripLinebreaks: function (str) { return str.replace(/^[\n\r]*|[\n\r]*$/g, ""); }, 39 | 40 | stringAsLines: function (str) { 41 | var lfpos = str.indexOf("\n"); 42 | var crpos = str.indexOf("\r"); 43 | var linebreak = ((lfpos > -1 && crpos > -1) || crpos < 0) ? "\n" : "\r"; 44 | 45 | var lines = str.split(linebreak); 46 | for (var i = 0; i < lines.length; i++) { 47 | lines[i] = difflib.stripLinebreaks(lines[i]); 48 | } 49 | 50 | return lines; 51 | }, 52 | 53 | // iteration-based reduce implementation 54 | __reduce: function (func, list, initial) { 55 | if (initial != null) { 56 | var value = initial; 57 | var idx = 0; 58 | } else if (list) { 59 | var value = list[0]; 60 | var idx = 1; 61 | } else { 62 | return null; 63 | } 64 | 65 | for (; idx < list.length; idx++) { 66 | value = func(value, list[idx]); 67 | } 68 | 69 | return value; 70 | }, 71 | 72 | // comparison function for sorting lists of numeric tuples 73 | __ntuplecomp: function (a, b) { 74 | var mlen = Math.max(a.length, b.length); 75 | for (var i = 0; i < mlen; i++) { 76 | if (a[i] < b[i]) return -1; 77 | if (a[i] > b[i]) return 1; 78 | } 79 | 80 | return a.length == b.length ? 0 : (a.length < b.length ? -1 : 1); 81 | }, 82 | 83 | __calculate_ratio: function (matches, length) { 84 | return length ? 2.0 * matches / length : 1.0; 85 | }, 86 | 87 | // returns a function that returns true if a key passed to the returned function 88 | // is in the dict (js object) provided to this function; replaces being able to 89 | // carry around dict.has_key in python... 90 | __isindict: function (dict) { 91 | return function (key) { return key in dict; }; 92 | }, 93 | 94 | // replacement for python's dict.get function -- need easy default values 95 | __dictget: function (dict, key, defaultValue) { 96 | return key in dict ? dict[key] : defaultValue; 97 | }, 98 | 99 | SequenceMatcher: function (a, b, isjunk) { 100 | this.set_seqs = function (a, b) { 101 | this.set_seq1(a); 102 | this.set_seq2(b); 103 | } 104 | 105 | this.set_seq1 = function (a) { 106 | if (a == this.a) return; 107 | this.a = a; 108 | this.matching_blocks = this.opcodes = null; 109 | } 110 | 111 | this.set_seq2 = function (b) { 112 | if (b == this.b) return; 113 | this.b = b; 114 | this.matching_blocks = this.opcodes = this.fullbcount = null; 115 | this.__chain_b(); 116 | } 117 | 118 | this.__chain_b = function () { 119 | var b = this.b; 120 | var n = b.length; 121 | var b2j = this.b2j = {}; 122 | var populardict = {}; 123 | for (var i = 0; i < b.length; i++) { 124 | var elt = b[i]; 125 | if (elt in b2j) { 126 | var indices = b2j[elt]; 127 | if (n >= 200 && indices.length * 100 > n) { 128 | populardict[elt] = 1; 129 | delete b2j[elt]; 130 | } else { 131 | indices.push(i); 132 | } 133 | } else { 134 | b2j[elt] = [i]; 135 | } 136 | } 137 | 138 | for (var elt in populardict) 139 | delete b2j[elt]; 140 | 141 | var isjunk = this.isjunk; 142 | var junkdict = {}; 143 | if (isjunk) { 144 | for (var elt in populardict) { 145 | if (isjunk(elt)) { 146 | junkdict[elt] = 1; 147 | delete populardict[elt]; 148 | } 149 | } 150 | for (var elt in b2j) { 151 | if (isjunk(elt)) { 152 | junkdict[elt] = 1; 153 | delete b2j[elt]; 154 | } 155 | } 156 | } 157 | 158 | this.isbjunk = difflib.__isindict(junkdict); 159 | this.isbpopular = difflib.__isindict(populardict); 160 | } 161 | 162 | this.find_longest_match = function (alo, ahi, blo, bhi) { 163 | var a = this.a; 164 | var b = this.b; 165 | var b2j = this.b2j; 166 | var isbjunk = this.isbjunk; 167 | var besti = alo; 168 | var bestj = blo; 169 | var bestsize = 0; 170 | var j = null; 171 | 172 | var j2len = {}; 173 | var nothing = []; 174 | for (var i = alo; i < ahi; i++) { 175 | var newj2len = {}; 176 | var jdict = difflib.__dictget(b2j, a[i], nothing); 177 | for (var jkey in jdict) { 178 | j = jdict[jkey]; 179 | if (j < blo) continue; 180 | if (j >= bhi) break; 181 | newj2len[j] = k = difflib.__dictget(j2len, j - 1, 0) + 1; 182 | if (k > bestsize) { 183 | besti = i - k + 1; 184 | bestj = j - k + 1; 185 | bestsize = k; 186 | } 187 | } 188 | j2len = newj2len; 189 | } 190 | 191 | while (besti > alo && bestj > blo && !isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { 192 | besti--; 193 | bestj--; 194 | bestsize++; 195 | } 196 | 197 | while (besti + bestsize < ahi && bestj + bestsize < bhi && 198 | !isbjunk(b[bestj + bestsize]) && 199 | a[besti + bestsize] == b[bestj + bestsize]) { 200 | bestsize++; 201 | } 202 | 203 | while (besti > alo && bestj > blo && isbjunk(b[bestj - 1]) && a[besti - 1] == b[bestj - 1]) { 204 | besti--; 205 | bestj--; 206 | bestsize++; 207 | } 208 | 209 | while (besti + bestsize < ahi && bestj + bestsize < bhi && isbjunk(b[bestj + bestsize]) && 210 | a[besti + bestsize] == b[bestj + bestsize]) { 211 | bestsize++; 212 | } 213 | 214 | return [besti, bestj, bestsize]; 215 | } 216 | 217 | this.get_matching_blocks = function () { 218 | if (this.matching_blocks != null) return this.matching_blocks; 219 | var la = this.a.length; 220 | var lb = this.b.length; 221 | 222 | var queue = [[0, la, 0, lb]]; 223 | var matching_blocks = []; 224 | var alo, ahi, blo, bhi, qi, i, j, k, x; 225 | while (queue.length) { 226 | qi = queue.pop(); 227 | alo = qi[0]; 228 | ahi = qi[1]; 229 | blo = qi[2]; 230 | bhi = qi[3]; 231 | x = this.find_longest_match(alo, ahi, blo, bhi); 232 | i = x[0]; 233 | j = x[1]; 234 | k = x[2]; 235 | 236 | if (k) { 237 | matching_blocks.push(x); 238 | if (alo < i && blo < j) 239 | queue.push([alo, i, blo, j]); 240 | if (i+k < ahi && j+k < bhi) 241 | queue.push([i + k, ahi, j + k, bhi]); 242 | } 243 | } 244 | 245 | matching_blocks.sort(difflib.__ntuplecomp); 246 | 247 | var i1 = j1 = k1 = block = 0; 248 | var non_adjacent = []; 249 | for (var idx in matching_blocks) { 250 | block = matching_blocks[idx]; 251 | i2 = block[0]; 252 | j2 = block[1]; 253 | k2 = block[2]; 254 | if (i1 + k1 == i2 && j1 + k1 == j2) { 255 | k1 += k2; 256 | } else { 257 | if (k1) non_adjacent.push([i1, j1, k1]); 258 | i1 = i2; 259 | j1 = j2; 260 | k1 = k2; 261 | } 262 | } 263 | 264 | if (k1) non_adjacent.push([i1, j1, k1]); 265 | 266 | non_adjacent.push([la, lb, 0]); 267 | this.matching_blocks = non_adjacent; 268 | return this.matching_blocks; 269 | } 270 | 271 | this.get_opcodes = function () { 272 | if (this.opcodes != null) return this.opcodes; 273 | var i = 0; 274 | var j = 0; 275 | var answer = []; 276 | this.opcodes = answer; 277 | var block, ai, bj, size, tag; 278 | var blocks = this.get_matching_blocks(); 279 | for (var idx in blocks) { 280 | block = blocks[idx]; 281 | ai = block[0]; 282 | bj = block[1]; 283 | size = block[2]; 284 | tag = ''; 285 | if (i < ai && j < bj) { 286 | tag = 'replace'; 287 | } else if (i < ai) { 288 | tag = 'delete'; 289 | } else if (j < bj) { 290 | tag = 'insert'; 291 | } 292 | if (tag) answer.push([tag, i, ai, j, bj]); 293 | i = ai + size; 294 | j = bj + size; 295 | 296 | if (size) answer.push(['equal', ai, i, bj, j]); 297 | } 298 | 299 | return answer; 300 | } 301 | 302 | // this is a generator function in the python lib, which of course is not supported in javascript 303 | // the reimplementation builds up the grouped opcodes into a list in their entirety and returns that. 304 | this.get_grouped_opcodes = function (n) { 305 | if (!n) n = 3; 306 | var codes = this.get_opcodes(); 307 | if (!codes) codes = [["equal", 0, 1, 0, 1]]; 308 | var code, tag, i1, i2, j1, j2; 309 | if (codes[0][0] == 'equal') { 310 | code = codes[0]; 311 | tag = code[0]; 312 | i1 = code[1]; 313 | i2 = code[2]; 314 | j1 = code[3]; 315 | j2 = code[4]; 316 | codes[0] = [tag, Math.max(i1, i2 - n), i2, Math.max(j1, j2 - n), j2]; 317 | } 318 | if (codes[codes.length - 1][0] == 'equal') { 319 | code = codes[codes.length - 1]; 320 | tag = code[0]; 321 | i1 = code[1]; 322 | i2 = code[2]; 323 | j1 = code[3]; 324 | j2 = code[4]; 325 | codes[codes.length - 1] = [tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]; 326 | } 327 | 328 | var nn = n + n; 329 | var groups = []; 330 | for (var idx in codes) { 331 | code = codes[idx]; 332 | tag = code[0]; 333 | i1 = code[1]; 334 | i2 = code[2]; 335 | j1 = code[3]; 336 | j2 = code[4]; 337 | if (tag == 'equal' && i2 - i1 > nn) { 338 | groups.push([tag, i1, Math.min(i2, i1 + n), j1, Math.min(j2, j1 + n)]); 339 | i1 = Math.max(i1, i2-n); 340 | j1 = Math.max(j1, j2-n); 341 | } 342 | 343 | groups.push([tag, i1, i2, j1, j2]); 344 | } 345 | 346 | if (groups && groups[groups.length - 1][0] == 'equal') groups.pop(); 347 | 348 | return groups; 349 | } 350 | 351 | this.ratio = function () { 352 | matches = difflib.__reduce( 353 | function (sum, triple) { return sum + triple[triple.length - 1]; }, 354 | this.get_matching_blocks(), 0); 355 | return difflib.__calculate_ratio(matches, this.a.length + this.b.length); 356 | } 357 | 358 | this.quick_ratio = function () { 359 | var fullbcount, elt; 360 | if (this.fullbcount == null) { 361 | this.fullbcount = fullbcount = {}; 362 | for (var i = 0; i < this.b.length; i++) { 363 | elt = this.b[i]; 364 | fullbcount[elt] = difflib.__dictget(fullbcount, elt, 0) + 1; 365 | } 366 | } 367 | fullbcount = this.fullbcount; 368 | 369 | var avail = {}; 370 | var availhas = difflib.__isindict(avail); 371 | var matches = numb = 0; 372 | for (var i = 0; i < this.a.length; i++) { 373 | elt = this.a[i]; 374 | if (availhas(elt)) { 375 | numb = avail[elt]; 376 | } else { 377 | numb = difflib.__dictget(fullbcount, elt, 0); 378 | } 379 | avail[elt] = numb - 1; 380 | if (numb > 0) matches++; 381 | } 382 | 383 | return difflib.__calculate_ratio(matches, this.a.length + this.b.length); 384 | } 385 | 386 | this.real_quick_ratio = function () { 387 | var la = this.a.length; 388 | var lb = this.b.length; 389 | return _calculate_ratio(Math.min(la, lb), la + lb); 390 | } 391 | 392 | this.isjunk = isjunk ? isjunk : difflib.defaultJunkFunction; 393 | this.a = this.b = null; 394 | this.set_seqs(a, b); 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GLSL Sandbox 5 | 6 | 7 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 87 | 88 | 105 | 106 | 117 | 118 | 132 | 133 | 931 | 932 | 933 | 934 | -------------------------------------------------------------------------------- /server/assets/js/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.7 jquery.com | jquery.org/license */ 2 | (function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"":"")+""),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="
"+""+"
";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&& 3 | (b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after" 4 | ,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); --------------------------------------------------------------------------------