├── .gitignore
├── BlobBuilder.js
├── CNAME
├── COPYING
├── FileSaver.js
├── README.md
├── about.htm
├── ace
├── ace.js
├── ext-static_highlight.js
├── ext-textarea.js
├── keybinding-emacs.js
├── keybinding-vim.js
├── mode-javascript.js
├── mode-python.js
└── theme-chrome.js
├── builtin.js
├── contextmenu
├── arrow_s.png
├── jquery.contextmenu.css
├── jquery.contextmenu.js
└── jquery.hoverintent.js
├── drop.js
├── favicon.ico
├── icebuddha.png
├── index.htm
├── jqtree
├── jqtree.css
├── tree.jquery.js
├── treeDownTriangleBlack.png
└── treeRightTriangleBlack.png
├── jquery-1.8.2.min.js
├── jquery-ui.js
├── jquery.cookie.js
├── jquery.hotkeys.js
├── jquery.js
├── jquery.min.js
├── jquery.scrollTo.min.js
├── parse_scripts
├── example_extractMiniDukeFile.py
├── fileparser.py
├── gif.py
├── icebuddha
│ └── __init__.py
├── mach_o.py
├── pe.py
└── unknown.py
├── peg.min.js
├── projects.htm
├── skulpt.js
├── slopfinder.htm
├── slopfinder.js
├── slopfinder.png
├── style.css
├── summit_route_logo.png
├── test_data
├── bytes.data
├── high_bytes.data
├── icebuddha.gif
├── putty.exe
└── sample_1.gif
├── tutorial.png
└── waypoints.min.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .metadata
2 |
--------------------------------------------------------------------------------
/BlobBuilder.js:
--------------------------------------------------------------------------------
1 | /* BlobBuilder.js
2 | * A BlobBuilder implementation.
3 | * 2012-04-21
4 | *
5 | * By Eli Grey, http://eligrey.com
6 | * License: X11/MIT
7 | * See LICENSE.md
8 | */
9 |
10 | /*global self, unescape */
11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
12 | plusplus: true */
13 |
14 | /*! @source http://purl.eligrey.com/github/BlobBuilder.js/blob/master/BlobBuilder.js */
15 |
16 | var BlobBuilder = BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder || (function(view) {
17 | "use strict";
18 | var
19 | get_class = function(object) {
20 | return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
21 | }
22 | , FakeBlobBuilder = function(){
23 | this.data = [];
24 | }
25 | , FakeBlob = function(data, type, encoding) {
26 | this.data = data;
27 | this.size = data.length;
28 | this.type = type;
29 | this.encoding = encoding;
30 | }
31 | , FBB_proto = FakeBlobBuilder.prototype
32 | , FB_proto = FakeBlob.prototype
33 | , FileReaderSync = view.FileReaderSync
34 | , FileException = function(type) {
35 | this.code = this[this.name = type];
36 | }
37 | , file_ex_codes = (
38 | "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
39 | + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
40 | ).split(" ")
41 | , file_ex_code = file_ex_codes.length
42 | , realURL = view.URL || view.webkitURL || view
43 | , real_create_object_URL = realURL.createObjectURL
44 | , real_revoke_object_URL = realURL.revokeObjectURL
45 | , URL = realURL
46 | , btoa = view.btoa
47 | , atob = view.atob
48 | , can_apply_typed_arrays = false
49 | , can_apply_typed_arrays_test = function(pass) {
50 | can_apply_typed_arrays = !pass;
51 | }
52 |
53 | , ArrayBuffer = view.ArrayBuffer
54 | , Uint8Array = view.Uint8Array
55 | ;
56 | FakeBlobBuilder.fake = FB_proto.fake = true;
57 | while (file_ex_code--) {
58 | FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
59 | }
60 | try {
61 | if (Uint8Array) {
62 | can_apply_typed_arrays_test.apply(0, new Uint8Array(1));
63 | }
64 | } catch (ex) {}
65 | if (!realURL.createObjectURL) {
66 | URL = view.URL = {};
67 | }
68 | URL.createObjectURL = function(blob) {
69 | var
70 | type = blob.type
71 | , data_URI_header
72 | ;
73 | if (type === null) {
74 | type = "application/octet-stream";
75 | }
76 | if (blob instanceof FakeBlob) {
77 | data_URI_header = "data:" + type;
78 | if (blob.encoding === "base64") {
79 | return data_URI_header + ";base64," + blob.data;
80 | } else if (blob.encoding === "URI") {
81 | return data_URI_header + "," + decodeURIComponent(blob.data);
82 | } if (btoa) {
83 | return data_URI_header + ";base64," + btoa(blob.data);
84 | } else {
85 | return data_URI_header + "," + encodeURIComponent(blob.data);
86 | }
87 | } else if (real_create_object_url) {
88 | return real_create_object_url.call(realURL, blob);
89 | }
90 | };
91 | URL.revokeObjectURL = function(object_url) {
92 | if (object_url.substring(0, 5) !== "data:" && real_revoke_object_url) {
93 | real_revoke_object_url.call(realURL, object_url);
94 | }
95 | };
96 | FBB_proto.append = function(data/*, endings*/) {
97 | var bb = this.data;
98 | // decode data to a binary string
99 | if (Uint8Array && data instanceof ArrayBuffer) {
100 | if (can_apply_typed_arrays) {
101 | bb.push(String.fromCharCode.apply(String, new Uint8Array(data)));
102 | } else {
103 | var
104 | str = ""
105 | , buf = new Uint8Array(data)
106 | , i = 0
107 | , buf_len = buf.length
108 | ;
109 | for (; i < buf_len; i++) {
110 | str += String.fromCharCode(buf[i]);
111 | }
112 | }
113 | } else if (get_class(data) === "Blob" || get_class(data) === "File") {
114 | if (FileReaderSync) {
115 | var fr = new FileReaderSync;
116 | bb.push(fr.readAsBinaryString(data));
117 | } else {
118 | // async FileReader won't work as BlobBuilder is sync
119 | throw new FileException("NOT_READABLE_ERR");
120 | }
121 | } else if (data instanceof FakeBlob) {
122 | if (data.encoding === "base64" && atob) {
123 | bb.push(atob(data.data));
124 | } else if (data.encoding === "URI") {
125 | bb.push(decodeURIComponent(data.data));
126 | } else if (data.encoding === "raw") {
127 | bb.push(data.data);
128 | }
129 | } else {
130 | if (typeof data !== "string") {
131 | data += ""; // convert unsupported types to strings
132 | }
133 | // decode UTF-16 to binary string
134 | bb.push(unescape(encodeURIComponent(data)));
135 | }
136 | };
137 | FBB_proto.getBlob = function(type) {
138 | if (!arguments.length) {
139 | type = null;
140 | }
141 | return new FakeBlob(this.data.join(""), type, "raw");
142 | };
143 | FBB_proto.toString = function() {
144 | return "[object BlobBuilder]";
145 | };
146 | FB_proto.slice = function(start, end, type) {
147 | var args = arguments.length;
148 | if (args < 3) {
149 | type = null;
150 | }
151 | return new FakeBlob(
152 | this.data.slice(start, args > 1 ? end : this.data.length)
153 | , type
154 | , this.encoding
155 | );
156 | };
157 | FB_proto.toString = function() {
158 | return "[object Blob]";
159 | };
160 | return FakeBlobBuilder;
161 | }(self));
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | icebuddha.com
2 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Scott Piper
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.
--------------------------------------------------------------------------------
/FileSaver.js:
--------------------------------------------------------------------------------
1 | /* FileSaver.js
2 | * A saveAs() FileSaver implementation.
3 | * 2012-12-11
4 | *
5 | * By Eli Grey, http://eligrey.com
6 | * License: X11/MIT
7 | * See LICENSE.md
8 | */
9 |
10 | /*global self */
11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
12 | plusplus: true */
13 |
14 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
15 |
16 | var saveAs = saveAs
17 | || (navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
18 | || (function(view) {
19 | "use strict";
20 | var
21 | doc = view.document
22 | // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
23 | , get_URL = function() {
24 | return view.URL || view.webkitURL || view;
25 | }
26 | , URL = view.URL || view.webkitURL || view
27 | , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
28 | , can_use_save_link = "download" in save_link
29 | , click = function(node) {
30 | var event = doc.createEvent("MouseEvents");
31 | event.initMouseEvent(
32 | "click", true, false, view, 0, 0, 0, 0, 0
33 | , false, false, false, false, 0, null
34 | );
35 | return node.dispatchEvent(event); // false if event was cancelled
36 | }
37 | , webkit_req_fs = view.webkitRequestFileSystem
38 | , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
39 | , throw_outside = function (ex) {
40 | (view.setImmediate || view.setTimeout)(function() {
41 | throw ex;
42 | }, 0);
43 | }
44 | , force_saveable_type = "application/octet-stream"
45 | , fs_min_size = 0
46 | , deletion_queue = []
47 | , process_deletion_queue = function() {
48 | var i = deletion_queue.length;
49 | while (i--) {
50 | var file = deletion_queue[i];
51 | if (typeof file === "string") { // file is an object URL
52 | URL.revokeObjectURL(file);
53 | } else { // file is a File
54 | file.remove();
55 | }
56 | }
57 | deletion_queue.length = 0; // clear queue
58 | }
59 | , dispatch = function(filesaver, event_types, event) {
60 | event_types = [].concat(event_types);
61 | var i = event_types.length;
62 | while (i--) {
63 | var listener = filesaver["on" + event_types[i]];
64 | if (typeof listener === "function") {
65 | try {
66 | listener.call(filesaver, event || filesaver);
67 | } catch (ex) {
68 | throw_outside(ex);
69 | }
70 | }
71 | }
72 | }
73 | , FileSaver = function(blob, name) {
74 | // First try a.download, then web filesystem, then object URLs
75 | var
76 | filesaver = this
77 | , type = blob.type
78 | , blob_changed = false
79 | , object_url
80 | , target_view
81 | , get_object_url = function() {
82 | var object_url = get_URL().createObjectURL(blob);
83 | deletion_queue.push(object_url);
84 | return object_url;
85 | }
86 | , dispatch_all = function() {
87 | dispatch(filesaver, "writestart progress write writeend".split(" "));
88 | }
89 | // on any filesys errors revert to saving with object URLs
90 | , fs_error = function() {
91 | // don't create more object URLs than needed
92 | if (blob_changed || !object_url) {
93 | object_url = get_object_url(blob);
94 | }
95 | target_view.location.href = object_url;
96 | filesaver.readyState = filesaver.DONE;
97 | dispatch_all();
98 | }
99 | , abortable = function(func) {
100 | return function() {
101 | if (filesaver.readyState !== filesaver.DONE) {
102 | return func.apply(this, arguments);
103 | }
104 | };
105 | }
106 | , create_if_not_found = {create: true, exclusive: false}
107 | , slice
108 | ;
109 | filesaver.readyState = filesaver.INIT;
110 | if (!name) {
111 | name = "download";
112 | }
113 | if (can_use_save_link) {
114 | object_url = get_object_url(blob);
115 | save_link.href = object_url;
116 | save_link.download = name;
117 | if (click(save_link)) {
118 | filesaver.readyState = filesaver.DONE;
119 | dispatch_all();
120 | return;
121 | }
122 | }
123 | // Object and web filesystem URLs have a problem saving in Google Chrome when
124 | // viewed in a tab, so I force save with application/octet-stream
125 | // http://code.google.com/p/chromium/issues/detail?id=91158
126 | if (view.chrome && type && type !== force_saveable_type) {
127 | slice = blob.slice || blob.webkitSlice;
128 | blob = slice.call(blob, 0, blob.size, force_saveable_type);
129 | blob_changed = true;
130 | }
131 | // Since I can't be sure that the guessed media type will trigger a download
132 | // in WebKit, I append .download to the filename.
133 | // https://bugs.webkit.org/show_bug.cgi?id=65440
134 | if (webkit_req_fs && name !== "download") {
135 | name += ".download";
136 | }
137 | if (type === force_saveable_type || webkit_req_fs) {
138 | target_view = view;
139 | } else {
140 | target_view = view.open();
141 | }
142 | if (!req_fs) {
143 | fs_error();
144 | return;
145 | }
146 | fs_min_size += blob.size;
147 | req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
148 | fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
149 | var save = function() {
150 | dir.getFile(name, create_if_not_found, abortable(function(file) {
151 | file.createWriter(abortable(function(writer) {
152 | writer.onwriteend = function(event) {
153 | target_view.location.href = file.toURL();
154 | deletion_queue.push(file);
155 | filesaver.readyState = filesaver.DONE;
156 | dispatch(filesaver, "writeend", event);
157 | };
158 | writer.onerror = function() {
159 | var error = writer.error;
160 | if (error.code !== error.ABORT_ERR) {
161 | fs_error();
162 | }
163 | };
164 | "writestart progress write abort".split(" ").forEach(function(event) {
165 | writer["on" + event] = filesaver["on" + event];
166 | });
167 | writer.write(blob);
168 | filesaver.abort = function() {
169 | writer.abort();
170 | filesaver.readyState = filesaver.DONE;
171 | };
172 | filesaver.readyState = filesaver.WRITING;
173 | }), fs_error);
174 | }), fs_error);
175 | };
176 | dir.getFile(name, {create: false}, abortable(function(file) {
177 | // delete file if it already exists
178 | file.remove();
179 | save();
180 | }), abortable(function(ex) {
181 | if (ex.code === ex.NOT_FOUND_ERR) {
182 | save();
183 | } else {
184 | fs_error();
185 | }
186 | }));
187 | }), fs_error);
188 | }), fs_error);
189 | }
190 | , FS_proto = FileSaver.prototype
191 | , saveAs = function(blob, name) {
192 | return new FileSaver(blob, name);
193 | }
194 | ;
195 | FS_proto.abort = function() {
196 | var filesaver = this;
197 | filesaver.readyState = filesaver.DONE;
198 | dispatch(filesaver, "abort");
199 | };
200 | FS_proto.readyState = FS_proto.INIT = 0;
201 | FS_proto.WRITING = 1;
202 | FS_proto.DONE = 2;
203 |
204 | FS_proto.error =
205 | FS_proto.onwritestart =
206 | FS_proto.onprogress =
207 | FS_proto.onwrite =
208 | FS_proto.onabort =
209 | FS_proto.onerror =
210 | FS_proto.onwriteend =
211 | null;
212 |
213 | view.addEventListener("unload", process_deletion_queue, false);
214 | return saveAs;
215 | }(self));
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Summary
2 | =======
3 | IceBuddha a hex-viewer and generic binary file parser done via static web pages and with in-browser python-to-javascript translation for the parse scripts.
4 |
5 | Try it out
6 | - http://0xdabbad00.github.io/icebuddha/
7 | - http://icebuddha.com
8 |
9 | Contact
10 | -------
11 | IceBuddha was developed by [@0xdabbad00](https://twitter.com/0xdabbad00) (Scott Piper) from [Summmit Route](https://SummitRoute.com)
12 |
13 | License
14 | -------
15 | MIT License
16 |
17 |
18 | Thank you
19 | =========
20 | Special thanks to the following projects/people for making this site possible:
21 | - [skulpt](http://www.skulpt.org/) In-browser Python to JavaScript compiler. This project is insane. (MIT license)
22 | - [jqTree](http://mbraak.github.io/jqTree/) Allows me to show my tree view of the parsed data. (Apache license)
23 | - [jQuery.ScrollTo](http://flesler.blogspot.com/2007/10/jqueryscrollto.html) Makes the browser scroll. (MIT and GPL licenses)
24 | - [Waypoints](http://imakewebthings.com/jquery-waypoints/) Causes events to occur when you scroll. (MIT and GPL licenses)
25 | - [ACE editor](http://ace.c9.io/#nav=about) Code-editor. (BSD license)
26 | - [FileSaver.js](https://github.com/eligrey/FileSaver.js) and [BlobBuilder.js](https://github.com/eligrey/BlobBuilder.js), which I use to have the user download files from their browser (MIT/X11 license).
27 |
--------------------------------------------------------------------------------
/about.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ice Buddha
4 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
Motive
16 | The goal of IceBuddha is to become a general purpose binary file parser to help me learn some things and try out some ideas. I'm doing this because I think it's an interesting idea, and with no goal of financial gain (just street cred).
17 |
18 |
19 |
20 |
Contact me
21 | Email me at 0xdabbad00 – at – gmail.com or read what I'm up to on my main site
0xdabbad00.com .
22 |
23 |
Thank you!
24 | Thanks to the following projects/people for making this site possible:
25 |
jqTree (Apache license) Allows me to show my tree view of the parsed data.
26 |
jQuery.ScrollTo (MIT and GPL licenses) Makes the browser scroll.
27 |
Waypoints (MIT and GPL licenses) Causes events to occur when you scroll.
28 |
ACE editor (BSD license?) Code-editor.
29 |
Eli Grey for
FileSaver.js and
BlobBuilder.js , which I use to download files (MIT/X11 license).
30 |
skulpt (MIT license) In-browser Python to JavaScript compiler.
31 |
32 |
PEG.js (MIT license) No longer used, but still appreciate them for it I was using it.
33 |
34 |
35 |
Thanks in advance
36 |
Bruno for writing my auto-complete code in
his answer to my question on stackoverflow.
37 |
38 |
39 |
Privacy Policy
40 | I don't collect any data. Everything is happening locally, client side on your system. It's all javascript and html, so I invite you to not only review my code on
github , but host this site locally. Or better yet, fork it and send me fixes/features! Most of the site should work by just downloading it and browsing to it on your local hard-drive, even without a web server (some code does currently grab files from my server but I'm trying to figure out a smarter way to handle that). I host this site on amazon EC2 because most free hosting tracks users. I believe strongly in privacy, and frankly I'm too stupid to know how to profit from your use of this site.
41 |
42 |
I do want to eventually incorporate some wiki capabilities into this site which will mean some server side code, but I still will refrain from sending home any data you are not specifically requesting my server receive.
43 |
44 |
45 |
46 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ace/ext-static_highlight.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text"],function(e,t,n){var r=e("../edit_session").EditSession,i=e("../layer/text").Text,s=".ace_editor {font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;font-size: 12px;}.ace_editor .ace_gutter { width: 25px !important;display: block;float: left;text-align: right; padding: 0 3px 0 0; margin-right: 3px;}.ace_line { clear: both; }*.ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;}";t.render=function(e,t,n,o,u){o=parseInt(o||1,10);var a=new r("");a.setMode(t),a.setUseWorker(!1);var f=new i(document.createElement("div"));f.setSession(a),f.config={characterWidth:10,lineHeight:20},a.setValue(e);var l=[],c=a.getLength();for(var h=0;h"),u||l.push(""+(h+o)+" "),f.$renderLine(l,h,!0,!1),l.push("");var p="".replace(/:cssClass/,n.cssClass).replace(/:code/,l.join(""));return f.destroy(),{css:s+n.cssText,html:p}}})
--------------------------------------------------------------------------------
/ace/ext-textarea.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate","ace/mode/text"],function(e,t,n){function a(e,t){for(var n in t)e.style[n]=t[n]}function f(e,t){if(e.type!="textarea")throw"Textarea required!";var n=e.parentNode,i=document.createElement("div"),s=function(){var t="position:relative;";["margin-top","margin-left","margin-right","margin-bottom"].forEach(function(n){t+=n+":"+u(e,i,n)+";"});var n=u(e,i,"width")||e.clientWidth+"px",r=u(e,i,"height")||e.clientHeight+"px";t+="height:"+r+";width:"+n+";",t+="display:inline-block;",i.setAttribute("style",t)};r.addListener(window,"resize",s),s(),e.nextSibling?n.insertBefore(i,e.nextSibling):n.appendChild(i);while(n!==document){if(n.tagName.toUpperCase()==="FORM"){var o=n.onsubmit;n.onsubmit=function(n){e.innerHTML=t(),e.value=t(),o&&o.call(this,n)};break}n=n.parentNode}return i}function l(t,n,r){s.loadScript(t,function(){e([n],r)})}function c(n,r,i,s,o,u){function c(e){return e=="true"}var a=n.getSession(),f=n.renderer;u=u||l,n.setDisplaySettings=function(e){e==null&&(e=i.style.display=="none"),i.style.display=e?"block":"none"},n.setOption=function(t,i){if(o[t]==i)return;switch(t){case"gutter":f.setShowGutter(c(i));break;case"mode":i!="text"?u("mode-"+i+".js","ace/mode/"+i,function(){var t=e("../mode/"+i).Mode;a.setMode(new t)}):a.setMode(new(e("../mode/text").Mode));break;case"theme":i!="textmate"?u("theme-"+i+".js","ace/theme/"+i,function(){n.setTheme("ace/theme/"+i)}):n.setTheme("ace/theme/textmate");break;case"fontSize":r.style.fontSize=i;break;case"softWrap":switch(i){case"off":a.setUseWrapMode(!1),f.setPrintMarginColumn(80);break;case"40":a.setUseWrapMode(!0),a.setWrapLimitRange(40,40),f.setPrintMarginColumn(40);break;case"80":a.setUseWrapMode(!0),a.setWrapLimitRange(80,80),f.setPrintMarginColumn(80);break;case"free":a.setUseWrapMode(!0),a.setWrapLimitRange(null,null),f.setPrintMarginColumn(80)}break;case"useSoftTabs":a.setUseSoftTabs(c(i));break;case"showPrintMargin":f.setShowPrintMargin(c(i));break;case"showInvisibles":n.setShowInvisibles(c(i))}o[t]=i},n.getOption=function(e){return o[e]},n.getOptions=function(){return o};for(var h in t.options)n.setOption(h,t.options[h]);return n}function h(e,t,n,i){function f(e,t,n,r){e.push("");for(var i in n)e.push("",n[i]," ");e.push(" ")}var s={"true":!0,"false":!1},o={mode:"Mode:",gutter:"Display Gutter:",theme:"Theme:",fontSize:"Font Size:",softWrap:"Soft Wrap:",showPrintMargin:"Show Print Margin:",useSoftTabs:"Use Soft Tabs:",showInvisibles:"Show Invisibles"},u={mode:{text:"Plain",javascript:"JavaScript",xml:"XML",html:"HTML",css:"CSS",scss:"SCSS",python:"Python",php:"PHP",java:"Java",ruby:"Ruby",c_cpp:"C/C++",coffee:"CoffeeScript",json:"json",perl:"Perl",clojure:"Clojure",ocaml:"OCaml",csharp:"C#",haxe:"haXe",svg:"SVG",textile:"Textile",groovy:"Groovy",liquid:"Liquid",Scala:"Scala"},theme:{clouds:"Clouds",clouds_midnight:"Clouds Midnight",cobalt:"Cobalt",crimson_editor:"Crimson Editor",dawn:"Dawn",eclipse:"Eclipse",idle_fingers:"Idle Fingers",kr_theme:"Kr Theme",merbivore:"Merbivore",merbivore_soft:"Merbivore Soft",mono_industrial:"Mono Industrial",monokai:"Monokai",pastel_on_dark:"Pastel On Dark",solarized_dark:"Solarized Dark",solarized_light:"Solarized Light",textmate:"Textmate",twilight:"Twilight",vibrant_ink:"Vibrant Ink"},gutter:s,fontSize:{"10px":"10px","11px":"11px","12px":"12px","14px":"14px","16px":"16px"},softWrap:{off:"Off",40:"40",80:"80",free:"Free"},showPrintMargin:s,useSoftTabs:s,showInvisibles:s},a=[];a.push("Setting Value ");for(var l in i)a.push("",o[l]," "),a.push(""),f(a,l,u[l],i[l]),a.push(" ");a.push("
"),e.innerHTML=a.join("");var c=e.getElementsByTagName("select");for(var h=0;h30&&this.$data.shift()},get:function(){return this.$data[this.$data.length-1]||""},pop:function(){return this.$data.length>1&&this.$data.pop(),this.get()},rotate:function(){return this.$data.unshift(this.$data.pop()),this.get()}}})
--------------------------------------------------------------------------------
/ace/keybinding-vim.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/keyboard/vim",["require","exports","module","ace/keyboard/vim/commands","ace/keyboard/vim/maps/util","ace/lib/useragent"],function(e,t,n){var r=e("./vim/commands"),i=r.coreCommands,s=e("./vim/maps/util"),o=e("../lib/useragent"),u={i:{command:i.start},I:{command:i.startBeginning},a:{command:i.append},A:{command:i.appendEnd},"ctrl-f":{command:"gotopagedown"},"ctrl-b":{command:"gotopageup"}};t.handler={handleMacRepeat:function(e,t,n){if(t==-1)e.inputChar=n,e.lastEvent="input";else if(e.inputChar&&e.$lastHash==t&&e.$lastKey==n){if(e.lastEvent=="input")e.lastEvent="input1";else if(e.lastEvent=="input1")return!0}else e.$lastHash=t,e.$lastKey=n,e.lastEvent="keypress"},handleKeyboard:function(e,t,n,s,a){if(t!=0&&(n==""||n=="\0"))return null;t==1&&(n="ctrl-"+n);if(n=="esc"&&t==0||n=="ctrl-[")return{command:i.stop};if(e.state=="start"){o.isMac&&this.handleMacRepeat(e,t,n)&&(t=-1,n=e.inputChar);if(t==-1||t==1)return r.inputBuffer.idle&&u[n]?u[n]:{command:{exec:function(e){r.inputBuffer.push(e,n)}}};if(n.length==1&&(t==0||t==4))return{command:"null",passEvent:!0};if(n=="esc"&&t==0)return{command:i.stop}}else if(n=="ctrl-w")return{command:"removewordleft"}},attach:function(e){e.on("click",t.onCursorMove),s.currentMode!=="insert"&&r.coreCommands.stop.exec(e),e.$vimModeHandler=this},detach:function(e){e.removeListener("click",t.onCursorMove),s.noMode(e),s.currentMode="normal"},actions:r.actions,getStatusText:function(){return s.currentMode=="insert"?"INSERT":s.onVisualMode?(s.onVisualLineMode?"VISUAL LINE ":"VISUAL ")+r.inputBuffer.status:r.inputBuffer.status}},t.onCursorMove=function(e){r.onCursorMove(e.editor,e),t.onCursorMove.scheduled=!1}}),ace.define("ace/keyboard/vim/commands",["require","exports","module","ace/keyboard/vim/maps/util","ace/keyboard/vim/maps/motions","ace/keyboard/vim/maps/operators","ace/keyboard/vim/maps/aliases","ace/keyboard/vim/registers"],function(e,t,n){"never use strict";function g(e){m.previous={action:{action:{fn:e}}}}var r=e("./maps/util"),i=e("./maps/motions"),s=e("./maps/operators"),o=e("./maps/aliases"),u=e("./registers"),a=1,f=2,l=3,c=4,h=8,p=function(t,n,r){while(0t.$size.scrollerHeight&&(i=t.$size.scrollerHeight/2),t.scrollTop>r-i&&t.session.setScrollTop(r-i),t.scrollTop+t.$size.scrollerHeight0&&e.navigateLeft()),e.setOverwrite(!0),e.keyBinding.$data.buffer="",e.keyBinding.$data.state="start",this.onVisualMode=!1,this.onVisualLineMode=!1,e._emit("changeStatus"),e.commands.recording?(e.commands.toggleRecording(e),e.commands.macro):[]},visualMode:function(e,t){if(this.onVisualLineMode&&t||this.onVisualMode&&!t){this.normalMode(e);return}e.setStyle("insert-mode"),e.unsetStyle("normal-mode"),e._emit("changeStatus"),t?this.onVisualLineMode=!0:(this.onVisualMode=!0,this.onVisualLineMode=!1)},getRightNthChar:function(e,t,n,r){var i=e.getSession().getLine(t.row),s=i.substr(t.column+1).split(n);return r~!@#$%^&*|+=\[\]{}`~?]/,u=/[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/,a=/\s/,f=function(e,t){var n=e.selection;this.range=n.getRange(),t=t||n.selectionLead,this.row=t.row,this.col=t.column;var r=e.session.getLine(this.row),i=e.session.getLength();this.ch=r[this.col]||"\n",this.skippedLines=0,this.next=function(){return this.ch=r[++this.col]||this.handleNewLine(1),this.ch},this.prev=function(){return this.ch=r[--this.col]||this.handleNewLine(-1),this.ch},this.peek=function(t){var n=r[this.col+t];return n?n:t==-1?"\n":this.col==r.length-1?"\n":e.session.getLine(this.row+1)[0]||"\n"},this.handleNewLine=function(t){if(t==1)return this.col==r.length?"\n":this.row==i-1?"":(this.col=0,this.row++,r=e.session.getLine(this.row),this.skippedLines++,r[0]||"\n");if(t==-1)return this.row===0?"":(this.row--,r=e.session.getLine(this.row),this.col=r.length,this.skippedLines--,"\n")},this.debug=function(){console.log(r.substring(0,this.col)+"|"+this.ch+"'"+this.col+"'"+r.substr(this.col+1))}},l=e("../../../search").Search,c=new l,p=e("../../../range").Range;n.exports={w:new s(function(e){var t=new f(e);if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.next();else while(t.ch&&!o.test(t.ch))t.next();while(t.ch&&a.test(t.ch)&&t.skippedLines<2)t.next();return t.skippedLines==2&&t.prev(),{column:t.col,row:t.row}}),W:new s(function(e){var t=new f(e);while(t.ch&&(!a.test(t.ch)||!!a.test(t.peek(1)))&&t.skippedLines<2)t.next();return t.skippedLines==2?t.prev():t.next(),{column:t.col,row:t.row}}),b:new s(function(e){var t=new f(e);t.prev();while(t.ch&&a.test(t.ch)&&t.skippedLines>-2)t.prev();if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.prev();else while(t.ch&&!o.test(t.ch))t.prev();return t.ch&&t.next(),{column:t.col,row:t.row}}),B:new s(function(e){var t=new f(e);t.prev();while(t.ch&&(!!a.test(t.ch)||!a.test(t.peek(-1)))&&t.skippedLines>-2)t.prev();return t.skippedLines==-2&&t.next(),{column:t.col,row:t.row}}),e:new s(function(e){var t=new f(e);t.next();while(t.ch&&a.test(t.ch))t.next();if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.next();else while(t.ch&&!o.test(t.ch))t.next();return t.ch&&t.prev(),{column:t.col,row:t.row}}),E:new s(function(e){var t=new f(e);t.next();while(t.ch&&(!!a.test(t.ch)||!a.test(t.peek(1))))t.next();return{column:t.col,row:t.row}}),l:{nav:function(e){e.navigateRight()},sel:function(e){var t=e.getCursorPosition(),n=t.column,r=e.session.getLine(t.row).length;r&&n!==r&&e.selection.selectRight()}},h:{nav:function(e){var t=e.getCursorPosition();t.column>0&&e.navigateLeft()},sel:function(e){var t=e.getCursorPosition();t.column>0&&e.selection.selectLeft()}},H:{nav:function(e){var t=e.renderer.getScrollTopRow();e.moveCursorTo(t)},sel:function(e){var t=e.renderer.getScrollTopRow();e.selection.selectTo(t)}},M:{nav:function(e){var t=e.renderer.getScrollTopRow(),n=e.renderer.getScrollBottomRow(),r=t+(n-t)/2;e.moveCursorTo(r)},sel:function(e){var t=e.renderer.getScrollTopRow(),n=e.renderer.getScrollBottomRow(),r=t+(n-t)/2;e.selection.selectTo(r)}},L:{nav:function(e){var t=e.renderer.getScrollBottomRow();e.moveCursorTo(t)},sel:function(e){var t=e.renderer.getScrollBottomRow();e.selection.selectTo(t)}},k:{nav:function(e){e.navigateUp()},sel:function(e){e.selection.selectUp()}},j:{nav:function(e){e.navigateDown()},sel:function(e){e.selection.selectDown()}},i:{param:!0,sel:function(e,t,n,r){switch(r){case"w":e.selection.selectWord();break;case"W":e.selection.selectAWord();break;case"(":case"{":case"[":var i=e.getCursorPosition(),s=e.session.$findClosingBracket(r,i,/paren/);if(!s)return;var o=e.session.$findOpeningBracket(e.session.$brackets[r],i,/paren/);if(!o)return;o.column++,e.selection.setSelectionRange(p.fromPoints(o,s));break;case"'":case'"':case"/":var s=h(e,r,1);if(!s)return;var o=h(e,r,-1);if(!o)return;e.selection.setSelectionRange(p.fromPoints(o.end,s.start))}}},a:{param:!0,sel:function(e,t,n,r){switch(r){case"w":e.selection.selectAWord();break;case"W":e.selection.selectAWord();break;case"(":case"{":case"[":var i=e.getCursorPosition(),s=e.session.$findClosingBracket(r,i,/paren/);if(!s)return;var o=e.session.$findOpeningBracket(e.session.$brackets[r],i,/paren/);if(!o)return;s.column++,e.selection.setSelectionRange(p.fromPoints(o,s));break;case"'":case'"':case"/":var s=h(e,r,1);if(!s)return;var o=h(e,r,-1);if(!o)return;s.column++,e.selection.setSelectionRange(p.fromPoints(o.start,s.end))}}},f:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s){var o=e.getCursorPosition(),u=r.getRightNthChar(e,o,i,n||1);if(typeof u=="number")return o.column+=u+(s?2:1),o}}),F:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s){var o=e.getCursorPosition(),u=r.getLeftNthChar(e,o,i,n||1);if(typeof u=="number")return o.column-=u+1,o}}),t:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s){var o=e.getCursorPosition(),u=r.getRightNthChar(e,o,i,n||1);if(typeof u=="number")return o.column+=u+(s?1:0),o}}),T:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s){var o=e.getCursorPosition(),u=r.getLeftNthChar(e,o,i,n||1);if(typeof u=="number")return o.column-=u,o}}),"^":{nav:function(e){e.navigateLineStart()},sel:function(e){e.selection.selectLineStart()}},$:{nav:function(e){e.navigateLineEnd()},sel:function(e){e.selection.selectLineEnd()}},0:new s(function(e){return{row:e.selection.lead.row,column:0}}),G:{nav:function(e,t,n,r){!n&&n!==0&&(n=e.session.getLength()),e.gotoLine(n)},sel:function(e,t,n,r){!n&&n!==0&&(n=e.session.getLength()),e.selection.selectTo(n,0)}},g:{param:!0,nav:function(e,t,n,r){switch(r){case"m":console.log("Middle line");break;case"e":console.log("End of prev word");break;case"g":e.gotoLine(n||0);case"u":e.gotoLine(n||0);case"U":e.gotoLine(n||0)}},sel:function(e,t,n,r){switch(r){case"m":console.log("Middle line");break;case"e":console.log("End of prev word");break;case"g":e.selection.selectTo(n||0,0)}}},o:{nav:function(e,t,n,i){n=n||1;var s="";while(00?(e.navigateUp(),e.navigateLineEnd(),e.insert(o)):(e.session.insert({row:0,column:0},o),e.navigateUp()),r.insertMode(e))}},"%":new s(function(e){var t=/[\[\]{}()]/g,n=e.getCursorPosition(),r=e.session.getLine(n.row)[n.column];if(!t.test(r)){var i=h(e,t);if(!i)return;n=i.start}var s=e.session.findMatchingBracket({row:n.row,column:n.column+1});return s}),"{":new s(function(e){var t=e.session,n=t.selection.lead.row;while(n>0&&!/\S/.test(t.getLine(n)))n--;while(/\S/.test(t.getLine(n)))n--;return{column:0,row:n}}),"}":new s(function(e){var t=e.session,n=t.getLength(),r=t.selection.lead.row;while(r":{selFn:function(e,t,n,i){n=n||1;for(var s=0;s":var i=e.getCursorPosition();e.selection.selectLine();for(var s=0;s=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,next:"regex_allowed"},{token:"punctuation.operator",regex:/\?|\:|\,|\;|\./,next:"regex_allowed"},{token:"paren.lparen",regex:/[\[({]/,next:"regex_allowed"},{token:"paren.rparen",regex:/[\])}]/},{token:"keyword.operator",regex:/\/=?/,next:"regex_allowed"},{token:"comment",regex:/^#!.*$/},{token:"text",regex:/\s+/}],regex_allowed:[i.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment_regex_allowed"},{token:"comment",regex:"\\/\\/.*$"},{token:"string.regexp",regex:"\\/",next:"regex",merge:!0},{token:"text",regex:"\\s+"},{token:"empty",regex:"",next:"start"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/\\w*",next:"start",merge:!0},{token:"invalid",regex:/\{\d+,?(?:\d+)?}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|{\d+,?(?:\d+)?}|{,\d+}|[+*]\?|[(|)$^+*?]/},{token:"string.regexp",regex:/{|[^{\[\/\\(|)$^+*?]+/,merge:!0},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class",merge:!0},{token:"empty",regex:"",next:"start"}],regex_character_class:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex",merge:!0},{token:"constant.language.escape",regex:"-"},{token:"string.regexp.charachterclass",regex:/[^\]\-\\]+/,merge:!0},{token:"empty",regex:"",next:"start"}],function_arguments:[{token:"variable.parameter",regex:n},{token:"punctuation.operator",regex:"[, ]+",merge:!0},{token:"punctuation.operator",regex:"$",merge:!0},{token:"empty",regex:"",next:"start"}],comment_regex_allowed:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"regex_allowed"},{token:"comment",merge:!0,regex:".+"}],comment:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:'[^"\\\\]+',merge:!0},{token:"string",regex:"\\\\$",next:"qqstring",merge:!0},{token:"string",regex:'"|$',next:"start",merge:!0}],qstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"[^'\\\\]+",merge:!0},{token:"string",regex:"\\\\$",next:"qstring",merge:!0},{token:"string",regex:"'|$",next:"start",merge:!0}]},this.embedRules(i,"doc-",[i.getEndRule("start")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){var t=e.match(/^(\s+)/);return t?t[1]:""}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"],function(e,t,n){var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=0,u=-1,a="",f=function(){f.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",["text","paren.rparen"])){r=new s(t,n.row,n.column+1);if(!this.$matchTokenType(r.getCurrentToken()||"text",["text","paren.rparen"]))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",["text","comment","paren.rparen"])},f.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},f.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,a[0])||(o=0),u=r.row,a=n+i.substr(r.column),o++},f.isAutoInsertedClosing=function(e,t,n){return o>0&&e.row===u&&n===a[0]&&t.substr(e.column)===a},f.popAutoInsertedClosing=function(){a=a.substr(1),o--},this.add("braces","insertion",function(e,t,n,r,i){if(i=="{"){var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&o!=="{")return{text:"{"+o+"}",selection:!1};if(f.isSaneInsertion(n,r))return f.recordAutoInsert(n,r,"}"),{text:"{}",selection:[1,1]}}else if(i=="}"){var u=n.getCursorPosition(),a=r.doc.getLine(u.row),l=a.substring(u.column,u.column+1);if(l=="}"){var c=r.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(c!==null&&f.isAutoInsertedClosing(u,a,i))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(i=="\n"||i=="\r\n"){var u=n.getCursorPosition(),a=r.doc.getLine(u.row),l=a.substring(u.column,u.column+1);if(l=="}"){var h=r.findMatchingBracket({row:u.row,column:u.column+1});if(!h)return null;var p=this.getNextLineIndent(e,a.substring(0,a.length-1),r.getTabString()),d=this.$getIndent(r.doc.getLine(h.row));return{text:"\n"+p+"\n"+d,selection:[1,p.length,1,p.length]}}}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!=="")return{text:"("+o+")",selection:!1};if(f.isSaneInsertion(n,r))return f.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){var u=n.getCursorPosition(),a=r.doc.getLine(u.row),l=a.substring(u.column,u.column+1);if(l==")"){var c=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(c!==null&&f.isAutoInsertedClosing(u,a,i))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!=="")return{text:"["+o+"]",selection:!1};if(f.isSaneInsertion(n,r))return f.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){var u=n.getCursorPosition(),a=r.doc.getLine(u.row),l=a.substring(u.column,u.column+1);if(l=="]"){var c=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(c!==null&&f.isAutoInsertedClosing(u,a,i))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!=="")return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l=="\\")return null;var c=r.getTokens(o.start.row),h=0,p,d=-1;for(var v=0;vo.start.column)break;h+=c[v].value.length}if(!p||d<0&&p.type!=="comment"&&(p.type!=="string"||o.start.column!==p.value.length+h-1&&p.value.lastIndexOf(s)===p.value.length-1))return{text:s+s,selection:[1,1]};if(p&&p.type==="string"){var m=f.substring(a.column,a.column+1);if(m==s)return{text:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=='"')return i.end.column++,i}})};r.inherits(f,i),t.CstyleBehaviour=f}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i){var s=i.index;return i[1]?this.openingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s+i[0].length,1)}if(t!=="markbeginend")return;var i=r.match(this.foldingStopMarker);if(i){var s=i.index+i[0].length;return i[1]?this.closingBracketBlock(e,i[1],n,s):e.getCommentFoldRange(n,s,-1)}}}.call(o.prototype)})
--------------------------------------------------------------------------------
/ace/mode-python.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/mode/python",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/folding/pythonic","ace/range"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./python_highlight_rules").PythonHighlightRules,u=e("./folding/pythonic").FoldMode,a=e("../range").Range,f=function(){this.$tokenizer=new s((new o).getRules()),this.foldingRules=new u("\\:")};r.inherits(f,i),function(){this.toggleCommentLines=function(e,t,n,r){var i=!0,s=/^(\s*)#/;for(var o=n;o<=r;o++)if(!s.test(t.getLine(o))){i=!1;break}if(i){var u=new a(0,0,0,0);for(var o=n;o<=r;o++){var f=t.getLine(o),l=f.match(s);u.start.row=o,u.end.row=o,u.end.column=l[0].length,t.replace(u,l[1])}}else t.indentRows(n,r,"#")},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.$tokenizer.getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"){var o=t.match(/^.*[\{\(\[\:]\s*$/);o&&(r+=n)}return r};var e={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(t,n,r){if(r!=="\r\n"&&r!=="\r"&&r!=="\n")return!1;var i=this.$tokenizer.getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type=="comment"||s.type=="text"&&s.value.match(/^\s+$/)));return s?s.type=="keyword"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new a(n,r.length-i.length,n,r.length))}}.call(f.prototype),t.Mode=f}),ace.define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield",t="True|False|None|NotImplemented|Ellipsis|__debug__",n="abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern",r=this.createKeywordMapper({"invalid.deprecated":"debugger","support.function":n,"constant.language":t,keyword:e},"identifier"),i="(?:r|u|ur|R|U|UR|Ur|uR)?",s="(?:(?:[1-9]\\d*)|(?:0))",o="(?:0[oO]?[0-7]+)",u="(?:0[xX][\\dA-Fa-f]+)",a="(?:0[bB][01]+)",f="(?:"+s+"|"+o+"|"+u+"|"+a+")",l="(?:[eE][+-]?\\d+)",c="(?:\\.\\d+)",h="(?:\\d+)",p="(?:(?:"+h+"?"+c+")|(?:"+h+"\\.))",d="(?:(?:"+p+"|"+h+")"+l+")",v="(?:"+d+"|"+p+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:i+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:i+'"{3}.*$',next:"qqstring"},{token:"string",regex:i+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:i+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:i+"'{3}.*$",next:"qstring"},{token:"string",regex:i+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+v+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:v},{token:"constant.numeric",regex:f+"[lL]\\b"},{token:"constant.numeric",regex:f+"\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};r.inherits(s,i),t.PythonHighlightRules=s}),ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=t.FoldMode=function(e){this.foldingStartMarker=new RegExp("([\\[{])(?:\\s*)$|("+e+")(?:\\s*)(?:#.*)?$")};r.inherits(s,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i)return i[1]?this.openingBracketBlock(e,i[1],n,i.index):i[2]?this.indentationBlock(e,n,i.index+i[2].length):this.indentationBlock(e,n)}}.call(s.prototype)})
--------------------------------------------------------------------------------
/ace/theme-chrome.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/theme/chrome",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-chrome",t.cssText='.ace-chrome .ace_gutter {background: #ebebeb;color: #333;overflow : hidden;}.ace-chrome .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-chrome .ace_scroller {background-color: #FFFFFF;}.ace-chrome .ace_cursor {border-left: 2px solid black;}.ace-chrome .ace_overwrite-cursors .ace_cursor {border-left: 0px;border-bottom: 1px solid black;}.ace-chrome .ace_invisible {color: rgb(191, 191, 191);}.ace-chrome .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-chrome .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-chrome .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-chrome .ace_invalid {background-color: rgb(153, 0, 0);color: white;}.ace-chrome .ace_fold {}.ace-chrome .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-chrome .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-chrome .ace_support.ace_type,.ace-chrome .ace_support.ace_class.ace-chrome .ace_support.ace_other {color: rgb(109, 121, 222);}.ace-chrome .ace_variable.ace_parameter {font-style:italic;color:#FD971F;}.ace-chrome .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-chrome .ace_comment {color: #236e24;}.ace-chrome .ace_comment.ace_doc {color: #236e24;}.ace-chrome .ace_comment.ace_doc.ace_tag {color: #236e24;}.ace-chrome .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-chrome .ace_variable {color: rgb(49, 132, 149);}.ace-chrome .ace_xml-pe {color: rgb(104, 104, 91);}.ace-chrome .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-chrome .ace_markup.ace_heading {color: rgb(12, 7, 255);}.ace-chrome .ace_markup.ace_list {color:rgb(185, 6, 144);}.ace-chrome .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-chrome .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-chrome .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-chrome .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-chrome .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-chrome .ace_gutter-active-line {background-color : #dcdcdc;}.ace-chrome .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-chrome .ace_storage,.ace-chrome .ace_keyword,.ace-chrome .ace_meta.ace_tag {color: rgb(147, 15, 128);}.ace-chrome .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-chrome .ace_string {color: #1A1AA6;}.ace-chrome .ace_entity.ace_other.ace_attribute-name {color: #994409;}.ace-chrome .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)})
--------------------------------------------------------------------------------
/contextmenu/arrow_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0xdabbad00/icebuddha/6ebfbeb2a2ceda9a4b15f2f7fe203522ef3e8113/contextmenu/arrow_s.png
--------------------------------------------------------------------------------
/contextmenu/jquery.contextmenu.css:
--------------------------------------------------------------------------------
1 | .uctxMenu {
2 | position: absolute;
3 | z-index: 99999;
4 | border: solid 1px #979797;
5 | background: #f1f1f1;
6 | padding: 2px 0;
7 | margin: 0;
8 | top: 0;
9 | left: 0;
10 | display: none;
11 | font-family: Arial, Helvetica, sans-serif;
12 | -moz-box-shadow: 3px 3px 5px rgba(0,0,0,.3);
13 | -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,.3);
14 | box-shadow: 3px 3px 5px rgba(0,0,0,.3);
15 | }
16 | .uctxMenu ul {
17 | list-style: none;
18 | padding: 0;
19 | margin: 0;
20 | }
21 | .uctxMenu li {
22 | margin: 1px 2px;
23 | padding: 1px;
24 | color : #333;
25 | }
26 | .uctxMenu a {
27 | text-decoration: none;
28 | color: #333;
29 | display: block;
30 | line-height: 20px;
31 | height: 20px;
32 | outline: none;
33 | padding: 1px 1px 1px 1px;
34 | margin-left: 0px;
35 | border-left: 1px solid #e3e3e3;
36 | margin-top: -1px;
37 | margin-bottom: -3px;
38 | }
39 |
40 | #content .uctxMenu a {color: #333;}
41 |
42 | .uctxMenu img {
43 | float: left;
44 | margin-top: 2px;
45 | margin-left: 6px;
46 | }
47 | .uctxMenu li.separator a {
48 | border-top: 1px solid #e3e3e3;
49 | margin-top: -4px;
50 | padding-top: 5px;
51 | }
52 | .uctxMenu li.separator, .uctxMenu li.separator.hover {
53 | margin-top: 5px;
54 | }
55 | .uctxMenu li.hover {
56 | background-color: #e2ecf5;
57 | -moz-border-radius: 2px;
58 | border-radius: 3px;
59 | border: 1px solid #acd8e5;
60 | padding: 0;
61 | margin: 1px 2px;
62 | background: -moz-linear-gradient(100% 100% 90deg, #e8f2fe, #daebf3);
63 | background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#daebf3), to(#e8f2fe));
64 | background: -webkit-linear-gradient(#e8f2fe, #daebf3);
65 | background: -o-linear-gradient(#e8f2fe, #daebf3);
66 | }
67 | .uctxMenu li.disabled {
68 | color: #999;
69 | }
70 | .uctxMenu li span {
71 | background-image: url('arrow_s.png');
72 | background-position: center;
73 | background-repeat: no-repeat;
74 | width: 10px;
75 | height: 20px;
76 | float: right;
77 | }
78 | .uctxMenu li ul {
79 | margin-top: -2px;
80 | left: 180px;
81 | position: absolute;
82 | width: 180px;
83 | border: solid 1px #979797;
84 | background: #f1f1f1;
85 | display: none;
86 | top: 0;
87 | padding: 2px 0;
88 | margin: 0;
89 | -moz-box-shadow: 3px 3px 5px rgba(0,0,0,.3);
90 | -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,.3);
91 | box-shadow: 3px 3px 5px rgba(0,0,0,.3);
92 | }
--------------------------------------------------------------------------------
/contextmenu/jquery.contextmenu.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery ContextMenu
3 | * http://www.userdot.net/#!/jquery
4 | *
5 | * Copyright 2011, UserDot www.userdot.net
6 | * Licensed under the GPL Version 3 license.
7 | * Version 1.0.0
8 | *
9 | */
10 | (function($) {
11 | var classes = {
12 | popupDiv : 'uctxMenu',
13 | separator : 'separator',
14 | hover : 'hover',
15 | disabled : 'disabled'
16 | },
17 | defaults = {
18 | menu : null,
19 | mouseButton : 'right',
20 | isMenu : true,
21 | minWidth : 120,
22 | maxWidth : 0,
23 | delay : 500,
24 | keyboard : true,
25 | hoverIntent : true,
26 | onSelect : function(item) {},
27 | onLoad : function() {},
28 | onShow : function() {},
29 | onHide : function() {}
30 | },
31 | menus = [],
32 | target,
33 | methods = {
34 | init : function(options) {
35 | options = $.extend({}, defaults, options);
36 | if (!options.menu) {
37 | return false;
38 | }
39 | var $menu;
40 | if ((typeof(options.menu) === 'object') && (options.menu.constructor.toString().match(/array/i) !== null || options.menu.length)) {
41 | $menu = $('
').append(buildMenu(options.menu));
42 | $('body').append($menu);
43 | $menu.data('uctxDynamic', true);
44 | }
45 | else {
46 | $menu = $(document.getElementById(options.menu));
47 | $menu.data('uctxDynamic', false);
48 | $menu.data('uctxOriginal', $menu.clone());
49 | }
50 | return this.each(function() {
51 | var $this = $(this),
52 | eventNamespace;
53 | if (!$this.data('uctxMenu')) {
54 | eventNamespace = "uctxContext-" + (new Date().getTime());
55 | $this.data('uctxEventNamespace', eventNamespace)
56 | .data('uctxOptions', options)
57 | .data('uctxMenu', $menu)
58 | .data('uctxEnable', true);
59 | $menu.data('isMenu', options.isMenu);
60 | if (! $menu.data('uctxOwners')) {
61 | $menu.data('uctxOwners', []);
62 | }
63 | $menu.data('uctxOwners').push($this);
64 | menus.push($menu);
65 | if (options.isMenu) {
66 | methods.refresh.call($this);
67 | }
68 | else {
69 | $menu.hide();
70 | $menu.css({
71 | 'position' : 'absolute',
72 | 'z-index' : 99999
73 | });
74 | }
75 | $this.bind((((options.mouseButton === 'right') ? 'contextmenu' : 'click') + '.' + eventNamespace), function(e){
76 | target = $(e.target);
77 |
78 | if (! $this.data('uctxEnable')) {
79 | return true;
80 | }
81 | methods.show.apply($this, [e.pageX, e.pageY, options.showAnimation]);
82 | if (options.isMenu && options.keyboard) {
83 | $(window).bind('keydown.' + eventNamespace, function(even){
84 | var $currentItem;
85 | switch (event.keyCode) {
86 | case 27:
87 | $(document).trigger('click.' + eventNamespace);
88 | break;
89 | case 40:
90 | if ($menu.find('li.' + classes.hover).length === 0) {
91 | $menu.find('li:not(.disabled):first').addClass(classes.hover);
92 | }
93 | else {
94 | $currentItem = $menu.find('li.' + classes.hover + ':last');
95 | $currentItem.parent().find('li.' + classes.hover).removeClass(classes.hover).nextAll('li:not(.disabled)').eq(0).addClass(classes.hover);
96 | if ($currentItem.parent().find('li.' + classes.hover).length === 0) {
97 | $currentItem.parent().find('li:not(.disabled):first').addClass(classes.hover);
98 | }
99 | }
100 | return false;
101 | case 38:
102 | if ($menu.find('li.' + classes.hover).length === 0) {
103 | $menu.find('li:not(.disabled):first').nextAll().eq(-1).addClass(classes.hover);
104 | }
105 | else {
106 | $currentItem = $menu.find('li.' + classes.hover + ':last');
107 | $currentItem.parent().find('li.' + classes.hover).removeClass(classes.hover).prevAll('LI:not(.disabled)').eq(0).addClass(classes.hover);
108 | if ($currentItem.parent().find('li.' + classes.hover).length === 0) {
109 | $currentItem.parent().find('li:first').nextAll().eq(-1).addClass(classes.hover);
110 | }
111 | }
112 | return false;
113 | case 39:
114 | if ($menu.find('li.' + classes.hover + ' ul').length > 0) {
115 | $menu.find('li.' + classes.hover + ':last').find('ul:first').show().offset(forceViewport({
116 | top: $menu.find('li.' + classes.hover + ':last').offset().top
117 | }, $menu.find('li.' + classes.hover + ':last').find('ul:first')));
118 | $menu.find('li.' + classes.hover + ':last ul:first li:not(.disabled):first').addClass(classes.hover);
119 | }
120 | return false;
121 | case 37:
122 | if (!$menu.find('li.' + classes.hover + ':last').parent().parent().hasClass(classes.popupDiv)) {
123 | $menu.find('li.' + classes.hover + ':last').removeClass(classes.hover).parent().hide();
124 | }
125 | return false;
126 | }
127 | return true;
128 | });
129 | }
130 | else {
131 | if (options.keyboard) {
132 | $(window).bind('keydown.' + eventNamespace, function(even){
133 | if (event.keyCode === 27) {
134 | $(document).trigger('click.' + eventNamespace);
135 | }
136 | });
137 | }
138 | }
139 | $('li', $menu).each(function() {
140 | $(this).click(function() {
141 | if (!$(this).hasClass(classes.disabled)) {
142 | options.onSelect.call(this, {
143 | id : $(this).attr('id'),
144 | action : $('a:first', this).attr('href').substr(1),
145 | target: target
146 | });
147 | }
148 | });
149 | });
150 | $(document).bind('click.' + eventNamespace, function(e){
151 | $(window).unbind('keydown.' + eventNamespace);
152 | $(document).unbind('click.' + eventNamespace);
153 | $('li', $menu).unbind('click');
154 | methods.hide.call();
155 | });
156 | options.onShow.call(this);
157 | return false;
158 | });
159 | }
160 | options.onLoad.call(this);
161 | });
162 | },
163 | refresh : function(options) {
164 | var opts;
165 | return this.each(function() {
166 | var $this = $(this),
167 | $menu = $this.data('uctxMenu'),
168 | calculatedWidth,
169 | $widthTest;
170 | if ($this.data('uctxMenu').data('isMenu')) {
171 | opts = $.extend($this.data('uctxOptions'), options);
172 | if (opts.hoverIntent && ! $.fn.hoverIntent) {
173 | opts.hoverIntent = false;
174 | }
175 | $menu.removeClass(classes.popupDiv);
176 | $('li', $menu).removeClass(classes.hover);
177 | $('span', $menu).remove();
178 | $menu.addClass(classes.popupDiv);
179 | $widthTest = $('
').addClass(classes.popupDiv).appendTo('body');
180 | $('ul', $menu).each(function() {
181 | $widthTest.html('');
182 | calculatedWidth = 0;
183 | $widthTest.html($(this).html());
184 | calculatedWidth = $widthTest.width() + 16;
185 | if (calculatedWidth < opts.minWidth) {
186 | calculatedWidth = opts.minWidth;
187 | }
188 | if (calculatedWidth > opts.maxWidth && opts.maxWidth > 0){
189 | calculatedWidth = opts.maxWidth;
190 | }
191 | $(this).width(calculatedWidth);
192 | $(this).children('li').children('ul').css('left', calculatedWidth);
193 | });
194 | $widthTest.remove();
195 | $('li:has(ul)', $menu).each(function(){
196 | if (! $(this).hasClass(classes.disabled)) {
197 | $('a:first', this).append($(' '));
198 | if (opts.hoverIntent) {
199 | $(this).hoverIntent({
200 | over : function() {
201 | $('ul:first', this).show().offset(forceViewport({
202 | top: $(this).offset().top
203 | }, $('ul:first',this)));
204 | },
205 | out : function() {
206 | $('ul:first', this).hide();
207 | },
208 | timeout : opts.delay
209 | });
210 | }
211 | else {
212 | $(this).hover(function() {
213 | $('ul:first', this).show().offset(forceViewport({
214 | top: $(this).offset().top
215 | }, $(this).find('ul:first')));
216 | }, function() {
217 | $('ul:first', this).hide();
218 | });
219 | }
220 | }
221 | });
222 | $('li', $menu).each(function() {
223 | $(this).click(function() {
224 | if ($('ul', this).length < 1) {
225 | $('li', $menu).unbind('click');
226 | $menu.hide();
227 | }
228 | return false;
229 | });
230 | $(this).hover(function() {
231 | $(this).parent().find('li.' + classes.hover).removeClass(classes.hover);
232 | $(this).addClass(classes.hover);
233 | }, function() {
234 | $(this).removeClass(classes.hover);
235 | });
236 | });
237 | }
238 | });
239 | },
240 | restore : function() {
241 | return this.each(function() {
242 | var $this = $(this),
243 | $menu = $this.data('uctxMenu');
244 | $this.unbind('.' + $this.data('uctxEventNamespace'));
245 | $(window).unbind('keydown.' + $this.data('uctxEventNamespace'));
246 | $(document).unbind('click.' + $this.data('uctxEventNamespace'));
247 | $.each($menu.data('uctxOwners'), function(index) {
248 | if ($this[0] === this) {
249 | $menu.data('uctxOwners').splice(index, 1);
250 | }
251 | });
252 | if ($menu.data('uctxOwners').length < 1) {
253 | $.each(menus, function(index) {
254 | if ($menu[0] === this) {
255 | menus.splice(index, 1);
256 | }
257 | });
258 | if ($menu.data('uctxDynamic')) {
259 | $menu.remove();
260 | }
261 | else {
262 | $menu.removeClass(classes.popupDiv);
263 | $menu.replaceWith($menu.data('uctxOriginal'));
264 | }
265 | }
266 | $this.removeData('uctxEventNamespace');
267 | $this.removeData('uctxMenu');
268 | $this.removeData('uctxOptions');
269 | $this.removeData('uctxEnable');
270 | });
271 | },
272 | show : function(x, y) {
273 | if (!x || !y) {
274 | $.error('The position for the menu has not been specified');
275 | return false;
276 | }
277 | var $menu = $(this).first().data('uctxMenu');
278 | methods.hide.apply(this);
279 | $menu.show();
280 | $menu.data('uctxMenu', $(this));
281 | $menu.offset(forceViewport({
282 | top : y,
283 | left: x
284 | }, $menu, true));
285 | return this;
286 | },
287 | hide : function() {
288 | $.each(menus, function() {
289 | $('.' + classes.hover, this).removeClass(classes.hover);
290 | $('ul:first ul', this).hide();
291 | if ($(this).data('uctxMenu')) {
292 | $(this).data('uctxMenu').data('uctxOptions').onHide.call($(this).data('uctxMenu'));
293 | $(this).removeData('uctxMenu');
294 | }
295 | $(this).hide();
296 | });
297 | return this;
298 | },
299 | disable : function(item) {
300 | if (item) {
301 | var $menu = $(this).data('uctxMenu');
302 | if (item.charAt(0) === '#') {
303 | $('li' + item.replace(/ /g,'_'), $menu).addClass(classes.disabled);
304 | }
305 | else {
306 | $('a[href="' + item + '"]', $menu).parent().addClass(classes.disabled);
307 | }
308 | }
309 | else {
310 | $(this).data('uctxEnable', false);
311 | }
312 | return this;
313 | },
314 | enable : function(item) {
315 | if (item) {
316 | var $menu = $(this).data('uctxMenu');
317 | if (item.charAt(0) === '#') {
318 | $('li' + item.replace(/ /g,'_'), $menu).removeClass(classes.disabled);
319 | }
320 | else {
321 | $('a[href="' + item + '"]', $menu).parent().removeClass(classes.disabled);
322 | }
323 | }
324 | else {
325 | $(this).data('uctxEnable', true);
326 | $('li', this).each(function() {
327 | $(this).removeClass(classes.disabled);
328 | });
329 | }
330 | return this;
331 | }
332 | },
333 | forceViewport = function(position, o, mouse) {
334 | if (position.top) {
335 | if ((position.top + o.height() - $(window).scrollTop()) > $(window).height()) {
336 | if (mouse) {
337 | position.top = position.top - o.height();
338 | }
339 | else {
340 | position.top = $(window).height() + $(window).scrollTop() - o.height();
341 | }
342 | }
343 | if (position.top < $(window).scrollTop()) {
344 | position.top = $(window).scrollTop();
345 | }
346 | }
347 | if (position.left) {
348 | if ((position.left + o.width() - $(window).scrollLeft() > $(window).width())) {
349 | position.left = $(window).width() - o.width() + $(window).scrollLeft();
350 | }
351 | if (position.left < $(window).scrollLeft()) {
352 | position.left = $(window).scrollLeft();
353 | }
354 | }
355 | return position;
356 | },
357 | buildMenu = function(children) {
358 | var ul = $(''), entry, item, li;
359 | if (children) {
360 | for (entry in children) {
361 | item = children[entry];
362 | li = $(' ').attr('id' , item.id.replace(/ /g,'_')).append($(' ').attr('href', item.action?('#' + item.action):'#').text(item.text));
363 | if (item.image) {
364 | li.prepend($(' ').attr('src', item.image));
365 | }
366 | if (item.separator) {
367 | li.addClass(classes.separator);
368 | }
369 | ul.append( li );
370 | if (item.children) {
371 | li.append(buildMenu(item.children));
372 | }
373 | }
374 | }
375 | return ul;
376 | };
377 | $.fn.contextMenu = function(method) {
378 | if (methods[method]) {
379 | return methods[ method ].apply(this, Array.prototype.slice.call(arguments, 1));
380 | }
381 | else if (typeof method === 'object' || ! method) {
382 | return methods.init.apply(this, arguments);
383 | }
384 | else {
385 | $.error('Method ' + method + ' does not exist on jQuery.contextmenu');
386 | return this;
387 | }
388 | };
389 | })(jQuery);
390 |
391 |
--------------------------------------------------------------------------------
/contextmenu/jquery.hoverintent.js:
--------------------------------------------------------------------------------
1 | /**
2 | * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
3 | *
4 | *
5 | * @param f onMouseOver function || An object with configuration options
6 | * @param g onMouseOut function || Nothing (use configuration options object)
7 | * @author Brian Cherne
8 | */
9 | (function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))
2 |
3 | Ice Buddha
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
38 |
39 |
40 |
41 | Javascript must be enabled for this page to work!
42 |
43 |
44 |
45 |
46 | Drop file here
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
Check out Summit Route for end-point protection.
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
About
64 | IceBuddha is an open-source (MIT license) hex viewer and generic binary file parser that runs in the browser.
65 |
66 | See an example .
67 |
68 |
69 |
Why?
70 | I wanted to test the limits of what was possible in the browser from a static site. Because all the files are static (no database, and no server-side functionality) IceBuddha is hosted on
github pages .
71 |
72 |
Ridiculous things IceBuddha does
73 |
74 | "Submitted" files are not uploaded anywhere. Everything happens in your browser locally.
75 | If you're concerned, you can clone and host this project locally by running it in a simple web server,
76 | such as using "python -m SimpleHTTPServer" in the folder you clone the repo to.
77 | Files are parsed via >Python scripts that define the structure of the files.
78 | The python is converted to Javascript in your browser via the skulpt library.
79 | By clicking on the "Parse as" tab when you drop a file, you can see this Python code.
80 | You can then edit it, and your file will parsed again immediately using your new code.
81 | Again, this is all happening entirely in your browser without hitting the server.
82 | You can take your python parse scripts, and run them directly on files to generate JSON data, without using your browser, as explained here
83 |
84 |
Similar projects/products
85 |
010 editor : Windows & Mac (commercial), odd format for binary templates to parse files, but looks similar to C structs and is often referenced.
86 |
Synalize It! : Mac only (commercial); XML based grammar format which means limited capability for more advanced binary file formats.
87 |
88 |
File parsing
89 | IceBuddha can parse a few of the main structures in the following file types:
90 |
91 | PE files (.exe, .dll, .sys)
92 | GIF image files
93 | Mach-O (Mac OS X files)
94 |
95 |
Expanding and adding your own file parsing
96 | File types are automatically identified in drop.js via the function "ChooseParseScript". Look at
pe.py to see an example of how files are parsed.
97 |
98 | Change the PE
in the line ib = icebuddha.IceBuddha(filedata, "PE")
to be name of your file type.
99 | The line imageDosHeader = ib.parse(0, "IMAGE_DOS_HEADER", """
creates a structure at offset 0
with name IMAGE_DOS_HEADER
.
100 | Then the next lines in that file describe what is in that structure.
101 | Known variable types are:
102 |
103 | BYTE
, CHAR
, and anything unknown: 1 byte
104 | WORD
: 2 bytes
105 | DWORD
: 4 bytes
106 | ULONGLONG
: 8 bytes
107 |
108 | You can also create arrays such as WORD e_res2[10];
109 | ib
is the root object, so we then append imageDosHeader
to that. Later we append objects to imageDosHeader
110 | The line e_lfanew = imageDosHeader.getInt("e_lfanew")
gets the value of PE.IMAGE_DOS_HEADER.e_lfanew
in the file it parses, and sets the variable e_lfanew
which is then used as the offset in the next line.
111 | Usually you can specify an offset simply by using something like imageNtHeader.end()
to specify the end of the previous object.
112 | To describe a bit field, you can look at what I did for dllCharacteristics
.
113 | Finally, you just need to return everything with the lines return ib.getParseTree()
and parser = Parse()
114 | You can have loops, other functions, and other logic in your code, as shown in gif.py .
115 | You can also describe what a value means as shown with the function setMeaningFromConstants
in the file mach_o.py
116 | You can set the endianness as shown with setBigEndian
in the file mach_o.py
117 |
118 |
119 |
120 |
Project status
121 | IceBuddha is mostly abandoned (last update on 2014-11-13). It does a lot of stuff, but a lot of things are impossible for a webapp based on static files (ex. saving files).
122 |
This was my first javascript project. The codebase is not pretty.
123 |
124 |
125 |
126 |
127 |
128 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |