rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
} else if((match = request.match(/[\w.0-9$\/]/))) { var req = match[0], isAbsolute = req.charAt(0) == '/'; req = req.replace(/^\ .replace(/\.\.?\ .replace(/\ imports[0] = { from: isAbsolute ? req : resolveRelativePath(req, path), as: req };
function resolveImportRequest(path, request) { var match, imports = []; if((match = request.match(/^(from|external)\s+([\w.$]+)\s+import\s+(.*)$/))) { imports[0] = { from: resolveRelativePath(match[2], path), external: match[1] == 'external', "import": {} }; match[3].replace(/\s*([\w.$*]+)(?:\s+as\s+([\w.$]+))?/g, function(_, item, as) { imports[0]["import"][item] = as || item; }); } else if((match = request.match(/^import\s+(.*)$/))) { match[1].replace(/\s*([\w.$]+)(?:\s+as\s+([\w.$]+))?,?/g, function(_, pkg, as) { fullPkg = resolveRelativePath(pkg, path); imports[imports.length] = as ? {from: fullPkg, as: as} : {from: fullPkg, as: pkg}; }); } else { var msg = 'Invalid jsio request: jsio(\'' + request + '\')'; throw SyntaxError ? new SyntaxError(msg) : new Error(msg); } return imports; };
throw new (typeof SyntaxError != 'undefined' ? SyntaxError : Error)(result || 'invalid jsio command: jsio(\'' + request + '\')');
throw new (typeof SyntaxError != 'undefined' ? SyntaxError : Error)(String(result) || 'invalid jsio command: jsio(\'' + request + '\')');
function resolveImportRequest(context, path, request, opts) { var cmds = jsio.__cmds, imports = [], result = false; for (var i = 0, imp; imp = cmds[i]; ++i) { if ((result = imp(context, path, request, opts, imports))) { break; } } if (result !== true) { throw new (typeof SyntaxError != 'undefined' ? SyntaxError : Error)(result || 'invalid jsio command: jsio(\'' + request + '\')'); } return imports; };
return [util.splitPath(util.resolveRelativeModule(modulePath, directory) + '.js')];
return [makeModuleDef(util.resolveRelativeModule(modulePath, directory))];
resolveModulePath: function(modulePath, directory) { // resolve relative paths if(modulePath.charAt(0) == '.') { return [util.splitPath(util.resolveRelativeModule(modulePath, directory) + '.js')]; } // resolve absolute paths with respect to jsio packages/ var pathSegments = modulePath.split('.'), baseMod = pathSegments[0], pathString = pathSegments.join('/'); if (baseMod in jsio.__path) { return [util.splitPath(util.addEndSlash(jsio.__path[baseMod]) + pathString + '.js')]; } var out = [], paths = jsio.__path.__default__; for (var i = 0, len = paths.length; i < len; ++i) { var path = util.addEndSlash(paths[i]), possibility = util.splitPath(path + pathString + '.js'); possibility.baseMod = baseMod; possibility.basePath = path; out.push(possibility); } return out; },
return [util.splitPath(util.addEndSlash(jsio.__path[baseMod]) + pathString + '.js')];
return [makeModuleDef(util.buildPath(jsio.__path[baseMod], pathString))];
resolveModulePath: function(modulePath, directory) { // resolve relative paths if(modulePath.charAt(0) == '.') { return [util.splitPath(util.resolveRelativeModule(modulePath, directory) + '.js')]; } // resolve absolute paths with respect to jsio packages/ var pathSegments = modulePath.split('.'), baseMod = pathSegments[0], pathString = pathSegments.join('/'); if (baseMod in jsio.__path) { return [util.splitPath(util.addEndSlash(jsio.__path[baseMod]) + pathString + '.js')]; } var out = [], paths = jsio.__path.__default__; for (var i = 0, len = paths.length; i < len; ++i) { var path = util.addEndSlash(paths[i]), possibility = util.splitPath(path + pathString + '.js'); possibility.baseMod = baseMod; possibility.basePath = path; out.push(possibility); } return out; },
var path = util.addEndSlash(paths[i]), possibility = util.splitPath(path + pathString + '.js'); possibility.baseMod = baseMod; possibility.basePath = path; out.push(possibility);
out.push(makeModuleDef(util.buildPath(paths[i], pathString), baseMod, paths[i]));
resolveModulePath: function(modulePath, directory) { // resolve relative paths if(modulePath.charAt(0) == '.') { return [util.splitPath(util.resolveRelativeModule(modulePath, directory) + '.js')]; } // resolve absolute paths with respect to jsio packages/ var pathSegments = modulePath.split('.'), baseMod = pathSegments[0], pathString = pathSegments.join('/'); if (baseMod in jsio.__path) { return [util.splitPath(util.addEndSlash(jsio.__path[baseMod]) + pathString + '.js')]; } var out = [], paths = jsio.__path.__default__; for (var i = 0, len = paths.length; i < len; ++i) { var path = util.addEndSlash(paths[i]), possibility = util.splitPath(path + pathString + '.js'); possibility.baseMod = baseMod; possibility.basePath = path; out.push(possibility); } return out; },
function ResolveParents(field) { for (c=0;c<TreeParents[field].length;c++) {
function ResolveParents( field ) { for( var c = 0; c < TreeParents[field].length; c++ ) {
function ResolveParents(field) { for (c=0;c<TreeParents[field].length;c++) { //resolve nodeparent to internal node id var p=0;found=false; for (p=0;p<TreeID[field].length;p++) { if (TreeID[field][p]==TreeParents[field][c]) {found=true;break;} } if (found) {TreeParents[field][c]=p;} if (TreeParents[field][c]==-1) {TreeParents[field][c]=-1;} } }
var p=0;found=false; for (p=0;p<TreeID[field].length;p++) { if (TreeID[field][p]==TreeParents[field][c]) {found=true;break;} } if (found) {TreeParents[field][c]=p;} if (TreeParents[field][c]==-1) {TreeParents[field][c]=-1;}
found = false; for( var p = 0; p < TreeID[field].length; p++ ) { if ( TreeID[field][p] == TreeParents[field][c] ) { found = true; break; }
function ResolveParents(field) { for (c=0;c<TreeParents[field].length;c++) { //resolve nodeparent to internal node id var p=0;found=false; for (p=0;p<TreeID[field].length;p++) { if (TreeID[field][p]==TreeParents[field][c]) {found=true;break;} } if (found) {TreeParents[field][c]=p;} if (TreeParents[field][c]==-1) {TreeParents[field][c]=-1;} } }
}
function ResolveParents(field) { for (c=0;c<TreeParents[field].length;c++) { //resolve nodeparent to internal node id var p=0;found=false; for (p=0;p<TreeID[field].length;p++) { if (TreeID[field][p]==TreeParents[field][c]) {found=true;break;} } if (found) {TreeParents[field][c]=p;} if (TreeParents[field][c]==-1) {TreeParents[field][c]=-1;} } }
i = 0, j = -1,
resolveRelativeModule: function(modulePath, directory) { /* ...test -> ../../test .test -> ./test foo..test -> test .foo..test -> ./test foo...test -> ../test */ var result = [], parts = modulePath.split('.'), i = 0, j = -1, len = parts.length, relative = false; if (len > 1 && !parts[0]) { relative = true; ++i; } do { if (!parts[i]) { if (j >= 0 && result[j].charAt(0) == '.') { result.pop(); --j; } else { result.push('..'); ++j; } } else { result.push(parts[i]); ++j; } } while(++i < len); result = result.join('/'); return relative ? util.resolveRelativePath(directory + result) : result; },
relative = false;
relative = (len > 1 && !parts[0]), i = relative ? 0 : -1;
resolveRelativeModule: function(modulePath, directory) { /* ...test -> ../../test .test -> ./test foo..test -> test .foo..test -> ./test foo...test -> ../test */ var result = [], parts = modulePath.split('.'), i = 0, j = -1, len = parts.length, relative = false; if (len > 1 && !parts[0]) { relative = true; ++i; } do { if (!parts[i]) { if (j >= 0 && result[j].charAt(0) == '.') { result.pop(); --j; } else { result.push('..'); ++j; } } else { result.push(parts[i]); ++j; } } while(++i < len); result = result.join('/'); return relative ? util.resolveRelativePath(directory + result) : result; },
if (len > 1 && !parts[0]) { relative = true; ++i; } do { if (!parts[i]) { if (j >= 0 && result[j].charAt(0) == '.') { result.pop(); --j; } else { result.push('..'); ++j; } } else { result.push(parts[i]); ++j; } } while(++i < len); result = result.join('/'); return relative ? util.resolveRelativePath(directory + result) : result;
while(++i < len) { result.push(parts[i] ? parts[i] : '..'); } return util.buildPath(relative ? directory : '', result.join('/'));
resolveRelativeModule: function(modulePath, directory) { /* ...test -> ../../test .test -> ./test foo..test -> test .foo..test -> ./test foo...test -> ../test */ var result = [], parts = modulePath.split('.'), i = 0, j = -1, len = parts.length, relative = false; if (len > 1 && !parts[0]) { relative = true; ++i; } do { if (!parts[i]) { if (j >= 0 && result[j].charAt(0) == '.') { result.pop(); --j; } else { result.push('..'); ++j; } } else { result.push(parts[i]); ++j; } } while(++i < len); result = result.join('/'); return relative ? util.resolveRelativePath(directory + result) : result; },
do { var oldPath = path; } while(oldPath != (path = path.replace(/(^|\/)(?!\.\.\/)([^\/]+)\/\.\.\
path = path.replace(/\/\ var o; while((o = path) != (path = path.replace(/(^|\/)(?!\.?\.\/)([^\/]+)\/\.\.\ }
resolveRelativePath: function(path) { do { var oldPath = path; } while(oldPath != (path = path.replace(/(^|\/)(?!\.\.\/)([^\/]+)\/\.\.\//g, '/'))); return path; },
while((o = path) != (path = path.replace(/(^|\/)(?!\.?\.\/)([^\/]+)\/\.\.\ }
while((o = path) != (path = path.replace(/(^|\/)(?!\.?\.\/)([^\/]+)\/\.\.\
resolveRelativePath: function(path) { path = path.replace(/\/\//g, '/').replace(/\/\.\//g, '/'); var o; while((o = path) != (path = path.replace(/(^|\/)(?!\.?\.\/)([^\/]+)\/\.\.\//g, '/'))) { print('| RESOLVE', path) } return path; },
function resolveRelativePath(modulePath, path, pathSep) { if(!path || (pathSep = pathSep || '.') != modulePath.charAt(0)) { return modulePath; } path += '.' + modulePath; do { var oldPath = path; } while(oldPath != (path = path.replace(/\.[^.]+\.\./g, '.'))); return path; }
resolveRelativePath: function(path) { do { var oldPath = path; } while(oldPath != (path = path.replace(/(^|\/)(?!\.\.\/)([^\/]+)\/\.\.\ return path; },
function resolveRelativePath(modulePath, path, pathSep) { // does the modulePath need to be resolved, i.e. is it a relative path? if(!path || (pathSep = pathSep || '.') != modulePath.charAt(0)) { return modulePath; } path += '.' + modulePath; do { var oldPath = path; } while(oldPath != (path = path.replace(/\.[^.]+\.\./g, '.'))); return path; }
var i = 1; while(modulePath.charAt(i) == pathSep) { ++i; } path = path.split(pathSep).slice(0, -i); if(path.length) { path = path.join(pathSep); if(path.charAt(path.length - 1) != pathSep) { path += pathSep; } } return path + modulePath.substring(i);
path += '.' + modulePath; do { var oldPath = path; } while(oldPath != (path = path.replace(/\.[^.]+\.\./g, '.'))); return path;
function resolveRelativePath(modulePath, path, pathSep) { // does the modulePath need to be resolved, i.e. is it a relative path? if(!path || (pathSep = pathSep || '.') != modulePath.charAt(0)) { return modulePath; } var i = 1; while(modulePath.charAt(i) == pathSep) { ++i; } path = path.split(pathSep).slice(0, -i); if(path.length) { path = path.join(pathSep); if(path.charAt(path.length - 1) != pathSep) { path += pathSep; } } return path + modulePath.substring(i); }
function resolveRelativePath(pkg, path, pathSep) { if(!path || (pathSep = pathSep || '.') != pkg.charAt(0)) { return pkg; }
function resolveRelativePath(modulePath, path, pathSep) { if(!path || (pathSep = pathSep || '.') != modulePath.charAt(0)) { return modulePath; }
function resolveRelativePath(pkg, path, pathSep) { // does the pkg need to be resolved, i.e. is it a relative path? if(!path || (pathSep = pathSep || '.') != pkg.charAt(0)) { return pkg; } var i = 1; while(pkg.charAt(i) == pathSep) { ++i; } path = path.split(pathSep).slice(0, -i); if(path.length) { path = path.join(pathSep); if(path.charAt(path.length - 1) != pathSep) { path += pathSep; } } return path + pkg.substring(i); }
while(pkg.charAt(i) == pathSep) { ++i; }
while(modulePath.charAt(i) == pathSep) { ++i; }
function resolveRelativePath(pkg, path, pathSep) { // does the pkg need to be resolved, i.e. is it a relative path? if(!path || (pathSep = pathSep || '.') != pkg.charAt(0)) { return pkg; } var i = 1; while(pkg.charAt(i) == pathSep) { ++i; } path = path.split(pathSep).slice(0, -i); if(path.length) { path = path.join(pathSep); if(path.charAt(path.length - 1) != pathSep) { path += pathSep; } } return path + pkg.substring(i); }
return path + pkg.substring(i);
return path + modulePath.substring(i);
function resolveRelativePath(pkg, path, pathSep) { // does the pkg need to be resolved, i.e. is it a relative path? if(!path || (pathSep = pathSep || '.') != pkg.charAt(0)) { return pkg; } var i = 1; while(pkg.charAt(i) == pathSep) { ++i; } path = path.split(pathSep).slice(0, -i); if(path.length) { path = path.join(pathSep); if(path.charAt(path.length - 1) != pathSep) { path += pathSep; } } return path + pkg.substring(i); }
respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); if (state == 'Complete') { try { this._complete = true; (this.options['on' + response.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(response, response.headerJSON); } catch (e) { this.dispatchException(e); } var contentType = response.getHeader('Content-type'); if (this.options.evalJS == 'force' || (this.options.evalJS && this.isSameOrigin() && contentType && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { this.transport.onreadystatechange = Prototype.emptyFunction; } },
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); if (state == 'Complete') { try { this._complete = true; (this.options['on' + response.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(response, response.headerJSON); } catch (e) { this.dispatchException(e); } var contentType = response.getHeader('Content-type'); if (this.options.evalJS == 'force' || (this.options.evalJS && this.isSameOrigin() && contentType && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } },
if (positions[i]) { positions[i].value = allNames[i][2]; } if (eMailAddresses[i]) { eMailAddresses[i].value = allNames[i][3]; }
function restoreSeparateNameFields() { var machineReadableField = $("tx_seminars_pi1_registration_editor_structured_attendees_names"); if (!machineReadableField || machineReadableField.value.empty() || !machineReadableField.value.isJSON()) { return; } var firstNames = $$("#tx_seminars_pi1_registration_editor_separate_names " + ".tx_seminars_pi1_registration_editor_first_name"); var lastNames = $$("#tx_seminars_pi1_registration_editor_separate_names " + ".tx_seminars_pi1_registration_editor_last_name"); if (firstNames.length != lastNames.length) { return; } var allNames = machineReadableField.value.evalJSON(true); var numberOfNames = Math.min(firstNames.length, allNames.length); for (var i = 0; i < numberOfNames; i++) { firstNames[i].value = allNames[i][0]; lastNames[i].value = allNames[i][1]; }}
if (xpath.core.axisGuides.reverseDescendant(k) === false)
if (xpath.core.axisGuides.reverseOrderDescendant(k, cb) === false)
reverseOrderDescendant: function(n, cb) { /// @todo Re-write this function to be iterative, not recursive... if (n.hasChildNodes()) for (var k = n.lastChild; k; k = k.previousSibling) if (xpath.core.axisGuides.reverseDescendant(k) === false) return false; return cb(n) !== false; },
var index = $(this).attr('name');
var index = $(this).attr('id');
rightToLeft: function() { var self = this; $(this.right_select_id).find('option:selected').each(function(){ var index = $(this).attr('name'); self.leftSelectionsArray[index] = this; self.rightSelectionsArray[index] = null; $(this).remove(); }); this.refreshOptions(this.left_select_id,this.leftSelectionsArray); }
if (SC.typeOf(val) === SC.T_NUMBER) val += 'deg';
if (SC.typeOf(val) === SC.T_NUMBER || val === 0) val += 'deg';
rotate: function(val){ if (SC.typeOf(val) === SC.T_NUMBER) val += 'deg'; return 'rotate('+val+')'; },
return SC.FormRowView.extend({
return {
row: function(label, fieldType) { if (!fieldType) { fieldType = label; label = null; } // now, create like normal return SC.FormRowView.extend({ label: label, childViews: "_singleField".w(), _singleField: fieldType }); }
}); }
}; },
row: function(label, fieldType) { if (!fieldType) { fieldType = label; label = null; } // now, create like normal return SC.FormRowView.extend({ label: label, childViews: "_singleField".w(), _singleField: fieldType }); }
message.payload = data;
message.data = data;
rpc: function(channel, data, callback) { var replyTo = channel + "#" + dojox.cometd.clientId; console.debug("RPC:" + channel + ", " + data); console.debug("RPC: setting replyTo: " + replyTo); var message = new Object(); message.payload = data; message.replyTo = replyTo; if(mule._replyToChannels.indexOf(replyTo) == -1) { console.debug("Mule RPC: creating subscription for client: " + replyTo); dojox.cometd.subscribe(replyTo, mule, callback); mule._replyToChannels[mule._replyToChannels.length] = replyTo; console.debug("Mule RPC: subscriptions are: " + mule._replyToChannels.toString()); } var messageJson = dojo.toJson(message); console.debug("message is: " + messageJson); dojox.cometd.publish(channel, message); }
this._setupIdle();
run: function(limit) { this.set("isRunning", YES); if (!limit) limit = this.get("runLimit"); var task, start = Date.now(); while (task = this.next()) { task.run(this); // check if the limit has been exceeded if (Date.now() - start > limit) break; } // set up idle timer if needed this._setupIdle(); this.set("isRunning", NO); }
&& result !== null) {
&& result !== null && example.output) {
doctest.JSRunner.prototype.run = function (example) { this.capturer = new doctest.OutputCapturer(); this.capturer.capture(); try { var result = window.eval(example.example); } catch (e) { writeln('Error: ' + (e.message || e)); var result = null; logDebug('Traceback for error', e); if (e.stack) { var stack = e.stack.split('\n'); for (var i=0; i<stack.length; i++) { if (stack[i] == '@:0' || ! stack[i]) { continue; } var parts = stack[i].split('@'); var context = parts[0]; parts = parts[1].split(':'); var filename = parts[parts.length-2].split('/'); filename = filename[filename.length-1]; var lineno = parts[parts.length-1]; if (context != '' && filename != 'jsdoctest.js') { logDebug(' ' + context + ' -> '+filename+':'+lineno); } } } } if (typeof result != 'undefined' && result !== null) { writeln(doctest.repr(result)); }};
run: function () { func.apply(self, args); }
run: function () { func.apply(self, args || []); }
run: function () { func.apply(self, args); }
process.run(blocking, args.map(String), args.length);
process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) liberator.threadYield(false, true); } catch (e) { process.kill(); throw e; }
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = File(program, true); else { let dirs = services.get("environment").get("PATH").split(liberator.has("Win32") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (liberator.has("Win32")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (liberator.has("Win32")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { liberator.callInMainThread(function() { if (services.get("threadManager").isMainThread) // does not really seem to work but at least doesn't crash Firefox liberator.echoerr("Command not found: " + program); }, this); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
dirs = [io.getCurrentDirectory().path].concat(dirs);
dirs = [io.cwd].concat(dirs);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("WINNT") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("WINNT")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("WINNT")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
file = File.joinPaths(dir, program);
file = File.joinPaths(dir, program, io.cwd);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("WINNT") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("WINNT")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("WINNT")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
file = File.joinPaths(dir, program + extension);
file = File.joinPaths(dir, program + extension, io.cwd);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("WINNT") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("WINNT")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("WINNT")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
let isMain = services.get("threading").isMainThread;
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); let isMain = services.get("threading").isMainThread; process.init(file); process.run(blocking && !isMain, args.map(String), args.length); try { if (blocking && isMain) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
process.run(blocking && !isMain, args.map(String), args.length);
process.run(false, args.map(String), args.length);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); let isMain = services.get("threading").isMainThread; process.init(file); process.run(blocking && !isMain, args.map(String), args.length); try { if (blocking && isMain) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
if (blocking && isMain)
if (blocking)
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); let isMain = services.get("threading").isMainThread; process.init(file); process.run(blocking && !isMain, args.map(String), args.length); try { if (blocking && isMain) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":");
let dirs = services.get("environment").get("PATH").split(dactyl.has("WINNT") ? ";" : ":");
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("Win32")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("Win32")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
if (dactyl.has("Win32"))
if (dactyl.has("WINNT"))
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("Win32")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("Win32")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
if (dactyl.has("Win32")) {
if (dactyl.has("WINNT")) {
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (dactyl.has("Win32")) dirs = [io.getCurrentDirectory().path].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (dactyl.has("Win32")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(blocking, args.map(String), args.length); return process.exitValue; },
process.run(false, args.map(String), args.length);
process.run(blocking && !isMain, args.map(String), args.length);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(util.isOS("WINNT") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.isOS("WINNT")) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.isOS("WINNT")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
if (blocking)
if (blocking && isMain)
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.get("environment").get("PATH").split(util.isOS("WINNT") ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.isOS("WINNT")) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.isOS("WINNT")) { let extensions = services.get("environment").get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.create("process"); process.init(file); process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
logDebug('Error in expression: ' + example.example);
logWarn('Error in expression: ' + example.example);
doctest.JSRunner.prototype.run = function (example) { this.capturer = new doctest.OutputCapturer(); this.capturer.capture(); try { var result = window.eval(example.example); } catch (e) { writeln('Error: ' + (e.message || e)); var result = null; logDebug('Error in expression: ' + example.example); logDebug('Traceback for error', e); doctest.logTraceback(e); } if (typeof result != 'undefined' && result !== null && example.output) { writeln(doctest.repr(result)); }};
doctest.logTraceback(e);
if (tracebackLines) { for (var i=0; i<tracebackLines.length; i++) { logDebug(tracebackLines[i]); } }
doctest.JSRunner.prototype.run = function (example) { this.capturer = new doctest.OutputCapturer(); this.capturer.capture(); try { var result = window.eval(example.example); } catch (e) { writeln('Error: ' + (e.message || e)); var result = null; logDebug('Error in expression: ' + example.example); logDebug('Traceback for error', e); doctest.logTraceback(e); } if (typeof result != 'undefined' && result !== null && example.output) { writeln(doctest.repr(result)); }};
try {
if (SC.ExceptionHandler && SC.ExceptionHandler.enabled) { try { if(forceNested || !alreadyRunning) SC.RunLoop.begin(); if (callback) callback.call(target); if(forceNested || !alreadyRunning) SC.RunLoop.end(); } catch (e) { SC.ExceptionHandler.handleException(e); if (!SC.browser.msie) { throw e; } } } else {
SC.run = function(callback, target, forceNested) { var alreadyRunning = SC.RunLoop.isRunLoopInProgress(); try { if(forceNested || !alreadyRunning) SC.RunLoop.begin(); if (callback) callback.call(target); if(forceNested || !alreadyRunning) SC.RunLoop.end(); } catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } // Now that we've handled the exception, throw it again so the browser // can deal with it (and potentially use it for debugging). // (We don't throw it in IE because the user will see two errors) if (!SC.browser.msie) { throw e; } }};
} catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } if (!SC.browser.msie) { throw e; }
SC.run = function(callback, target, forceNested) { var alreadyRunning = SC.RunLoop.isRunLoopInProgress(); try { if(forceNested || !alreadyRunning) SC.RunLoop.begin(); if (callback) callback.call(target); if(forceNested || !alreadyRunning) SC.RunLoop.end(); } catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } // Now that we've handled the exception, throw it again so the browser // can deal with it (and potentially use it for debugging). // (We don't throw it in IE because the user will see two errors) if (!SC.browser.msie) { throw e; } }};
blocking = !!blocking;
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.environment.get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.environment.get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.Process(); process.init(file); process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
let process = services.Process(); process.init(file);
let process = services.Process(file);
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.environment.get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.environment.get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.Process(); process.init(file); process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
if (blocking)
if (callable(blocking)) var timer = services.Timer( function () { if (!process.isRunning) { timer.cancel(); callback(); } }, 100, services.Timer.TYPE_REPEATING_SLACK); else if (blocking)
run: function (program, args, blocking) { args = args || []; blocking = !!blocking; let file; if (File.isAbsolutePath(program)) file = io.File(program, true); else { let dirs = services.environment.get("PATH").split(util.OS.isWindows ? ";" : ":"); // Windows tries the CWD first TODO: desirable? if (util.OS.isWindows) dirs = [io.cwd].concat(dirs);lookup: for (let [, dir] in Iterator(dirs)) { file = File.joinPaths(dir, program, io.cwd); try { if (file.exists()) break; // TODO: couldn't we just palm this off to the start command? // automatically try to add the executable path extensions on windows if (util.OS.isWindows) { let extensions = services.environment.get("PATHEXT").split(";"); for (let [, extension] in Iterator(extensions)) { file = File.joinPaths(dir, program + extension, io.cwd); if (file.exists()) break lookup; } } } catch (e) {} } } if (!file || !file.exists()) { dactyl.echoerr("Command not found: " + program); return -1; } let process = services.Process(); process.init(file); process.run(false, args.map(String), args.length); try { if (blocking) while (process.isRunning) util.threadYield(false, true); } catch (e) { process.kill(); throw e; } return process.exitValue; },
if (e instanceof Abort) { throw e; }
doctest.JSRunner.prototype.run = function (example) { this.capturer = new doctest.OutputCapturer(); this.capturer.capture(); try { var result = window.eval(example.example); } catch (e) { var tracebackLines = doctest.formatTraceback(e); writeln('Error: ' + (e.message || e)); var result = null; logWarn('Error in expression: ' + example.example); logDebug('Traceback for error', e); if (tracebackLines) { for (var i=0; i<tracebackLines.length; i++) { logDebug(tracebackLines[i]); } } } if (typeof result != 'undefined' && result !== null && example.output) { writeln(doctest.repr(result)); }};
try {
if (SC.ExceptionHandler && SC.ExceptionHandler.enabled) { try { SC.RunLoop.begin(); if (callback) callback.call(target); SC.RunLoop.end(); } catch (e) { SC.ExceptionHandler.handleException(e); if (!SC.browser.msie) { throw e; } } } else {
SC.run = function(callback, target, useExistingRunLoop) { if(useExistingRunLoop) { var alreadyRunning = SC.RunLoop.isRunLoopInProgress(); if(!alreadyRunning) SC.RunLoop.begin(); callback.call(target); if(!alreadyRunning) SC.RunLoop.end(); } else { try { SC.RunLoop.begin(); if (callback) callback.call(target); SC.RunLoop.end(); } catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } // Now that we've handled the exception, throw it again so the browser // can deal with it (and potentially use it for debugging). // (We don't throw it in IE because the user will see two errors) if (!SC.browser.msie) { throw e; } } }};
} catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } if (!SC.browser.msie) { throw e; }
SC.run = function(callback, target, useExistingRunLoop) { if(useExistingRunLoop) { var alreadyRunning = SC.RunLoop.isRunLoopInProgress(); if(!alreadyRunning) SC.RunLoop.begin(); callback.call(target); if(!alreadyRunning) SC.RunLoop.end(); } else { try { SC.RunLoop.begin(); if (callback) callback.call(target); SC.RunLoop.end(); } catch (e) { if (SC.ExceptionHandler) { SC.ExceptionHandler.handleException(e); } // Now that we've handled the exception, throw it again so the browser // can deal with it (and potentially use it for debugging). // (We don't throw it in IE because the user will see two errors) if (!SC.browser.msie) { throw e; } } }};
function run(path, cmd, opts, inlineOpts) { var newOpts = JS.merge({dontCompileJsio: true}, opts, inlineOpts); if (newOpts.preprocessors) { for (var i = 0, len = newOpts.preprocessors.length; i < len; ++i) { if (newOpts.preprocessors[i] == 'compiler') { break; } } if (i == len) { newOpts.preprocessors.push('compiler'); } } else { newOpts.preprocessors = ['compiler']; } logger.info(path, cmd, newOpts); JSIO.__importer({}, path, cmd, newOpts);
function run(moduleDef, cmd, opts, inlineOpts) { var newOpts = mergeOpts(opts, inlineOpts); logger.info('from', moduleDef.directory + moduleDef.filename + ': ', cmd, newOpts); JSIO.__importer({}, moduleDef.directory, moduleDef.filename, cmd, newOpts);
function run(path, cmd, opts, inlineOpts) { var newOpts = JS.merge({dontCompileJsio: true}, opts, inlineOpts); // add compiler to the end of the preprocessors list if (newOpts.preprocessors) { for (var i = 0, len = newOpts.preprocessors.length; i < len; ++i) { if (newOpts.preprocessors[i] == 'compiler') { break; } } if (i == len) { newOpts.preprocessors.push('compiler'); } } else { newOpts.preprocessors = ['compiler']; } logger.info(path, cmd, newOpts); JSIO.__importer({}, path, cmd, newOpts);}
run: function () { func.apply(self, args); }
run: function () { func.apply(self, args || []); }
function Runnable(self, func, args) { return { QueryInterface: XPCOMUtils.generateQI([Ci.nsIRunnable]), run: function () { func.apply(self, args); } };}
var time = 0.1;
var time = 100; var maxTime = doctest._waitTimeout || doctest.defaultTimeout;
doctest.JSRunner.prototype.runParsed = function (parsed, index, finishedCallback) { var self = this; index = index || 0; if (index >= parsed.examples.length) { if (finishedCallback) { finishedCallback(); } return; } var example = parsed.examples[index]; if (typeof example == 'undefined') { throw('Undefined example (' + (index+1) + ' of ' + parsed.examples.length + ')'); } doctest._waitCond = null; this.run(example); var finishThisRun = function () { self.finishRun(example); self.runParsed(parsed, index+1, finishedCallback); }; if (doctest._waitCond !== null) { if (typeof doctest._waitCond == 'number') { var condition = null; var time = 0; } else { var condition = doctest._waitCond; // FIXME: shouldn't be hard-coded var time = 0.1; } var timeoutFunc = function () { if (condition === null || condition()) { finishThisRun(); } else { // Condition not met, try again soon... logDebug('Condition not met, trying again later'); setTimeout(timeoutFunc, time); } }; setTimeout(timeoutFunc, time); } else { finishThisRun(); }};
logDebug('Condition not met, trying again later');
if ((new Date()).getTime() - start > maxTime) { var msg = 'Error: wait(' + repr(condition) + ') has timed out'; writeln(msg); logDebug(msg); logDebug('Timeout after ' + ((new Date()).getTime() - start) + ' milliseconds'); finishThisRun(); return; }
doctest.JSRunner.prototype.runParsed = function (parsed, index, finishedCallback) { var self = this; index = index || 0; if (index >= parsed.examples.length) { if (finishedCallback) { finishedCallback(); } return; } var example = parsed.examples[index]; if (typeof example == 'undefined') { throw('Undefined example (' + (index+1) + ' of ' + parsed.examples.length + ')'); } doctest._waitCond = null; this.run(example); var finishThisRun = function () { self.finishRun(example); self.runParsed(parsed, index+1, finishedCallback); }; if (doctest._waitCond !== null) { if (typeof doctest._waitCond == 'number') { var condition = null; var time = 0; } else { var condition = doctest._waitCond; // FIXME: shouldn't be hard-coded var time = 0.1; } var timeoutFunc = function () { if (condition === null || condition()) { finishThisRun(); } else { // Condition not met, try again soon... logDebug('Condition not met, trying again later'); setTimeout(timeoutFunc, time); } }; setTimeout(timeoutFunc, time); } else { finishThisRun(); }};
var time = 0;
var time = doctest._waitCond;
doctest.JSRunner.prototype.runParsed = function (parsed, index, finishedCallback) { var self = this; index = index || 0; if (index >= parsed.examples.length) { if (finishedCallback) { finishedCallback(); } return; } var example = parsed.examples[index]; if (typeof example == 'undefined') { throw('Undefined example (' + (index+1) + ' of ' + parsed.examples.length + ')'); } doctest._waitCond = null; this.run(example); var finishThisRun = function () { self.finishRun(example); self.runParsed(parsed, index+1, finishedCallback); }; if (doctest._waitCond !== null) { if (typeof doctest._waitCond == 'number') { var condition = null; var time = 0; var maxTime = null; } else { var condition = doctest._waitCond; // FIXME: shouldn't be hard-coded var time = 100; var maxTime = doctest._waitTimeout || doctest.defaultTimeout; } var start = (new Date()).getTime(); var timeoutFunc = function () { if (condition === null || condition()) { finishThisRun(); } else { // Condition not met, try again soon... if ((new Date()).getTime() - start > maxTime) { // Time has run out var msg = 'Error: wait(' + repr(condition) + ') has timed out'; writeln(msg); logDebug(msg); logDebug('Timeout after ' + ((new Date()).getTime() - start) + ' milliseconds'); finishThisRun(); return; } setTimeout(timeoutFunc, time); } }; setTimeout(timeoutFunc, time); } else { finishThisRun(); }};
if (doctest._AbortCalled) { logWarn('Abort() called'); return; }
doctest.JSRunner.prototype.runParsed = function (parsed, index, finishedCallback) { var self = this; index = index || 0; if (index >= parsed.examples.length) { if (finishedCallback) { finishedCallback(); } return; } var example = parsed.examples[index]; if (typeof example == 'undefined') { throw('Undefined example (' + (index+1) + ' of ' + parsed.examples.length + ')'); } doctest._waitCond = null; this.run(example); var finishThisRun = function () { self.finishRun(example); self.runParsed(parsed, index+1, finishedCallback); }; if (doctest._waitCond !== null) { if (typeof doctest._waitCond == 'number') { var condition = null; var time = doctest._waitCond; var maxTime = null; } else { var condition = doctest._waitCond; // FIXME: shouldn't be hard-coded var time = 100; var maxTime = doctest._waitTimeout || doctest.defaultTimeout; } var start = (new Date()).getTime(); var timeoutFunc = function () { if (condition === null || condition()) { finishThisRun(); } else { // Condition not met, try again soon... if ((new Date()).getTime() - start > maxTime) { // Time has run out var msg = 'Error: wait(' + repr(condition) + ') has timed out'; writeln(msg); logDebug(msg); logDebug('Timeout after ' + ((new Date()).getTime() - start) + ' milliseconds'); finishThisRun(); return; } setTimeout(timeoutFunc, time); } }; setTimeout(timeoutFunc, time); } else { finishThisRun(); }};
var failures = [];
var failures = [], run = 0;
function runTests() { var failures = []; for (var name in this) { if (name.length > 5 && name.substr(0, 5) == "test_") { try {this[name]();} catch (e) {failures.push(name + ": " + String(e));} } } if (failures.length) print(failures.length + " failures:\n " + failures.join("\n ")); else print("All passed!");}
print(run + " test run...");
function runTests() { var failures = []; for (var name in this) { if (name.length > 5 && name.substr(0, 5) == "test_") { try {this[name]();} catch (e) {failures.push(name + ": " + String(e));} } } if (failures.length) print(failures.length + " failures:\n " + failures.join("\n ")); else print("All passed!");}
if (failures.length) { print(failures.length + " failures:"); print(" " + failures.join("\n ")); } else {
if (failures.length) print(failures.length + " failures:\n " + failures.join("\n ")); else
function runTests() { var failures = []; for (var name in this) { if (name.length > 5 && name.substr(0, 5) == "test_") { try {this[name]();} catch (e) {failures.push(name + ": " + String(e));} } } if (failures.length) { print(failures.length + " failures:"); print(" " + failures.join("\n ")); } else { print("All passed!"); }}
}
function runTests() { var failures = []; for (var name in this) { if (name.length > 5 && name.substr(0, 5) == "test_") { try {this[name]();} catch (e) {failures.push(name + ": " + String(e));} } } if (failures.length) { print(failures.length + " failures:"); print(" " + failures.join("\n ")); } else { print("All passed!"); }}
completion.file(context, true, dir + context.filter);
completion.file(context, args, true, dir + context.filter);
completion.runtime = function (context) { for (let [, dir] in Iterator(options["runtimepath"])) context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); }); };
context.keys.text = function (f) f.path.substr(dir.length);
context.keys.text = function (f) this.path.substr(dir.length);
completion.runtime = function (context) { for (let [, dir] in Iterator(options["runtimepath"])) context.fork(dir, 0, this, function (context) { dir = dir.replace("/+$", "") + "/"; completion.file(context, true, dir + context.filter); context.title[0] = dir; context.keys.text = function (f) f.path.substr(dir.length); }); };
n=0;for(l=i.length;n<l;n++)for(p in t){j=t[p];o=i[n].elem;f=null;if(i[n].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==o)d.push({elem:o,fn:j})}}n=0;for(l=d.length;n<l;n++){i=d[n];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}function ra(a,b){return["live",a,b.replace(/\./g,"`").replace(/ /g,"&")].join(".")}function sa(a){return!a||!a.parentNode||a.parentNode.nodeType=== 11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
n=0;for(l=i.length;n<l;n++)for(p in t){j=t[p];o=i[n].elem;f=null;if(i[n].selector===j.selector){if(j.live==="mouseenter"||j.live==="mouseleave")f=c(a.relatedTarget).closest(j.selector)[0];if(!f||f!==o)d.push({elem:o,fn:j})}}n=0;for(l=d.length;n<l;n++){i=d[n];a.currentTarget=i.elem;a.data=i.fn.data;if(i.fn.apply(i.elem,e)===false){b=false;break}}return b}function ra(a,b){return["live",a,b.replace(/\./g,"`").replace(/ /g,"&")].join(".")}function sa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ta(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var i in f)for(var j in f[i])c.event.add(this,i,f[i][j],f[i][j].data)}}})}function ua(a,b,d){var f,e,i;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){e=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:s;f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=
let val = this._loadPreference(name, null, false); let def = this._loadPreference(name, null, true); let lib = this._loadPreference(Options.SAVED + name); if (lib == null && val != def || val != lib) {
let curval = this._loadPreference(name, null, false); let defval = this._loadPreference(name, null, true); let saved = this._loadPreference(Options.SAVED + name); if (saved == null && curval != defval || curval != saved) {
safeSetPref: function (name, value, message) { let val = this._loadPreference(name, null, false); let def = this._loadPreference(name, null, true); let lib = this._loadPreference(Options.SAVED + name); if (lib == null && val != def || val != lib) { let msg = "Warning: setting preference " + name + ", but it's changed from its default value."; if (message) msg += " " + message; dactyl.echomsg(msg); } this._storePreference(name, value); this._storePreference(Options.SAVED + name, value); },
for (let elem in values(this._modeStack))
for (let elem in array.iterValues(this._modeStack))
save: function (id, obj, prop) { if (!(id in this.boundProperties)) for (let elem in values(this._modeStack)) elem.saved[id] = { obj: obj, prop: prop, value: obj[prop] }; this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop }; },
if (!(id in this.boundProperties)) for (let elem in values(this._modeStack)) elem.saved[id] = { obj: obj, prop: prop, value: obj[prop] };
save: function (id, obj, prop) { this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop }; },
if((''+this.ps[key]) !== body) this.ps[key] = body;
if(key === 'body' && this.ps[key] !== body) delete ps['flavors']; this.ps[key] = body;
save: function(){ Object.keys(this.savers).forEach(function(key){ var body = this.savers[key].body(); if((''+this.ps[key]) !== body) this.ps[key] = body; }, this); background.TBRL.Popup.contents[this.ps.itemUrl] = this.ps; },
if(this.ps[key] !== body)
if((''+this.ps[key]) !== body)
save: function(){ Object.keys(this.savers).forEach(function(key){ var body = this.savers[key].body(); if(this.ps[key] !== body) this.ps[key] = body; }, this); background.TBRL.Popup.contents[this.ps.itemUrl] = this.ps; },
options.setPref("browser.download.lastDir", io.getCurrentDirectory().path);
options.setPref("browser.download.lastDir", io.cwd);
saveLink: function (elem, skipPrompt) { let doc = elem.ownerDocument; let url = window.makeURLAbsolute(elem.baseURI, elem.href); let text = elem.textContent; try { window.urlSecurityCheck(url, doc.nodePrincipal); // we always want to save that link relative to the current working directory options.setPref("browser.download.lastDir", io.getCurrentDirectory().path); window.saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet)); } catch (e) { dactyl.echoerr(e); } },
scan: function(pattern, iterator) { this.gsub(pattern, iterator); return String(this); },
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
scan: function(pattern, iterator) { this.gsub(pattern, iterator); return String(this); },
var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || "";
var td = toscore.toLowerCase(), tdLength = toscore.length, pivot = abb.length; if(tdLength < pivot) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score, tail, tail_score, penalty, skipped; for(; 0 < pivot; --pivot){ ahead = ad.substring(0, pivot); atail = ad.substring(pivot) || "";
scoreFor: function(toscore, abb){ if(!abb) return 0.9; var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || ""; found = td.indexOf(ahead); if(~found){ tail = toscore.slice(found+pivot) || ""; tail_score = arguments.callee(tail, atail); if(0 < tail_score){ if(found){ skipped = toscore.slice(0, found); if(/\s$/.test(skipped)){ var nws = skipped.replace(/\S/, "").length; penalty = nws + (skipped.length - nws)*0.15; } else if(/^[A-Z]/.test(toscore.slice(found))){ var nuc = skipped.replace(/[^A-Z]/, "").length; penalty = nuc + (skipped.length - nuc)*0.15; } else { penalty = skipped.length; } } score = (found + pivot - penalty + tail_score*tail.length)/tdLength; } } if(score) return score; } return 0.0; },
tail = toscore.slice(found+pivot) || "";
tail = toscore.substring(found+pivot) || "";
scoreFor: function(toscore, abb){ if(!abb) return 0.9; var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || ""; found = td.indexOf(ahead); if(~found){ tail = toscore.slice(found+pivot) || ""; tail_score = arguments.callee(tail, atail); if(0 < tail_score){ if(found){ skipped = toscore.slice(0, found); if(/\s$/.test(skipped)){ var nws = skipped.replace(/\S/, "").length; penalty = nws + (skipped.length - nws)*0.15; } else if(/^[A-Z]/.test(toscore.slice(found))){ var nuc = skipped.replace(/[^A-Z]/, "").length; penalty = nuc + (skipped.length - nuc)*0.15; } else { penalty = skipped.length; } } score = (found + pivot - penalty + tail_score*tail.length)/tdLength; } } if(score) return score; } return 0.0; },
skipped = toscore.slice(0, found);
skipped = toscore.substring(0, found);
scoreFor: function(toscore, abb){ if(!abb) return 0.9; var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || ""; found = td.indexOf(ahead); if(~found){ tail = toscore.slice(found+pivot) || ""; tail_score = arguments.callee(tail, atail); if(0 < tail_score){ if(found){ skipped = toscore.slice(0, found); if(/\s$/.test(skipped)){ var nws = skipped.replace(/\S/, "").length; penalty = nws + (skipped.length - nws)*0.15; } else if(/^[A-Z]/.test(toscore.slice(found))){ var nuc = skipped.replace(/[^A-Z]/, "").length; penalty = nuc + (skipped.length - nuc)*0.15; } else { penalty = skipped.length; } } score = (found + pivot - penalty + tail_score*tail.length)/tdLength; } } if(score) return score; } return 0.0; },
} else if(/^[A-Z]/.test(toscore.slice(found))){
} else if(/^[A-Z]/.test(toscore.substring(found))){
scoreFor: function(toscore, abb){ if(!abb) return 0.9; var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || ""; found = td.indexOf(ahead); if(~found){ tail = toscore.slice(found+pivot) || ""; tail_score = arguments.callee(tail, atail); if(0 < tail_score){ if(found){ skipped = toscore.slice(0, found); if(/\s$/.test(skipped)){ var nws = skipped.replace(/\S/, "").length; penalty = nws + (skipped.length - nws)*0.15; } else if(/^[A-Z]/.test(toscore.slice(found))){ var nuc = skipped.replace(/[^A-Z]/, "").length; penalty = nuc + (skipped.length - nuc)*0.15; } else { penalty = skipped.length; } } score = (found + pivot - penalty + tail_score*tail.length)/tdLength; } } if(score) return score; } return 0.0; },
} else { penalty = 0;
scoreFor: function(toscore, abb){ if(!abb) return 0.9; var td = toscore.toLowerCase(), tdLength = toscore.length, abbLength = abb.length; if(tdLength < abbLength) return 0.0; var ad = abb.toLowerCase(), ahead, atail, found, score = null, tail, tail_score, penalty = 0, skipped; for(var pivot = abbLength; 0 < pivot; --pivot){ ahead = ad.slice(0, pivot); atail = ad.slice(pivot) || ""; found = td.indexOf(ahead); if(~found){ tail = toscore.slice(found+pivot) || ""; tail_score = arguments.callee(tail, atail); if(0 < tail_score){ if(found){ skipped = toscore.slice(0, found); if(/\s$/.test(skipped)){ var nws = skipped.replace(/\S/, "").length; penalty = nws + (skipped.length - nws)*0.15; } else if(/^[A-Z]/.test(toscore.slice(found))){ var nuc = skipped.replace(/[^A-Z]/, "").length; penalty = nuc + (skipped.length - nuc)*0.15; } else { penalty = skipped.length; } } score = (found + pivot - penalty + tail_score*tail.length)/tdLength; } } if(score) return score; } return 0.0; },
return self;
function Script(file) { let self = plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); return self; } else self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; return self;}
else self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self;
else { self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self;
function Script(file) { let self = plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); return self; } else self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; return self;}
if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self;
if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; } plugins.contexts[file.path] = self;
function Script(file) { let self = plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); return self; } else self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; return self;}
if (self.onUnload)
if (set.has(self, "onUnload"))
function Script(file) { let self = set.has(plugins, file.path) && plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); } else { self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; } plugins.contexts[file.path] = self; return self;}
self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self;
self = update({ __proto__: plugins }, { NAME: file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()), PATH: file.path, CONTEXT: self }); Class.replaceProperty(plugins, file.path, self);
function Script(file) { let self = set.has(plugins, file.path) && plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); } else { self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; } plugins.contexts[file.path] = self; return self;}
plugins[self.NAME] = self;
Class.replaceProperty(plugins, self.NAME, self);
function Script(file) { let self = set.has(plugins, file.path) && plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); } else { self = { __proto__: plugins }; plugins[file.path] = self; self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); self.PATH = file.path; self.CONTEXT = self; // This belongs elsewhere if (io.getRuntimeDirectories("plugins").some( function (dir) dir.contains(file, false))) plugins[self.NAME] = self; } plugins.contexts[file.path] = self; return self;}
Buffer.scrollToPercent(null, 100);
Buffer.scrollToPercent(null, null, 100);
scrollBottom: function () { Buffer.scrollToPercent(null, 100); },
Buffer.scrollToPercent(100, null);
Buffer.scrollToPercent(null, 100, null);
scrollEnd: function () { Buffer.scrollToPercent(100, null); },
Buffer.scrollToPercent(0, null);
Buffer.scrollToPercent(null, 0, null);
scrollStart: function () { Buffer.scrollToPercent(0, null); },
window.content.scrollTo(x, y);
content.scrollTo(x, y);
scrollTo: function (x, y) { marks.add("'", true); window.content.scrollTo(x, y); },
scrollTo: function(element) { element = $(element); var pos = element.cumulativeOffset(); window.scrollTo(pos[0], pos[1]); return element; },
var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(k){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(k);if(!Object.keys({toString:true}).length){if(k.toString!=Object.prototype.toString){e.push("toString")}if(k.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var j=e[d],h=k[j];if(f&&Object.isFunction(h)&&h.argumentNames().first()=="$super"){var l=h;h=(function(i){return function(){return f[i].apply(this,arguments)}})(j).wrap(l);h.valueOf=l.valueOf.bind(l);h.toString=l.toString.bind(l)}this.prototype[j]=h}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function i(q,s){for(var r in s){q[r]=s[r]}return q}function l(q){try{if(e(q)){return"undefined"}if(q===null){return"null"}return q.inspect?q.inspect():String(q)}catch(r){if(r instanceof RangeError){return"..."}throw r}}function k(q){var s=typeof q;switch(s){case"undefined":case"function":case"unknown":return;case"boolean":return q.toString()}if(q===null){return"null"}if(q.toJSON){return q.toJSON()}if(h(q)){return}var r=[];for(var u in q){var t=k(q[u]);if(!e(t)){r.push(u.toJSON()+": "+t)}}return"{"+r.join(", ")+"}"}function c(q){return $H(q).toQueryString()}function f(q){return q&&q.toHTML?q.toHTML():String.interpret(q)}function o(q){var r=[];for(var s in q){r.push(s)}return r}function m(q){var r=[];for(var s in q){r.push(q[s])}return r}function j(q){return i({},q)}function h(q){return !!(q&&q.nodeType==1)}function g(q){return d.call(q)=="[object Array]"}function p(q){return q instanceof Hash}function b(q){return typeof q==="function"}function a(q){return d.call(q)=="[object String]"}function n(q){return d.call(q)=="[object Number]"}function e(q){return typeof q==="undefined"}i(Object,{extend:i,inspect:l,toJSON:k,toQueryString:c,toHTML:f,keys:o,values:m,clone:j,isElement:h,isArray:g,isHash:p,isFunction:b,isString:a,isNumber:n,isUndefined:e})})();Object.extend(Function.prototype,(function(){var k=Array.prototype.slice;function d(o,l){var n=o.length,m=l.length;while(m--){o[n+m]=l[m]}return o}function i(m,l){m=k.call(m,0);return d(m,l)}function g(){var l=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\
scrollTo: function(element) { element = $(element); var pos = element.cumulativeOffset(); window.scrollTo(pos[0], pos[1]); return element; },
Buffer.scrollToPercent(null, 0);
Buffer.scrollToPercent(null, null, 0);
scrollTop: function () { Buffer.scrollToPercent(null, 0); },
Buffer.scrollToPercent(x, y);
Buffer.scrollToPercent(null, x, y);
scrollToPercent: function (x, y) { Buffer.scrollToPercent(x, y); },
} else if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) { this.reset();
search: function (word, reverse, private_) { this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } else if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) { this.reset(); } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length))
if (this.backward) var groups = [util.range(idx + 1, 0, -1), util.range(this.ranges.length, idx, -1)]; else var groups = [util.range(idx, this.ranges.length), util.range(0, idx + 1)]; for (let i in groups[0])
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i;
if (!private_) { this.wrapped = true; this.lastRange = null; for (let i in groups[1]) yield i; }
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);;
let start = RangeFind.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);;
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
if (!private_) { this.range.descroll(); this.range.deselect(); }
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null;
if (!private_) { this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.found = true;
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true;
if (range && (!private_ || private_ < 0)) this.selectedRange = range;
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else { function indices() { let idx = this.range.index; for (let i in this.backward ? util.range(idx + 1, 0, -1) : util.range(idx, this.ranges.length)) yield i; if (private_) return; this.wrapped = true; this.lastRange = null; for (let i in this.backward ? util.range(this.ranges.length, idx, -1) : util.range(0, idx + 1)) yield i; } for (let i in indices.call(this)) { this.range = this.ranges[i]; let start = this.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; if (!private_) { this.range.descroll(); this.range.deselect(); } } } if (range) this.lastRange = range.cloneRange(); if (private_) return range; this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.range.selection.removeAllRanges(); this.range.selection.addRange(range); this.range.selectionController.scrollSelectionIntoView( this.range.selectionController.SELECTION_NORMAL, 0, false); this.found = true; return range; },
if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) {
if (!again && (word === "" || word.indexOf(this.lastString) !== 0 || this.backward)) {
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else for (let i in this.indexIter(private_)) { if (!private_ && this.range.window != this.ranges[i].window && this.range.window != this.ranges[i].window.parent) { this.range.descroll(); this.range.deselect(); } this.range = this.ranges[i]; let start = RangeFind.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; } if (range) this.lastRange = range.cloneRange(); if (!private_) { this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.found = true; } if (range && (!private_ || private_ < 0)) this.selectedRange = range; return range; },
if (word == "")
if (word === "")
search: function (word, reverse, private_) { if (!private_ && this.lastRange && !RangeFind.equal(this.selectedRange, this.lastRange)) this.reset(); this.wrapped = false; this.finder.findBackwards = reverse ? !this.reverse : this.reverse; let again = word == null; if (again) word = this.lastString; if (!this.matchCase) word = word.toLowerCase(); if (!again && (word == "" || word.indexOf(this.lastString) != 0 || this.backward)) { if (!private_) this.range.deselect(); if (word == "") this.range.descroll(); this.lastRange = this.startRange; this.range = this.ranges.first; } if (word == "") var range = this.startRange; else for (let i in this.indexIter(private_)) { if (!private_ && this.range.window != this.ranges[i].window && this.range.window != this.ranges[i].window.parent) { this.range.descroll(); this.range.deselect(); } this.range = this.ranges[i]; let start = RangeFind.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ? RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) : RangeFind.endpoint(this.range.range, !this.backward);; if (this.backward && !again) start = RangeFind.endpoint(this.startRange, false); var range = this.finder.Find(word, this.range.range, start, this.range.range); if (range) break; } if (range) this.lastRange = range.cloneRange(); if (!private_) { this.lastString = word; if (range == null) { this.cancel(); this.found = false; return null; } this.found = true; } if (range && (!private_ || private_ < 0)) this.selectedRange = range; return range; },
item.url = decodeURIComponent(query.replace(/#.*/, "")); return item;
try { item.url = decodeURIComponent(query.replace(/#.*/, "")); return item; } catch (e) {}
completion.search = function search(context, noSuggest) { let [, keyword, space, args] = context.filter.match(/^\s*(\S*)(\s*)(.*)$/); let keywords = bookmarks.getKeywords(); let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; context.completions = keywords.concat(engines); context.keys = { text: 0, description: 1, icon: 2 }; if (!space || noSuggest) return; context.fork("suggest", keyword.length + space.length, this, "searchEngineSuggest", keyword, true); let item = keywords.filter(function (k) k.keyword == keyword)[0]; if (item && item.url.indexOf("%s") > -1) context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { context.format = history.format; context.title = [keyword + " Quick Search"]; // context.background = true; context.compare = CompletionContext.Sort.unsorted; context.generate = function () { let [begin, end] = item.url.split("%s"); return history.get({ uri: window.makeURI(begin), uriIsPrefix: true }).map(function (item) { let rest = item.url.length - end.length; let query = item.url.substring(begin.length, rest); if (item.url.substr(rest) == end && query.indexOf("&") == -1) { item.url = decodeURIComponent(query.replace(/#.*/, "")); return item; } return null; }).filter(util.identity); }; }); };
completion.search = function search(context, noSuggest) {
completion.search = function search(context, args, noSuggest) {
completion.search = function search(context, noSuggest) { let [, keyword, space, args] = context.filter.match(/^\s*(\S*)(\s*)(.*)$/); let keywords = bookmarks.getKeywords(); let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; context.completions = array(values(keywords)).concat(engines).array; context.keys = { text: "keyword", description: "title", icon: "icon" }; if (!space || noSuggest) return; context.fork("suggest", keyword.length + space.length, this, "searchEngineSuggest", keyword, true); let item = keywords[keyword]; if (item && item.url.indexOf("%s") > -1) context.fork("keyword/" + keyword, keyword.length + space.length, null, function (context) { context.format = history.format; context.title = [keyword + " Quick Search"]; // context.background = true; context.compare = CompletionContext.Sort.unsorted; context.generate = function () { let [begin, end] = item.url.split("%s"); return history.get({ uri: window.makeURI(begin), uriIsPrefix: true }).map(function (item) { let rest = item.url.length - end.length; let query = item.url.substring(begin.length, rest); if (item.url.substr(rest) == end && query.indexOf("&") == -1) try { item.url = decodeURIComponent(query.replace(/#.*/, "").replace(/\+/g, " ")); return item; } catch (e) {} return null; }).filter(util.identity); }; }); };