gollum 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/README.md +44 -7
- data/Rakefile +1 -1
- data/bin/gollum +20 -1
- data/gollum.gemspec +400 -5
- data/lib/gollum.rb +2 -1
- data/lib/gollum/blob_entry.rb +13 -1
- data/lib/gollum/committer.rb +10 -1
- data/lib/gollum/file.rb +15 -2
- data/lib/gollum/file_view.rb +145 -0
- data/lib/gollum/frontend/app.rb +217 -69
- data/lib/gollum/frontend/helpers.rb +21 -0
- data/lib/gollum/frontend/public/gollum/css/_styles.css +121 -0
- data/lib/gollum/frontend/public/gollum/css/editor.css +17 -8
- data/lib/gollum/frontend/public/gollum/css/gollum.css +440 -402
- data/lib/gollum/frontend/public/gollum/css/template.css +540 -289
- data/lib/gollum/frontend/public/gollum/images/dirty-shade.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/document.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/para.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-16.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-20.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-24.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-32.png +0 -0
- data/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +31 -7
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +18 -6
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +3 -0
- data/lib/gollum/frontend/public/gollum/javascript/gollum.js +78 -16
- data/lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js +4 -0
- data/lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js +8 -0
- data/lib/gollum/frontend/public/gollum/livepreview/css/custom.css +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/save_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/index.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +254 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +184 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +261 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +460 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +124 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +327 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +617 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +314 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +2419 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +252 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +276 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +759 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +981 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +2163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +231 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +562 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +536 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +367 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +143 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +257 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +315 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +556 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +611 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +134 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +49 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +187 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +214 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +595 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +106 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +292 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +1059 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +317 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +62 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +180 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +235 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +739 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +2756 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +603 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +342 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +154 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +227 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +135 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +110 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +9014 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +242 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +75 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +127 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +95 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +76 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +115 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +169 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +262 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +24 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +183 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +471 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js +346 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +111 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +53 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +57 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +38 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +279 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +220 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +91 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +436 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +355 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +583 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +1165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +147 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +194 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +179 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +304 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +89 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +82 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +120 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +6 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +1686 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +2993 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +69 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +10363 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +42525 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +6177 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +55 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +64 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +354 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +762 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +696 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +598 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +2072 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +278 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +581 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +230 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +198 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +398 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +451 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +886 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +472 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +411 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +136 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +313 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js +529 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js +13 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js +10 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +204 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +118 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +151 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +149 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +45 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +102 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +48 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +133 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +137 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +146 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +150 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +131 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +130 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +47 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +160 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +141 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +219 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +1402 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +4469 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +6396 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +43 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +176 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js +2 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +456 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js +35 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/sundown.js +1 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +476 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt +9 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt +21 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt +20 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt +359 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt +4 -0
- data/lib/gollum/frontend/public/gollum/livepreview/readme.md +44 -0
- data/lib/gollum/frontend/templates/compare.mustache +9 -9
- data/lib/gollum/frontend/templates/create.mustache +4 -1
- data/lib/gollum/frontend/templates/edit.mustache +6 -3
- data/lib/gollum/frontend/templates/editor.mustache +30 -14
- data/lib/gollum/frontend/templates/file_view.mustache +32 -0
- data/lib/gollum/frontend/templates/history.mustache +8 -8
- data/lib/gollum/frontend/templates/layout.mustache +21 -14
- data/lib/gollum/frontend/templates/page.mustache +37 -14
- data/lib/gollum/frontend/templates/pages.mustache +14 -10
- data/lib/gollum/frontend/templates/search.mustache +2 -2
- data/lib/gollum/frontend/templates/searchbar.mustache +1 -1
- data/lib/gollum/frontend/uri_encode_component.rb +172 -0
- data/lib/gollum/frontend/views/compare.rb +2 -4
- data/lib/gollum/frontend/views/create.rb +5 -0
- data/lib/gollum/frontend/views/edit.rb +12 -0
- data/lib/gollum/frontend/views/file_view.rb +19 -0
- data/lib/gollum/frontend/views/has_page.rb +15 -0
- data/lib/gollum/frontend/views/history.rb +8 -4
- data/lib/gollum/frontend/views/layout.rb +9 -1
- data/lib/gollum/frontend/views/page.rb +37 -10
- data/lib/gollum/frontend/views/pages.rb +48 -0
- data/lib/gollum/git_access.rb +2 -2
- data/lib/gollum/markup.rb +115 -19
- data/lib/gollum/page.rb +79 -9
- data/lib/gollum/tex.rb +319 -42
- data/lib/gollum/wiki.rb +92 -12
- data/licenses/css_tree_menu_thecssninja/license.txt +50 -0
- data/licenses/licenses.txt +23 -0
- data/licenses/unity_asset_pool/COPYRIGHT +286 -0
- data/test/examples/lotr.git/config +1 -1
- data/test/examples/lotr.git/logs/HEAD +4 -0
- data/test/examples/lotr.git/logs/refs/heads/master +4 -0
- data/test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e +0 -0
- data/test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0 +0 -0
- data/test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6 +0 -0
- data/test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee +0 -0
- data/test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1 +0 -0
- data/test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087 +0 -0
- data/test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5 +2 -0
- data/test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15 +0 -0
- data/test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2 +1 -0
- data/test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71 +0 -0
- data/test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b +0 -0
- data/test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979 +0 -0
- data/test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809 +0 -0
- data/test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6 +0 -0
- data/test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c +0 -0
- data/test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd +0 -0
- data/test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c +0 -0
- data/test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614 +0 -0
- data/test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd +2 -0
- data/test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966 +0 -0
- data/test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df +1 -0
- data/test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634 +0 -0
- data/test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66 +0 -0
- data/test/examples/lotr.git/refs/heads/master +1 -1
- data/test/examples/revert.git/COMMIT_EDITMSG +1 -1
- data/test/examples/revert.git/index +0 -0
- data/test/examples/revert.git/logs/HEAD +1 -0
- data/test/examples/revert.git/logs/refs/heads/master +1 -0
- data/test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab +0 -0
- data/test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa +0 -0
- data/test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023 +3 -0
- data/test/examples/revert.git/refs/heads/master +1 -1
- data/test/file_view/1_file.txt +3 -0
- data/test/file_view/1_file_1_folder.txt +8 -0
- data/test/file_view/1_folder.txt +8 -0
- data/test/file_view/2_files_2_folders.txt +12 -0
- data/test/file_view/2_files_2_folders_1_root.txt +13 -0
- data/test/file_view/nested_folders.txt +28 -0
- data/test/test_app.rb +162 -12
- data/test/test_app_helpers.rb +13 -0
- data/test/test_committer.rb +1 -1
- data/test/test_file_view.rb +102 -0
- data/test/test_git_access.rb +3 -2
- data/test/test_markup.rb +45 -12
- data/test/test_page.rb +65 -1
- data/test/test_page_revert.rb +14 -2
- data/test/test_pages_view.rb +37 -0
- data/test/test_unicode.rb +110 -0
- data/test/test_wiki.rb +51 -4
- metadata +658 -239
- data/lib/gollum/frontend/public/gollum/javascript/jquery.js +0 -7179
@@ -0,0 +1,1059 @@
|
|
1
|
+
// vim: ts=4 sts=4 sw=4 expandtab
|
2
|
+
// -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
|
3
|
+
// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
|
4
|
+
// -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
|
5
|
+
// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
|
6
|
+
// -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
|
7
|
+
// -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
|
8
|
+
// -- kossnocorp Sasha Koss XXX TODO License or CLA
|
9
|
+
// -- bryanforbes Bryan Forbes XXX TODO License or CLA
|
10
|
+
// -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence
|
11
|
+
// -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License
|
12
|
+
// -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
|
13
|
+
// -- bbqsrc Brendan Molloy (C) 2011 Creative Commons Zero (public domain)
|
14
|
+
// -- iwyg XXX TODO License or CLA
|
15
|
+
// -- DomenicDenicola Domenic Denicola Copyright (C) 2011 MIT License
|
16
|
+
// -- xavierm02 Montillet Xavier XXX TODO License or CLA
|
17
|
+
// -- Raynos Raynos XXX TODO License or CLA
|
18
|
+
// -- samsonjs Sami Samhuri Copyright (C) 2010 MIT License
|
19
|
+
// -- rwldrn Rick Waldron Copyright (C) 2011 MIT License
|
20
|
+
// -- lexer Alexey Zakharov XXX TODO License or CLA
|
21
|
+
|
22
|
+
/*!
|
23
|
+
Copyright (c) 2009, 280 North Inc. http://280north.com/
|
24
|
+
MIT License. http://github.com/280north/narwhal/blob/master/README.md
|
25
|
+
*/
|
26
|
+
|
27
|
+
define(function(require, exports, module) {
|
28
|
+
|
29
|
+
/*
|
30
|
+
* Brings an environment as close to ECMAScript 5 compliance
|
31
|
+
* as is possible with the facilities of erstwhile engines.
|
32
|
+
*
|
33
|
+
* Annotated ES5: http://es5.github.com/ (specific links below)
|
34
|
+
* ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
|
35
|
+
*
|
36
|
+
* @module
|
37
|
+
*/
|
38
|
+
|
39
|
+
/*whatsupdoc*/
|
40
|
+
|
41
|
+
//
|
42
|
+
// Function
|
43
|
+
// ========
|
44
|
+
//
|
45
|
+
|
46
|
+
// ES-5 15.3.4.5
|
47
|
+
// http://es5.github.com/#x15.3.4.5
|
48
|
+
|
49
|
+
if (!Function.prototype.bind) {
|
50
|
+
Function.prototype.bind = function bind(that) { // .length is 1
|
51
|
+
// 1. Let Target be the this value.
|
52
|
+
var target = this;
|
53
|
+
// 2. If IsCallable(Target) is false, throw a TypeError exception.
|
54
|
+
if (typeof target != "function")
|
55
|
+
throw new TypeError(); // TODO message
|
56
|
+
// 3. Let A be a new (possibly empty) internal list of all of the
|
57
|
+
// argument values provided after thisArg (arg1, arg2 etc), in order.
|
58
|
+
// XXX slicedArgs will stand in for "A" if used
|
59
|
+
var args = slice.call(arguments, 1); // for normal call
|
60
|
+
// 4. Let F be a new native ECMAScript object.
|
61
|
+
// 11. Set the [[Prototype]] internal property of F to the standard
|
62
|
+
// built-in Function prototype object as specified in 15.3.3.1.
|
63
|
+
// 12. Set the [[Call]] internal property of F as described in
|
64
|
+
// 15.3.4.5.1.
|
65
|
+
// 13. Set the [[Construct]] internal property of F as described in
|
66
|
+
// 15.3.4.5.2.
|
67
|
+
// 14. Set the [[HasInstance]] internal property of F as described in
|
68
|
+
// 15.3.4.5.3.
|
69
|
+
var bound = function () {
|
70
|
+
|
71
|
+
if (this instanceof bound) {
|
72
|
+
// 15.3.4.5.2 [[Construct]]
|
73
|
+
// When the [[Construct]] internal method of a function object,
|
74
|
+
// F that was created using the bind function is called with a
|
75
|
+
// list of arguments ExtraArgs, the following steps are taken:
|
76
|
+
// 1. Let target be the value of F's [[TargetFunction]]
|
77
|
+
// internal property.
|
78
|
+
// 2. If target has no [[Construct]] internal method, a
|
79
|
+
// TypeError exception is thrown.
|
80
|
+
// 3. Let boundArgs be the value of F's [[BoundArgs]] internal
|
81
|
+
// property.
|
82
|
+
// 4. Let args be a new list containing the same values as the
|
83
|
+
// list boundArgs in the same order followed by the same
|
84
|
+
// values as the list ExtraArgs in the same order.
|
85
|
+
// 5. Return the result of calling the [[Construct]] internal
|
86
|
+
// method of target providing args as the arguments.
|
87
|
+
|
88
|
+
var F = function(){};
|
89
|
+
F.prototype = target.prototype;
|
90
|
+
var self = new F;
|
91
|
+
|
92
|
+
var result = target.apply(
|
93
|
+
self,
|
94
|
+
args.concat(slice.call(arguments))
|
95
|
+
);
|
96
|
+
if (result !== null && Object(result) === result)
|
97
|
+
return result;
|
98
|
+
return self;
|
99
|
+
|
100
|
+
} else {
|
101
|
+
// 15.3.4.5.1 [[Call]]
|
102
|
+
// When the [[Call]] internal method of a function object, F,
|
103
|
+
// which was created using the bind function is called with a
|
104
|
+
// this value and a list of arguments ExtraArgs, the following
|
105
|
+
// steps are taken:
|
106
|
+
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
|
107
|
+
// property.
|
108
|
+
// 2. Let boundThis be the value of F's [[BoundThis]] internal
|
109
|
+
// property.
|
110
|
+
// 3. Let target be the value of F's [[TargetFunction]] internal
|
111
|
+
// property.
|
112
|
+
// 4. Let args be a new list containing the same values as the
|
113
|
+
// list boundArgs in the same order followed by the same
|
114
|
+
// values as the list ExtraArgs in the same order.
|
115
|
+
// 5. Return the result of calling the [[Call]] internal method
|
116
|
+
// of target providing boundThis as the this value and
|
117
|
+
// providing args as the arguments.
|
118
|
+
|
119
|
+
// equiv: target.call(this, ...boundArgs, ...args)
|
120
|
+
return target.apply(
|
121
|
+
that,
|
122
|
+
args.concat(slice.call(arguments))
|
123
|
+
);
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
};
|
128
|
+
// XXX bound.length is never writable, so don't even try
|
129
|
+
//
|
130
|
+
// 15. If the [[Class]] internal property of Target is "Function", then
|
131
|
+
// a. Let L be the length property of Target minus the length of A.
|
132
|
+
// b. Set the length own property of F to either 0 or L, whichever is
|
133
|
+
// larger.
|
134
|
+
// 16. Else set the length own property of F to 0.
|
135
|
+
// 17. Set the attributes of the length own property of F to the values
|
136
|
+
// specified in 15.3.5.1.
|
137
|
+
|
138
|
+
// TODO
|
139
|
+
// 18. Set the [[Extensible]] internal property of F to true.
|
140
|
+
|
141
|
+
// TODO
|
142
|
+
// 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
|
143
|
+
// 20. Call the [[DefineOwnProperty]] internal method of F with
|
144
|
+
// arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
|
145
|
+
// thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
|
146
|
+
// false.
|
147
|
+
// 21. Call the [[DefineOwnProperty]] internal method of F with
|
148
|
+
// arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
|
149
|
+
// [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
|
150
|
+
// and false.
|
151
|
+
|
152
|
+
// TODO
|
153
|
+
// NOTE Function objects created using Function.prototype.bind do not
|
154
|
+
// have a prototype property or the [[Code]], [[FormalParameters]], and
|
155
|
+
// [[Scope]] internal properties.
|
156
|
+
// XXX can't delete prototype in pure-js.
|
157
|
+
|
158
|
+
// 22. Return F.
|
159
|
+
return bound;
|
160
|
+
};
|
161
|
+
}
|
162
|
+
|
163
|
+
// Shortcut to an often accessed properties, in order to avoid multiple
|
164
|
+
// dereference that costs universally.
|
165
|
+
// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
|
166
|
+
// us it in defining shortcuts.
|
167
|
+
var call = Function.prototype.call;
|
168
|
+
var prototypeOfArray = Array.prototype;
|
169
|
+
var prototypeOfObject = Object.prototype;
|
170
|
+
var slice = prototypeOfArray.slice;
|
171
|
+
var toString = call.bind(prototypeOfObject.toString);
|
172
|
+
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
173
|
+
|
174
|
+
// If JS engine supports accessors creating shortcuts.
|
175
|
+
var defineGetter;
|
176
|
+
var defineSetter;
|
177
|
+
var lookupGetter;
|
178
|
+
var lookupSetter;
|
179
|
+
var supportsAccessors;
|
180
|
+
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
181
|
+
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
182
|
+
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
183
|
+
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
184
|
+
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
185
|
+
}
|
186
|
+
|
187
|
+
//
|
188
|
+
// Array
|
189
|
+
// =====
|
190
|
+
//
|
191
|
+
|
192
|
+
// ES5 15.4.3.2
|
193
|
+
// http://es5.github.com/#x15.4.3.2
|
194
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
|
195
|
+
if (!Array.isArray) {
|
196
|
+
Array.isArray = function isArray(obj) {
|
197
|
+
return toString(obj) == "[object Array]";
|
198
|
+
};
|
199
|
+
}
|
200
|
+
|
201
|
+
// The IsCallable() check in the Array functions
|
202
|
+
// has been replaced with a strict check on the
|
203
|
+
// internal class of the object to trap cases where
|
204
|
+
// the provided function was actually a regular
|
205
|
+
// expression literal, which in V8 and
|
206
|
+
// JavaScriptCore is a typeof "function". Only in
|
207
|
+
// V8 are regular expression literals permitted as
|
208
|
+
// reduce parameters, so it is desirable in the
|
209
|
+
// general case for the shim to match the more
|
210
|
+
// strict and common behavior of rejecting regular
|
211
|
+
// expressions.
|
212
|
+
|
213
|
+
// ES5 15.4.4.18
|
214
|
+
// http://es5.github.com/#x15.4.4.18
|
215
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
|
216
|
+
if (!Array.prototype.forEach) {
|
217
|
+
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
|
218
|
+
var self = toObject(this),
|
219
|
+
thisp = arguments[1],
|
220
|
+
i = 0,
|
221
|
+
length = self.length >>> 0;
|
222
|
+
|
223
|
+
// If no callback function or if callback is not a callable function
|
224
|
+
if (toString(fun) != "[object Function]") {
|
225
|
+
throw new TypeError(); // TODO message
|
226
|
+
}
|
227
|
+
|
228
|
+
while (i < length) {
|
229
|
+
if (i in self) {
|
230
|
+
// Invoke the callback function with call, passing arguments:
|
231
|
+
// context, property value, property key, thisArg object context
|
232
|
+
fun.call(thisp, self[i], i, self);
|
233
|
+
}
|
234
|
+
i++;
|
235
|
+
}
|
236
|
+
};
|
237
|
+
}
|
238
|
+
|
239
|
+
// ES5 15.4.4.19
|
240
|
+
// http://es5.github.com/#x15.4.4.19
|
241
|
+
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
|
242
|
+
if (!Array.prototype.map) {
|
243
|
+
Array.prototype.map = function map(fun /*, thisp*/) {
|
244
|
+
var self = toObject(this),
|
245
|
+
length = self.length >>> 0,
|
246
|
+
result = Array(length),
|
247
|
+
thisp = arguments[1];
|
248
|
+
|
249
|
+
// If no callback function or if callback is not a callable function
|
250
|
+
if (toString(fun) != "[object Function]") {
|
251
|
+
throw new TypeError(); // TODO message
|
252
|
+
}
|
253
|
+
|
254
|
+
for (var i = 0; i < length; i++) {
|
255
|
+
if (i in self)
|
256
|
+
result[i] = fun.call(thisp, self[i], i, self);
|
257
|
+
}
|
258
|
+
return result;
|
259
|
+
};
|
260
|
+
}
|
261
|
+
|
262
|
+
// ES5 15.4.4.20
|
263
|
+
// http://es5.github.com/#x15.4.4.20
|
264
|
+
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
|
265
|
+
if (!Array.prototype.filter) {
|
266
|
+
Array.prototype.filter = function filter(fun /*, thisp */) {
|
267
|
+
var self = toObject(this),
|
268
|
+
length = self.length >>> 0,
|
269
|
+
result = [],
|
270
|
+
thisp = arguments[1];
|
271
|
+
|
272
|
+
// If no callback function or if callback is not a callable function
|
273
|
+
if (toString(fun) != "[object Function]") {
|
274
|
+
throw new TypeError(); // TODO message
|
275
|
+
}
|
276
|
+
|
277
|
+
for (var i = 0; i < length; i++) {
|
278
|
+
if (i in self && fun.call(thisp, self[i], i, self))
|
279
|
+
result.push(self[i]);
|
280
|
+
}
|
281
|
+
return result;
|
282
|
+
};
|
283
|
+
}
|
284
|
+
|
285
|
+
// ES5 15.4.4.16
|
286
|
+
// http://es5.github.com/#x15.4.4.16
|
287
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
|
288
|
+
if (!Array.prototype.every) {
|
289
|
+
Array.prototype.every = function every(fun /*, thisp */) {
|
290
|
+
var self = toObject(this),
|
291
|
+
length = self.length >>> 0,
|
292
|
+
thisp = arguments[1];
|
293
|
+
|
294
|
+
// If no callback function or if callback is not a callable function
|
295
|
+
if (toString(fun) != "[object Function]") {
|
296
|
+
throw new TypeError(); // TODO message
|
297
|
+
}
|
298
|
+
|
299
|
+
for (var i = 0; i < length; i++) {
|
300
|
+
if (i in self && !fun.call(thisp, self[i], i, self))
|
301
|
+
return false;
|
302
|
+
}
|
303
|
+
return true;
|
304
|
+
};
|
305
|
+
}
|
306
|
+
|
307
|
+
// ES5 15.4.4.17
|
308
|
+
// http://es5.github.com/#x15.4.4.17
|
309
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
|
310
|
+
if (!Array.prototype.some) {
|
311
|
+
Array.prototype.some = function some(fun /*, thisp */) {
|
312
|
+
var self = toObject(this),
|
313
|
+
length = self.length >>> 0,
|
314
|
+
thisp = arguments[1];
|
315
|
+
|
316
|
+
// If no callback function or if callback is not a callable function
|
317
|
+
if (toString(fun) != "[object Function]") {
|
318
|
+
throw new TypeError(); // TODO message
|
319
|
+
}
|
320
|
+
|
321
|
+
for (var i = 0; i < length; i++) {
|
322
|
+
if (i in self && fun.call(thisp, self[i], i, self))
|
323
|
+
return true;
|
324
|
+
}
|
325
|
+
return false;
|
326
|
+
};
|
327
|
+
}
|
328
|
+
|
329
|
+
// ES5 15.4.4.21
|
330
|
+
// http://es5.github.com/#x15.4.4.21
|
331
|
+
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
|
332
|
+
if (!Array.prototype.reduce) {
|
333
|
+
Array.prototype.reduce = function reduce(fun /*, initial*/) {
|
334
|
+
var self = toObject(this),
|
335
|
+
length = self.length >>> 0;
|
336
|
+
|
337
|
+
// If no callback function or if callback is not a callable function
|
338
|
+
if (toString(fun) != "[object Function]") {
|
339
|
+
throw new TypeError(); // TODO message
|
340
|
+
}
|
341
|
+
|
342
|
+
// no value to return if no initial value and an empty array
|
343
|
+
if (!length && arguments.length == 1)
|
344
|
+
throw new TypeError(); // TODO message
|
345
|
+
|
346
|
+
var i = 0;
|
347
|
+
var result;
|
348
|
+
if (arguments.length >= 2) {
|
349
|
+
result = arguments[1];
|
350
|
+
} else {
|
351
|
+
do {
|
352
|
+
if (i in self) {
|
353
|
+
result = self[i++];
|
354
|
+
break;
|
355
|
+
}
|
356
|
+
|
357
|
+
// if array contains no values, no initial value to return
|
358
|
+
if (++i >= length)
|
359
|
+
throw new TypeError(); // TODO message
|
360
|
+
} while (true);
|
361
|
+
}
|
362
|
+
|
363
|
+
for (; i < length; i++) {
|
364
|
+
if (i in self)
|
365
|
+
result = fun.call(void 0, result, self[i], i, self);
|
366
|
+
}
|
367
|
+
|
368
|
+
return result;
|
369
|
+
};
|
370
|
+
}
|
371
|
+
|
372
|
+
// ES5 15.4.4.22
|
373
|
+
// http://es5.github.com/#x15.4.4.22
|
374
|
+
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
|
375
|
+
if (!Array.prototype.reduceRight) {
|
376
|
+
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
|
377
|
+
var self = toObject(this),
|
378
|
+
length = self.length >>> 0;
|
379
|
+
|
380
|
+
// If no callback function or if callback is not a callable function
|
381
|
+
if (toString(fun) != "[object Function]") {
|
382
|
+
throw new TypeError(); // TODO message
|
383
|
+
}
|
384
|
+
|
385
|
+
// no value to return if no initial value, empty array
|
386
|
+
if (!length && arguments.length == 1)
|
387
|
+
throw new TypeError(); // TODO message
|
388
|
+
|
389
|
+
var result, i = length - 1;
|
390
|
+
if (arguments.length >= 2) {
|
391
|
+
result = arguments[1];
|
392
|
+
} else {
|
393
|
+
do {
|
394
|
+
if (i in self) {
|
395
|
+
result = self[i--];
|
396
|
+
break;
|
397
|
+
}
|
398
|
+
|
399
|
+
// if array contains no values, no initial value to return
|
400
|
+
if (--i < 0)
|
401
|
+
throw new TypeError(); // TODO message
|
402
|
+
} while (true);
|
403
|
+
}
|
404
|
+
|
405
|
+
do {
|
406
|
+
if (i in this)
|
407
|
+
result = fun.call(void 0, result, self[i], i, self);
|
408
|
+
} while (i--);
|
409
|
+
|
410
|
+
return result;
|
411
|
+
};
|
412
|
+
}
|
413
|
+
|
414
|
+
// ES5 15.4.4.14
|
415
|
+
// http://es5.github.com/#x15.4.4.14
|
416
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
|
417
|
+
if (!Array.prototype.indexOf) {
|
418
|
+
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
419
|
+
var self = toObject(this),
|
420
|
+
length = self.length >>> 0;
|
421
|
+
|
422
|
+
if (!length)
|
423
|
+
return -1;
|
424
|
+
|
425
|
+
var i = 0;
|
426
|
+
if (arguments.length > 1)
|
427
|
+
i = toInteger(arguments[1]);
|
428
|
+
|
429
|
+
// handle negative indices
|
430
|
+
i = i >= 0 ? i : Math.max(0, length + i);
|
431
|
+
for (; i < length; i++) {
|
432
|
+
if (i in self && self[i] === sought) {
|
433
|
+
return i;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
return -1;
|
437
|
+
};
|
438
|
+
}
|
439
|
+
|
440
|
+
// ES5 15.4.4.15
|
441
|
+
// http://es5.github.com/#x15.4.4.15
|
442
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
|
443
|
+
if (!Array.prototype.lastIndexOf) {
|
444
|
+
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
|
445
|
+
var self = toObject(this),
|
446
|
+
length = self.length >>> 0;
|
447
|
+
|
448
|
+
if (!length)
|
449
|
+
return -1;
|
450
|
+
var i = length - 1;
|
451
|
+
if (arguments.length > 1)
|
452
|
+
i = Math.min(i, toInteger(arguments[1]));
|
453
|
+
// handle negative indices
|
454
|
+
i = i >= 0 ? i : length - Math.abs(i);
|
455
|
+
for (; i >= 0; i--) {
|
456
|
+
if (i in self && sought === self[i])
|
457
|
+
return i;
|
458
|
+
}
|
459
|
+
return -1;
|
460
|
+
};
|
461
|
+
}
|
462
|
+
|
463
|
+
//
|
464
|
+
// Object
|
465
|
+
// ======
|
466
|
+
//
|
467
|
+
|
468
|
+
// ES5 15.2.3.2
|
469
|
+
// http://es5.github.com/#x15.2.3.2
|
470
|
+
if (!Object.getPrototypeOf) {
|
471
|
+
// https://github.com/kriskowal/es5-shim/issues#issue/2
|
472
|
+
// http://ejohn.org/blog/objectgetprototypeof/
|
473
|
+
// recommended by fschaefer on github
|
474
|
+
Object.getPrototypeOf = function getPrototypeOf(object) {
|
475
|
+
return object.__proto__ || (
|
476
|
+
object.constructor ?
|
477
|
+
object.constructor.prototype :
|
478
|
+
prototypeOfObject
|
479
|
+
);
|
480
|
+
};
|
481
|
+
}
|
482
|
+
|
483
|
+
// ES5 15.2.3.3
|
484
|
+
// http://es5.github.com/#x15.2.3.3
|
485
|
+
if (!Object.getOwnPropertyDescriptor) {
|
486
|
+
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
|
487
|
+
"non-object: ";
|
488
|
+
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
489
|
+
if ((typeof object != "object" && typeof object != "function") || object === null)
|
490
|
+
throw new TypeError(ERR_NON_OBJECT + object);
|
491
|
+
// If object does not owns property return undefined immediately.
|
492
|
+
if (!owns(object, property))
|
493
|
+
return;
|
494
|
+
|
495
|
+
var descriptor, getter, setter;
|
496
|
+
|
497
|
+
// If object has a property then it's for sure both `enumerable` and
|
498
|
+
// `configurable`.
|
499
|
+
descriptor = { enumerable: true, configurable: true };
|
500
|
+
|
501
|
+
// If JS engine supports accessor properties then property may be a
|
502
|
+
// getter or setter.
|
503
|
+
if (supportsAccessors) {
|
504
|
+
// Unfortunately `__lookupGetter__` will return a getter even
|
505
|
+
// if object has own non getter property along with a same named
|
506
|
+
// inherited getter. To avoid misbehavior we temporary remove
|
507
|
+
// `__proto__` so that `__lookupGetter__` will return getter only
|
508
|
+
// if it's owned by an object.
|
509
|
+
var prototype = object.__proto__;
|
510
|
+
object.__proto__ = prototypeOfObject;
|
511
|
+
|
512
|
+
var getter = lookupGetter(object, property);
|
513
|
+
var setter = lookupSetter(object, property);
|
514
|
+
|
515
|
+
// Once we have getter and setter we can put values back.
|
516
|
+
object.__proto__ = prototype;
|
517
|
+
|
518
|
+
if (getter || setter) {
|
519
|
+
if (getter) descriptor.get = getter;
|
520
|
+
if (setter) descriptor.set = setter;
|
521
|
+
|
522
|
+
// If it was accessor property we're done and return here
|
523
|
+
// in order to avoid adding `value` to the descriptor.
|
524
|
+
return descriptor;
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
// If we got this far we know that object has an own property that is
|
529
|
+
// not an accessor so we set it as a value and return descriptor.
|
530
|
+
descriptor.value = object[property];
|
531
|
+
return descriptor;
|
532
|
+
};
|
533
|
+
}
|
534
|
+
|
535
|
+
// ES5 15.2.3.4
|
536
|
+
// http://es5.github.com/#x15.2.3.4
|
537
|
+
if (!Object.getOwnPropertyNames) {
|
538
|
+
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
539
|
+
return Object.keys(object);
|
540
|
+
};
|
541
|
+
}
|
542
|
+
|
543
|
+
// ES5 15.2.3.5
|
544
|
+
// http://es5.github.com/#x15.2.3.5
|
545
|
+
if (!Object.create) {
|
546
|
+
Object.create = function create(prototype, properties) {
|
547
|
+
var object;
|
548
|
+
if (prototype === null) {
|
549
|
+
object = { "__proto__": null };
|
550
|
+
} else {
|
551
|
+
if (typeof prototype != "object")
|
552
|
+
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
|
553
|
+
var Type = function () {};
|
554
|
+
Type.prototype = prototype;
|
555
|
+
object = new Type();
|
556
|
+
// IE has no built-in implementation of `Object.getPrototypeOf`
|
557
|
+
// neither `__proto__`, but this manually setting `__proto__` will
|
558
|
+
// guarantee that `Object.getPrototypeOf` will work as expected with
|
559
|
+
// objects created using `Object.create`
|
560
|
+
object.__proto__ = prototype;
|
561
|
+
}
|
562
|
+
if (properties !== void 0)
|
563
|
+
Object.defineProperties(object, properties);
|
564
|
+
return object;
|
565
|
+
};
|
566
|
+
}
|
567
|
+
|
568
|
+
// ES5 15.2.3.6
|
569
|
+
// http://es5.github.com/#x15.2.3.6
|
570
|
+
|
571
|
+
// Patch for WebKit and IE8 standard mode
|
572
|
+
// Designed by hax <hax.github.com>
|
573
|
+
// related issue: https://github.com/kriskowal/es5-shim/issues#issue/5
|
574
|
+
// IE8 Reference:
|
575
|
+
// http://msdn.microsoft.com/en-us/library/dd282900.aspx
|
576
|
+
// http://msdn.microsoft.com/en-us/library/dd229916.aspx
|
577
|
+
// WebKit Bugs:
|
578
|
+
// https://bugs.webkit.org/show_bug.cgi?id=36423
|
579
|
+
|
580
|
+
function doesDefinePropertyWork(object) {
|
581
|
+
try {
|
582
|
+
Object.defineProperty(object, "sentinel", {});
|
583
|
+
return "sentinel" in object;
|
584
|
+
} catch (exception) {
|
585
|
+
// returns falsy
|
586
|
+
}
|
587
|
+
}
|
588
|
+
|
589
|
+
// check whether defineProperty works if it's given. Otherwise,
|
590
|
+
// shim partially.
|
591
|
+
if (Object.defineProperty) {
|
592
|
+
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
593
|
+
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
594
|
+
doesDefinePropertyWork(document.createElement("div"));
|
595
|
+
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
596
|
+
var definePropertyFallback = Object.defineProperty;
|
597
|
+
}
|
598
|
+
}
|
599
|
+
|
600
|
+
if (!Object.defineProperty || definePropertyFallback) {
|
601
|
+
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
602
|
+
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
603
|
+
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
604
|
+
"on this javascript engine";
|
605
|
+
|
606
|
+
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
607
|
+
if ((typeof object != "object" && typeof object != "function") || object === null)
|
608
|
+
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
609
|
+
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
|
610
|
+
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
611
|
+
|
612
|
+
// make a valiant attempt to use the real defineProperty
|
613
|
+
// for I8's DOM elements.
|
614
|
+
if (definePropertyFallback) {
|
615
|
+
try {
|
616
|
+
return definePropertyFallback.call(Object, object, property, descriptor);
|
617
|
+
} catch (exception) {
|
618
|
+
// try the shim if the real one doesn't work
|
619
|
+
}
|
620
|
+
}
|
621
|
+
|
622
|
+
// If it's a data property.
|
623
|
+
if (owns(descriptor, "value")) {
|
624
|
+
// fail silently if "writable", "enumerable", or "configurable"
|
625
|
+
// are requested but not supported
|
626
|
+
/*
|
627
|
+
// alternate approach:
|
628
|
+
if ( // can't implement these features; allow false but not true
|
629
|
+
!(owns(descriptor, "writable") ? descriptor.writable : true) ||
|
630
|
+
!(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
|
631
|
+
!(owns(descriptor, "configurable") ? descriptor.configurable : true)
|
632
|
+
)
|
633
|
+
throw new RangeError(
|
634
|
+
"This implementation of Object.defineProperty does not " +
|
635
|
+
"support configurable, enumerable, or writable."
|
636
|
+
);
|
637
|
+
*/
|
638
|
+
|
639
|
+
if (supportsAccessors && (lookupGetter(object, property) ||
|
640
|
+
lookupSetter(object, property)))
|
641
|
+
{
|
642
|
+
// As accessors are supported only on engines implementing
|
643
|
+
// `__proto__` we can safely override `__proto__` while defining
|
644
|
+
// a property to make sure that we don't hit an inherited
|
645
|
+
// accessor.
|
646
|
+
var prototype = object.__proto__;
|
647
|
+
object.__proto__ = prototypeOfObject;
|
648
|
+
// Deleting a property anyway since getter / setter may be
|
649
|
+
// defined on object itself.
|
650
|
+
delete object[property];
|
651
|
+
object[property] = descriptor.value;
|
652
|
+
// Setting original `__proto__` back now.
|
653
|
+
object.__proto__ = prototype;
|
654
|
+
} else {
|
655
|
+
object[property] = descriptor.value;
|
656
|
+
}
|
657
|
+
} else {
|
658
|
+
if (!supportsAccessors)
|
659
|
+
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
660
|
+
// If we got that far then getters and setters can be defined !!
|
661
|
+
if (owns(descriptor, "get"))
|
662
|
+
defineGetter(object, property, descriptor.get);
|
663
|
+
if (owns(descriptor, "set"))
|
664
|
+
defineSetter(object, property, descriptor.set);
|
665
|
+
}
|
666
|
+
|
667
|
+
return object;
|
668
|
+
};
|
669
|
+
}
|
670
|
+
|
671
|
+
// ES5 15.2.3.7
|
672
|
+
// http://es5.github.com/#x15.2.3.7
|
673
|
+
if (!Object.defineProperties) {
|
674
|
+
Object.defineProperties = function defineProperties(object, properties) {
|
675
|
+
for (var property in properties) {
|
676
|
+
if (owns(properties, property))
|
677
|
+
Object.defineProperty(object, property, properties[property]);
|
678
|
+
}
|
679
|
+
return object;
|
680
|
+
};
|
681
|
+
}
|
682
|
+
|
683
|
+
// ES5 15.2.3.8
|
684
|
+
// http://es5.github.com/#x15.2.3.8
|
685
|
+
if (!Object.seal) {
|
686
|
+
Object.seal = function seal(object) {
|
687
|
+
// this is misleading and breaks feature-detection, but
|
688
|
+
// allows "securable" code to "gracefully" degrade to working
|
689
|
+
// but insecure code.
|
690
|
+
return object;
|
691
|
+
};
|
692
|
+
}
|
693
|
+
|
694
|
+
// ES5 15.2.3.9
|
695
|
+
// http://es5.github.com/#x15.2.3.9
|
696
|
+
if (!Object.freeze) {
|
697
|
+
Object.freeze = function freeze(object) {
|
698
|
+
// this is misleading and breaks feature-detection, but
|
699
|
+
// allows "securable" code to "gracefully" degrade to working
|
700
|
+
// but insecure code.
|
701
|
+
return object;
|
702
|
+
};
|
703
|
+
}
|
704
|
+
|
705
|
+
// detect a Rhino bug and patch it
|
706
|
+
try {
|
707
|
+
Object.freeze(function () {});
|
708
|
+
} catch (exception) {
|
709
|
+
Object.freeze = (function freeze(freezeObject) {
|
710
|
+
return function freeze(object) {
|
711
|
+
if (typeof object == "function") {
|
712
|
+
return object;
|
713
|
+
} else {
|
714
|
+
return freezeObject(object);
|
715
|
+
}
|
716
|
+
};
|
717
|
+
})(Object.freeze);
|
718
|
+
}
|
719
|
+
|
720
|
+
// ES5 15.2.3.10
|
721
|
+
// http://es5.github.com/#x15.2.3.10
|
722
|
+
if (!Object.preventExtensions) {
|
723
|
+
Object.preventExtensions = function preventExtensions(object) {
|
724
|
+
// this is misleading and breaks feature-detection, but
|
725
|
+
// allows "securable" code to "gracefully" degrade to working
|
726
|
+
// but insecure code.
|
727
|
+
return object;
|
728
|
+
};
|
729
|
+
}
|
730
|
+
|
731
|
+
// ES5 15.2.3.11
|
732
|
+
// http://es5.github.com/#x15.2.3.11
|
733
|
+
if (!Object.isSealed) {
|
734
|
+
Object.isSealed = function isSealed(object) {
|
735
|
+
return false;
|
736
|
+
};
|
737
|
+
}
|
738
|
+
|
739
|
+
// ES5 15.2.3.12
|
740
|
+
// http://es5.github.com/#x15.2.3.12
|
741
|
+
if (!Object.isFrozen) {
|
742
|
+
Object.isFrozen = function isFrozen(object) {
|
743
|
+
return false;
|
744
|
+
};
|
745
|
+
}
|
746
|
+
|
747
|
+
// ES5 15.2.3.13
|
748
|
+
// http://es5.github.com/#x15.2.3.13
|
749
|
+
if (!Object.isExtensible) {
|
750
|
+
Object.isExtensible = function isExtensible(object) {
|
751
|
+
// 1. If Type(O) is not Object throw a TypeError exception.
|
752
|
+
if (Object(object) === object) {
|
753
|
+
throw new TypeError(); // TODO message
|
754
|
+
}
|
755
|
+
// 2. Return the Boolean value of the [[Extensible]] internal property of O.
|
756
|
+
var name = '';
|
757
|
+
while (owns(object, name)) {
|
758
|
+
name += '?';
|
759
|
+
}
|
760
|
+
object[name] = true;
|
761
|
+
var returnValue = owns(object, name);
|
762
|
+
delete object[name];
|
763
|
+
return returnValue;
|
764
|
+
};
|
765
|
+
}
|
766
|
+
|
767
|
+
// ES5 15.2.3.14
|
768
|
+
// http://es5.github.com/#x15.2.3.14
|
769
|
+
if (!Object.keys) {
|
770
|
+
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
|
771
|
+
var hasDontEnumBug = true,
|
772
|
+
dontEnums = [
|
773
|
+
"toString",
|
774
|
+
"toLocaleString",
|
775
|
+
"valueOf",
|
776
|
+
"hasOwnProperty",
|
777
|
+
"isPrototypeOf",
|
778
|
+
"propertyIsEnumerable",
|
779
|
+
"constructor"
|
780
|
+
],
|
781
|
+
dontEnumsLength = dontEnums.length;
|
782
|
+
|
783
|
+
for (var key in {"toString": null})
|
784
|
+
hasDontEnumBug = false;
|
785
|
+
|
786
|
+
Object.keys = function keys(object) {
|
787
|
+
|
788
|
+
if ((typeof object != "object" && typeof object != "function") || object === null)
|
789
|
+
throw new TypeError("Object.keys called on a non-object");
|
790
|
+
|
791
|
+
var keys = [];
|
792
|
+
for (var name in object) {
|
793
|
+
if (owns(object, name)) {
|
794
|
+
keys.push(name);
|
795
|
+
}
|
796
|
+
}
|
797
|
+
|
798
|
+
if (hasDontEnumBug) {
|
799
|
+
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
|
800
|
+
var dontEnum = dontEnums[i];
|
801
|
+
if (owns(object, dontEnum)) {
|
802
|
+
keys.push(dontEnum);
|
803
|
+
}
|
804
|
+
}
|
805
|
+
}
|
806
|
+
|
807
|
+
return keys;
|
808
|
+
};
|
809
|
+
|
810
|
+
}
|
811
|
+
|
812
|
+
//
|
813
|
+
// Date
|
814
|
+
// ====
|
815
|
+
//
|
816
|
+
|
817
|
+
// ES5 15.9.5.43
|
818
|
+
// http://es5.github.com/#x15.9.5.43
|
819
|
+
// This function returns a String value represent the instance in time
|
820
|
+
// represented by this Date object. The format of the String is the Date Time
|
821
|
+
// string format defined in 15.9.1.15. All fields are present in the String.
|
822
|
+
// The time zone is always UTC, denoted by the suffix Z. If the time value of
|
823
|
+
// this object is not a finite Number a RangeError exception is thrown.
|
824
|
+
if (!Date.prototype.toISOString || (new Date(-62198755200000).toISOString().indexOf('-000001') === -1)) {
|
825
|
+
Date.prototype.toISOString = function toISOString() {
|
826
|
+
var result, length, value, year;
|
827
|
+
if (!isFinite(this))
|
828
|
+
throw new RangeError;
|
829
|
+
|
830
|
+
// the date time string format is specified in 15.9.1.15.
|
831
|
+
result = [this.getUTCMonth() + 1, this.getUTCDate(),
|
832
|
+
this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
|
833
|
+
year = this.getUTCFullYear();
|
834
|
+
year = (year < 0 ? '-' : (year > 9999 ? '+' : '')) + ('00000' + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6);
|
835
|
+
|
836
|
+
length = result.length;
|
837
|
+
while (length--) {
|
838
|
+
value = result[length];
|
839
|
+
// pad months, days, hours, minutes, and seconds to have two digits.
|
840
|
+
if (value < 10)
|
841
|
+
result[length] = "0" + value;
|
842
|
+
}
|
843
|
+
// pad milliseconds to have three digits.
|
844
|
+
return year + "-" + result.slice(0, 2).join("-") + "T" + result.slice(2).join(":") + "." +
|
845
|
+
("000" + this.getUTCMilliseconds()).slice(-3) + "Z";
|
846
|
+
}
|
847
|
+
}
|
848
|
+
|
849
|
+
// ES5 15.9.4.4
|
850
|
+
// http://es5.github.com/#x15.9.4.4
|
851
|
+
if (!Date.now) {
|
852
|
+
Date.now = function now() {
|
853
|
+
return new Date().getTime();
|
854
|
+
};
|
855
|
+
}
|
856
|
+
|
857
|
+
// ES5 15.9.5.44
|
858
|
+
// http://es5.github.com/#x15.9.5.44
|
859
|
+
// This function provides a String representation of a Date object for use by
|
860
|
+
// JSON.stringify (15.12.3).
|
861
|
+
if (!Date.prototype.toJSON) {
|
862
|
+
Date.prototype.toJSON = function toJSON(key) {
|
863
|
+
// When the toJSON method is called with argument key, the following
|
864
|
+
// steps are taken:
|
865
|
+
|
866
|
+
// 1. Let O be the result of calling ToObject, giving it the this
|
867
|
+
// value as its argument.
|
868
|
+
// 2. Let tv be ToPrimitive(O, hint Number).
|
869
|
+
// 3. If tv is a Number and is not finite, return null.
|
870
|
+
// XXX
|
871
|
+
// 4. Let toISO be the result of calling the [[Get]] internal method of
|
872
|
+
// O with argument "toISOString".
|
873
|
+
// 5. If IsCallable(toISO) is false, throw a TypeError exception.
|
874
|
+
if (typeof this.toISOString != "function")
|
875
|
+
throw new TypeError(); // TODO message
|
876
|
+
// 6. Return the result of calling the [[Call]] internal method of
|
877
|
+
// toISO with O as the this value and an empty argument list.
|
878
|
+
return this.toISOString();
|
879
|
+
|
880
|
+
// NOTE 1 The argument is ignored.
|
881
|
+
|
882
|
+
// NOTE 2 The toJSON function is intentionally generic; it does not
|
883
|
+
// require that its this value be a Date object. Therefore, it can be
|
884
|
+
// transferred to other kinds of objects for use as a method. However,
|
885
|
+
// it does require that any such object have a toISOString method. An
|
886
|
+
// object is free to use the argument key to filter its
|
887
|
+
// stringification.
|
888
|
+
};
|
889
|
+
}
|
890
|
+
|
891
|
+
// ES5 15.9.4.2
|
892
|
+
// http://es5.github.com/#x15.9.4.2
|
893
|
+
// based on work shared by Daniel Friesen (dantman)
|
894
|
+
// http://gist.github.com/303249
|
895
|
+
if (Date.parse("+275760-09-13T00:00:00.000Z") !== 8.64e15) {
|
896
|
+
// XXX global assignment won't work in embeddings that use
|
897
|
+
// an alternate object for the context.
|
898
|
+
Date = (function(NativeDate) {
|
899
|
+
|
900
|
+
// Date.length === 7
|
901
|
+
var Date = function Date(Y, M, D, h, m, s, ms) {
|
902
|
+
var length = arguments.length;
|
903
|
+
if (this instanceof NativeDate) {
|
904
|
+
var date = length == 1 && String(Y) === Y ? // isString(Y)
|
905
|
+
// We explicitly pass it through parse:
|
906
|
+
new NativeDate(Date.parse(Y)) :
|
907
|
+
// We have to manually make calls depending on argument
|
908
|
+
// length here
|
909
|
+
length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
|
910
|
+
length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
|
911
|
+
length >= 5 ? new NativeDate(Y, M, D, h, m) :
|
912
|
+
length >= 4 ? new NativeDate(Y, M, D, h) :
|
913
|
+
length >= 3 ? new NativeDate(Y, M, D) :
|
914
|
+
length >= 2 ? new NativeDate(Y, M) :
|
915
|
+
length >= 1 ? new NativeDate(Y) :
|
916
|
+
new NativeDate();
|
917
|
+
// Prevent mixups with unfixed Date object
|
918
|
+
date.constructor = Date;
|
919
|
+
return date;
|
920
|
+
}
|
921
|
+
return NativeDate.apply(this, arguments);
|
922
|
+
};
|
923
|
+
|
924
|
+
// 15.9.1.15 Date Time String Format.
|
925
|
+
var isoDateExpression = new RegExp("^" +
|
926
|
+
"(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign + 6-digit extended year
|
927
|
+
"(?:-(\\d{2})" + // optional month capture
|
928
|
+
"(?:-(\\d{2})" + // optional day capture
|
929
|
+
"(?:" + // capture hours:minutes:seconds.milliseconds
|
930
|
+
"T(\\d{2})" + // hours capture
|
931
|
+
":(\\d{2})" + // minutes capture
|
932
|
+
"(?:" + // optional :seconds.milliseconds
|
933
|
+
":(\\d{2})" + // seconds capture
|
934
|
+
"(?:\\.(\\d{3}))?" + // milliseconds capture
|
935
|
+
")?" +
|
936
|
+
"(?:" + // capture UTC offset component
|
937
|
+
"Z|" + // UTC capture
|
938
|
+
"(?:" + // offset specifier +/-hours:minutes
|
939
|
+
"([-+])" + // sign capture
|
940
|
+
"(\\d{2})" + // hours offset capture
|
941
|
+
":(\\d{2})" + // minutes offset capture
|
942
|
+
")" +
|
943
|
+
")?)?)?)?" +
|
944
|
+
"$");
|
945
|
+
|
946
|
+
// Copy any custom methods a 3rd party library may have added
|
947
|
+
for (var key in NativeDate)
|
948
|
+
Date[key] = NativeDate[key];
|
949
|
+
|
950
|
+
// Copy "native" methods explicitly; they may be non-enumerable
|
951
|
+
Date.now = NativeDate.now;
|
952
|
+
Date.UTC = NativeDate.UTC;
|
953
|
+
Date.prototype = NativeDate.prototype;
|
954
|
+
Date.prototype.constructor = Date;
|
955
|
+
|
956
|
+
// Upgrade Date.parse to handle simplified ISO 8601 strings
|
957
|
+
Date.parse = function parse(string) {
|
958
|
+
var match = isoDateExpression.exec(string);
|
959
|
+
if (match) {
|
960
|
+
match.shift(); // kill match[0], the full match
|
961
|
+
// parse months, days, hours, minutes, seconds, and milliseconds
|
962
|
+
for (var i = 1; i < 7; i++) {
|
963
|
+
// provide default values if necessary
|
964
|
+
match[i] = +(match[i] || (i < 3 ? 1 : 0));
|
965
|
+
// match[1] is the month. Months are 0-11 in JavaScript
|
966
|
+
// `Date` objects, but 1-12 in ISO notation, so we
|
967
|
+
// decrement.
|
968
|
+
if (i == 1)
|
969
|
+
match[i]--;
|
970
|
+
}
|
971
|
+
|
972
|
+
// parse the UTC offset component
|
973
|
+
var minuteOffset = +match.pop(), hourOffset = +match.pop(), sign = match.pop();
|
974
|
+
|
975
|
+
// compute the explicit time zone offset if specified
|
976
|
+
var offset = 0;
|
977
|
+
if (sign) {
|
978
|
+
// detect invalid offsets and return early
|
979
|
+
if (hourOffset > 23 || minuteOffset > 59)
|
980
|
+
return NaN;
|
981
|
+
|
982
|
+
// express the provided time zone offset in minutes. The offset is
|
983
|
+
// negative for time zones west of UTC; positive otherwise.
|
984
|
+
offset = (hourOffset * 60 + minuteOffset) * 6e4 * (sign == "+" ? -1 : 1);
|
985
|
+
}
|
986
|
+
|
987
|
+
// Date.UTC for years between 0 and 99 converts year to 1900 + year
|
988
|
+
// The Gregorian calendar has a 400-year cycle, so
|
989
|
+
// to Date.UTC(year + 400, .... ) - 12622780800000 == Date.UTC(year, ...),
|
990
|
+
// where 12622780800000 - number of milliseconds in Gregorian calendar 400 years
|
991
|
+
var year = +match[0];
|
992
|
+
if (0 <= year && year <= 99) {
|
993
|
+
match[0] = year + 400;
|
994
|
+
return NativeDate.UTC.apply(this, match) + offset - 12622780800000;
|
995
|
+
}
|
996
|
+
|
997
|
+
// compute a new UTC date value, accounting for the optional offset
|
998
|
+
return NativeDate.UTC.apply(this, match) + offset;
|
999
|
+
}
|
1000
|
+
return NativeDate.parse.apply(this, arguments);
|
1001
|
+
};
|
1002
|
+
|
1003
|
+
return Date;
|
1004
|
+
})(Date);
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
//
|
1008
|
+
// String
|
1009
|
+
// ======
|
1010
|
+
//
|
1011
|
+
|
1012
|
+
// ES5 15.5.4.20
|
1013
|
+
// http://es5.github.com/#x15.5.4.20
|
1014
|
+
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
1015
|
+
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
1016
|
+
"\u2029\uFEFF";
|
1017
|
+
if (!String.prototype.trim || ws.trim()) {
|
1018
|
+
// http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
1019
|
+
// http://perfectionkills.com/whitespace-deviations/
|
1020
|
+
ws = "[" + ws + "]";
|
1021
|
+
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
1022
|
+
trimEndRegexp = new RegExp(ws + ws + "*$");
|
1023
|
+
String.prototype.trim = function trim() {
|
1024
|
+
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
|
1025
|
+
};
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
//
|
1029
|
+
// Util
|
1030
|
+
// ======
|
1031
|
+
//
|
1032
|
+
|
1033
|
+
// ES5 9.4
|
1034
|
+
// http://es5.github.com/#x9.4
|
1035
|
+
// http://jsperf.com/to-integer
|
1036
|
+
var toInteger = function (n) {
|
1037
|
+
n = +n;
|
1038
|
+
if (n !== n) // isNaN
|
1039
|
+
n = 0;
|
1040
|
+
else if (n !== 0 && n !== (1/0) && n !== -(1/0))
|
1041
|
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
1042
|
+
return n;
|
1043
|
+
};
|
1044
|
+
|
1045
|
+
var prepareString = "a"[0] != "a",
|
1046
|
+
// ES5 9.9
|
1047
|
+
// http://es5.github.com/#x9.9
|
1048
|
+
toObject = function (o) {
|
1049
|
+
if (o == null) { // this matches both null and undefined
|
1050
|
+
throw new TypeError(); // TODO message
|
1051
|
+
}
|
1052
|
+
// If the implementation doesn't support by-index access of
|
1053
|
+
// string characters (ex. IE < 7), split the string
|
1054
|
+
if (prepareString && typeof o == "string" && o) {
|
1055
|
+
return o.split("");
|
1056
|
+
}
|
1057
|
+
return Object(o);
|
1058
|
+
};
|
1059
|
+
});
|