rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
? function() { if (context[method]) { return context[method].apply(context, arguments); } else { throw logger.error('No method:', method, 'for context', context); } } | return setInterval(function() { try { f.apply(this, args); } catch(e) { } }, t) | ? function() { if (context[method]) { return context[method].apply(context, arguments); } else { throw logger.error('No method:', method, 'for context', context); } } |
bt_instance_start.target.bind('click',function(){ bt_instance_start.open(c_list.getCheckedInstanceIds()); | bt_instance_stop.target.bind('click',function(){ bt_instance_stop.open(c_list.getCheckedInstanceIds()); | bt_instance_start.target.bind('click',function(){ bt_instance_start.open(c_list.getCheckedInstanceIds()); }); |
get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden), | function (args) { let special = args.bang; let count = args.count; let arg = args.literalArg; if (arg) { let removed = 0; let matches = arg.match(/^(\d+):?/); if (matches) { tabs.remove(tabs.getTab(parseInt(matches[1], 10) - 1)); removed = 1; } else { let str = arg.toLowerCase(); let browsers = config.tabbrowser.browsers; for (let i = browsers.length - 1; i >= 0; i--) { let host, title, uri = browsers[i].currentURI.spec; if (browsers[i].currentURI.schemeIs("about")) { host = ""; title = "(Untitled)"; } else { host = browsers[i].currentURI.host; title = browsers[i].contentTitle; } [host, title, uri] = [host, title, uri].map(String.toLowerCase); if (host.indexOf(str) >= 0 || uri == str || (special && (title.indexOf(str) >= 0 || uri.indexOf(str) >= 0))) { tabs.remove(tabs.getTab(i)); removed++; } } } if (removed > 0) dactyl.echomsg(removed + " fewer tab(s)", 9); else dactyl.echoerr("E94: No matching tab for " + arg); } else tabs.remove(tabs.getTab(), Math.max(count, 1), special, 0); }, { | get visibleTabs() config.tabbrowser.visibleTabs || this.allTabs.filter(function (tab) !tab.hidden), |
$.getJSON(this.DATA_DIR + encodeURIComponent(prefix) + this.JSON, null, function (data) { data.prefix = prefix; me._dict = data; if (callback) { | this._loadConfig(schemaName, function (config) { schema = new Schema (schemaName, config); me._loadDict(schema, _sync ? callback : null); if (!_sync) { | $.getJSON(this.DATA_DIR + encodeURIComponent(prefix) + this.JSON, null, function (data) { data.prefix = prefix; me._dict = data; if (callback) { callback(schema); } }); |
this.observers[type] = this.observers[type].filter(function (c) c.get() != callback); | profileName: Class.memoize(function () { let dir = services.directory.get("ProfD", Ci.nsIFile); for (let prof in iter(services.profile.profiles)) if (prof.QueryInterface(Ci.nsIToolkitProfile).rootDir.path === dir.path) return prof.name; return "unknown"; }), | this.observers[type] = this.observers[type].filter(function (c) c.get() != callback); |
test("creates a context and then invokes renderContent to call renderToContext on each childView", function() { | test("creates a context and then invokes renderChildViews to call renderToContext on each childView", function() { | test("creates a context and then invokes renderContent to call renderToContext on each childView", function() { var runCount = 0, curContext ; var ChildView = SC.View.extend({ renderToContext: function(context) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); equals(view.renderContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'renderToContext() invoked for each child view');}); |
equals(view.renderContent(curContext), undefined, 'returns nothing'); | view.renderChildViews(curContext); | test("creates a context and then invokes renderContent to call renderToContext on each childView", function() { var runCount = 0, curContext ; var ChildView = SC.View.extend({ renderToContext: function(context) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); equals(view.renderContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'renderToContext() invoked for each child view');}); |
view.animate('left', 100, { duration: 1, callback: function() { start(); ok(true, "Callback was called."); clearTimeout(timeout); } | view.animate('left', 100, { duration: 1, callback: function() { start(); ok(true, "Callback was called."); clearTimeout(timeout); } }); stop(); | test("callbacks work in general", function(){ var timeout = setTimeout(function(){ start(); ok(false, "Timeout! Callback was not called."); }, 2000); view.animate('left', 100, { duration: 1, callback: function() { start(); ok(true, "Callback was called."); clearTimeout(timeout); } }); stop();}); |
stop(); }); | test("callbacks work in general", function(){ var timeout = setTimeout(function(){ start(); ok(false, "Timeout! Callback was not called."); }, 2000); view.animate('left', 100, { duration: 1, callback: function() { start(); ok(true, "Callback was called."); clearTimeout(timeout); } }); stop();}); |
|
this.Data.ajax_getData('mainsReq', _Settings.dataURL, _Settings.dataURL_params(this.Data), getData, function(){}); | $.each(thisRef.Data.or, function() { $('#tablePlus_'+this).parent().trigger('click'); }); | this.Data.ajax_getData('mainsReq', _Settings.dataURL, _Settings.dataURL_params(this.Data), getData, function(){}); |
equals(dataSource, view, 'passes view as data source'); ok(context._STYLE_REGEX, 'passes render context'); equals(firstTime, undefined, 'does not pass third parameter'); | equals(dataSource, view.get('renderDelegateProxy'), "passes the view's render delegate proxy as data source"); ok(context._STYLE_REGEX, "passes render context"); equals(firstTime, undefined, "does not pass third parameter"); | test("Passes data source as first parameter if render delegate is not the view", function() { var renderCallCount = 0, updateCallCount = 0; var view; var renderDelegate = SC.Object.create({ render: function(dataSource, context, firstTime) { equals(dataSource, view, 'passes view as data source'); ok(context._STYLE_REGEX, 'passes render context'); equals(firstTime, undefined, 'does not pass third parameter'); renderCallCount++; }, update: function(dataSource, elem) { equals(dataSource, view, 'passes view as data source'); ok(elem.jquery, 'passes a jQuery object as first parameter'); updateCallCount++; } }); view = SC.View.create({ renderDelegate: renderDelegate }); view.createLayer(); view.updateLayer(); equals(renderCallCount, 1, "calls render once"); equals(updateCallCount, 1, "calls update once");}); |
equals(dataSource, view, 'passes view as data source'); ok(elem.jquery, 'passes a jQuery object as first parameter'); | equals(dataSource, view.get('renderDelegateProxy'), "passes view's render delegate proxy as data source"); ok(elem.jquery, "passes a jQuery object as first parameter"); | test("Passes data source as first parameter if render delegate is not the view", function() { var renderCallCount = 0, updateCallCount = 0; var view; var renderDelegate = SC.Object.create({ render: function(dataSource, context, firstTime) { equals(dataSource, view, 'passes view as data source'); ok(context._STYLE_REGEX, 'passes render context'); equals(firstTime, undefined, 'does not pass third parameter'); renderCallCount++; }, update: function(dataSource, elem) { equals(dataSource, view, 'passes view as data source'); ok(elem.jquery, 'passes a jQuery object as first parameter'); updateCallCount++; } }); view = SC.View.create({ renderDelegate: renderDelegate }); view.createLayer(); view.updateLayer(); equals(renderCallCount, 1, "calls render once"); equals(updateCallCount, 1, "calls update once");}); |
memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-" + (obj.id || obj.name))); | memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name))); | memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-" + (obj.id || obj.name))); |
dirs = dirs.map(function (dir) File.joinPaths(dir, name)) | dirs = dirs.map(function (dir) File.joinPaths(dir, name, this.cwd)) | dirs = dirs.map(function (dir) File.joinPaths(dir, name)) |
this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } | this.setCachedSrc = function(path, src) { sourceCache[path] = { path: path, src: src }; } this.getCachedSrc = function(path) { return sourceCache[path]; } | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
this.__path = {__default__:[]}; | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
|
jsio.__path[baseModule] = path; | this.__path[baseModule] = path; | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
jsio.__path.__default__.push(path); | this.__path.__default__.push(path); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { | this.setEnv = function(envCtor) { if(typeof envCtor == 'string') { switch(envCtor) { | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
ENV = new ENV_node(); | ENV = new ENV_node(util); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
ENV = new ENV_browser(); | ENV = new ENV_browser(util); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
ENV = env; | ENV = new envCtor(util); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } | this.__env = ENV; this.__dir = ENV.getCwd(); this.setPath(ENV.getPath()); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
}).call(jsio = bind(this, importer, null, '')); | }).call(exports); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.__importer = importer; this.__modules = {preprocessors:{}}; this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.__path[baseModule] = path; } else { jsio.__path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
$div.css(prop, $this.css(prop)); }); | $mirror.css(prop, $this.css(prop)); }); | $.each('borderTopWidth borderRightWidth borderBottomWidth borderLeftWidth paddingTop paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle fontStretch fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) { $div.css(prop, $this.css(prop)); }); |
top.Event.stopObserving(document.body, 'keypress', function(event) {}); | top.Event.observe(document.body, 'keypress', function(event) { if (event.which == 0) { closeHTMLpop(); } }); | top.Event.stopObserving(document.body, 'keypress', function(event) {}); |
equals(child.get('layoutStyle')[key], with_s[key], "STYLE W/ PARENT %@".fmt(key)) ; | testKey = key === 'transform' ? SC.platform.domCSSPrefix+'Transform' : key; equals(child.get('layoutStyle')[testKey], with_s[key], "STYLE W/ PARENT %@".fmt(key)) ; | keys.forEach(function(key) { equals(child.get('layoutStyle')[key], with_s[key], "STYLE W/ PARENT %@".fmt(key)) ; }); |
$('#dataTable_0_paginate input').keyup( function() { _config.fnContentChange(this); if (_config.expandableRows) _expandClick(dTable); } ); | $('#dataTable_'+elCnt+'_paginate input,#dataTable_'+elCnt+'_filter input').keyup( function() { _config.fnContentChange(this); if (_config.expandableRows) _expandClick(dTable); } ); | this.each(function() { dTable = _config.dTable[elCnt]; if (!dTable) { $(this).empty().append(_buildTable(elCnt)); dTable = $('#dataTable_'+elCnt).dataTable( $.extend({ "bJQueryUI": false, "sPaginationType": "full_numbers", "bAutoWidth":false, "bSortClasses": true, "aaSorting": [[_config.sorting[0],_config.sorting[1]]] },_config.dataTable)); } else { dTable.fnClearTable(); } dTable.fnAddData(_config.items); dTablesArr.push(dTable); // Setting up table events if (_config.dataTable.sPaginationType) { $('#dataTable_'+elCnt+' thead tr,#dataTable_'+elCnt+'_next,#dataTable_'+elCnt+'_previous,#dataTable_'+elCnt+'_first,#dataTable_'+elCnt+'_last').click( function() { _config.fnContentChange(this); if (_config.expandableRows) _expandClick(dTable); } ); $('#dataTable_0_paginate input').keyup( function() { _config.fnContentChange(this); if (_config.expandableRows) _expandClick(dTable); } ); } if (_config.expandableRows) _expandClick(dTable); $('.tblSort').click( function() { _config.fnTableSorting(this); } ); //_expandInit(dTable); elCnt++; }); |
items: TYPO3.Backend.Seminars.TabPanel, | items: Ext.getCmp('typo3-backend-seminars-tabpanel'), | Ext.onReady(function(){ TYPO3.Backend.Seminars.viewport = new Ext.Viewport({ layout: 'border', items: TYPO3.Backend.Seminars.TabPanel, });}); |
var visBindings = this.bindings.results.bindings.filter(function(el) { return el.visType == visualization.type.value; } ) | var visBindings = this.bindings.results.bindings.filter(function(el) { return el.visualization.value == visualization.visualization.value; } ); | var visBindings = this.bindings.results.bindings.filter(function(el) { return el.visType == visualization.type.value; } ) |
bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ | $.each(c_list.checked_list,function(check_id,obj){ | bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) //update detail $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/show/',check_id) },true); }); }); |
}); | bt_refresh.element.bind('dcmgrGUI.refresh',function(){ c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/images/list/',c_pagenate.current_page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) //update detail $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/show/',check_id) },true); }); }); |
|
test("changing the title should update the span", function() { var oldDisplayTitle = view.get('displayTitle'); SC.RunLoop.begin(); view.set('title', 'Last Name'); SC.RunLoop.end(); ok(view.get('displayTitle') !== oldDisplayTitle, 'precond - should have changed display title'); | test("should have span with title inside", function() { | test("changing the title should update the span", function() { var oldDisplayTitle = view.get('displayTitle'); SC.RunLoop.begin(); view.set('title', 'Last Name'); SC.RunLoop.end(); ok(view.get('displayTitle') !== oldDisplayTitle, 'precond - should have changed display title'); var q = Q$('span', view.get('layer')); equals(q.text(), view.get('displayTitle'), 'should have display title');}); |
ok(view.get('displayTitle').length>0, 'precond - display title should not be empty'); | test("changing the title should update the span", function() { var oldDisplayTitle = view.get('displayTitle'); SC.RunLoop.begin(); view.set('title', 'Last Name'); SC.RunLoop.end(); ok(view.get('displayTitle') !== oldDisplayTitle, 'precond - should have changed display title'); var q = Q$('span', view.get('layer')); equals(q.text(), view.get('displayTitle'), 'should have display title');}); |
|
xhr.onload = xhr.onerror = null; | xhr.onload = xhr.onerror = xhr.ontimeout = null; | transports.xhr = Class(baseTransport, function(supr) { var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(this._xhr[i]); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(); return; } logger.debug('XHR data received'); cb(eval(xhr.responseText)); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(); abortXHR(xhr); logger.debug('done handling XHR error'); } }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } if(data) { xhr.send(data); } else { xhr.send(); } };}); |
this.map(list, function(error) { var tokens = error["word"].split(/\s+/); var pre = error["pre"]; var first = tokens[0]; if (errors['__' + first] == undefined) { errors['__' + first] = new Object(); errors['__' + first].pretoks = {}; errors['__' + first].defaults = new Array(); } if (pre == "") { errors['__' + first].defaults.push(parent.makeError(error["word"], tokens, type, seps, pre)); } else { if (errors['__' + first].pretoks['__' + pre] == undefined) errors['__' + first].pretoks['__' + pre] = new Array(); errors['__' + first].pretoks['__' + pre].push(parent.makeError(error["word"], tokens, type, seps, pre)); } }); | this.map(this.ignore_types, function(string) { if (types[string] != undefined) ignore_types.push(string); }); | this.map(list, function(error) { var tokens = error["word"].split(/\s+/); var pre = error["pre"]; var first = tokens[0]; if (errors['__' + first] == undefined) { errors['__' + first] = new Object(); errors['__' + first].pretoks = {}; errors['__' + first].defaults = new Array(); } if (pre == "") { errors['__' + first].defaults.push(parent.makeError(error["word"], tokens, type, seps, pre)); } else { if (errors['__' + first].pretoks['__' + pre] == undefined) errors['__' + first].pretoks['__' + pre] = new Array(); errors['__' + first].pretoks['__' + pre].push(parent.makeError(error["word"], tokens, type, seps, pre)); } }); |
unparseRegex: function (re) re.bang + re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m) + | Array.filter(values, function (val) !util.isSubdomain(val, host)), | unparseRegex: function (re) re.bang + re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m) + |
startIndexA = a.indexOf('>') + 1 endIndexA = a.indexOf('</') x = a.substring(startIndexA, endIndexA) x = parseInt(x) | x = 0 y = 0 if(a.indexOf('>') > -1) { startIndexA = a.indexOf('>') + 1 endIndexA = a.indexOf('</') x = a.substring(startIndexA, endIndexA) x = parseInt(x) } else { x = parseInt(a) } | jQuery.fn.dataTableExt.oSort['integer-in-tag-asc'] = function(a,b) { startIndexA = a.indexOf('>') + 1 endIndexA = a.indexOf('</') x = a.substring(startIndexA, endIndexA) x = parseInt(x) startIndexB = b.indexOf('>') + 1 endIndexB = b.indexOf('</') y = b.substring(startIndexB, endIndexB) y = parseInt(y) return ((x < y) ? -1 : ((x > y) ? 1 : 0));}; |
startIndexB = b.indexOf('>') + 1 endIndexB = b.indexOf('</') y = b.substring(startIndexB, endIndexB) y = parseInt(y) | if(b.indexOf('>') > -1) { startIndexB = b.indexOf('>') + 1 endIndexB = b.indexOf('</') y = b.substring(startIndexB, endIndexB) y = parseInt(y) } else { y = parseInt(b) } | jQuery.fn.dataTableExt.oSort['integer-in-tag-asc'] = function(a,b) { startIndexA = a.indexOf('>') + 1 endIndexA = a.indexOf('</') x = a.substring(startIndexA, endIndexA) x = parseInt(x) startIndexB = b.indexOf('>') + 1 endIndexB = b.indexOf('</') y = b.substring(startIndexB, endIndexB) y = parseInt(y) return ((x < y) ? -1 : ((x > y) ? 1 : 0));}; |
let timer = services.Timer(); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); | let timer = services.Timer(update, 100, services.Timer.TYPE_REPEATING_SLACK); | let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); let lastUpdate = Date.now(); function update(force) { if (force !== true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now(); let val = tmpfile.read(); if (textBox) textBox.value = val; else { while (editor.rootElement.firstChild) editor.rootElement.removeChild(editor.rootElement.firstChild); editor.rootElement.innerHTML = val; } } let timer = services.Timer(); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path, line, column); } finally { timer.cancel(); } update(true); }, this); |
this.editFileExternally(tmpfile.path, line, column); | this.editFileExternally({ file: tmpfile.path, line: line, column: column }, true); | let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); let lastUpdate = Date.now(); function update(force) { if (force !== true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now(); let val = tmpfile.read(); if (textBox) textBox.value = val; else { while (editor.rootElement.firstChild) editor.rootElement.removeChild(editor.rootElement.firstChild); editor.rootElement.innerHTML = val; } } let timer = services.Timer(); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path, line, column); } finally { timer.cancel(); } update(true); }, this); |
if(data) { xhr.send(data); } else { xhr.send(); } | setTimeout(bind(xhr, 'send', data), 0); | transports.xhr = Class(baseTransport, function(supr) { var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = xhr.ontimeout = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { this._aborted = true; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(this._xhr[i]); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { var response = ''; try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } var response = eval(xhr.responseText); if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(xhr.status, response); return; } logger.debug('XHR data received'); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(xhr.status, response); abortXHR(xhr); logger.debug('done handling XHR error'); return; } cb(response); }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { if (this._aborted) { return; } var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } if(data) { xhr.send(data); } else { xhr.send(); } };}); |
csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; | exports.Server = Class(process.EventEmitter, function () { this.init = function (sessionURL) { process.EventEmitter.call(this); this._sessionUrl = sessionURL || ''; log('starting server, session url is <' + this._sessionUrl + '>'); | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) | var CSPError = Class(AssertionError, function (supr) { this.name = 'CSPError' this.init = function (code) { supr(this, 'init', args); this.code = code; var args = Array.prototype.slice.call(arguments, 1); | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this.emit('receive', data); | }); var assertOrRenderError = function (exp, code, message) { if (!exp) { throw new CSPError(code, message) }; | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); | var renderError = function (response, code, message) { response.sendHeader(code, {'Content-Type' : 'text/plain', 'Content-Length' : message.length}); response.sendBody(message); response.finish(); }; var sendStatic = function (path, response) { logger.debug('SEND STATIC', path, response) staticFile('./' + path.join('/')) .addCallback(function(content){ response.sendHeader(200, {'Content-Type' : 'text/plain', 'Content-Length' : content.length}); response.sendBody(content); response.finish(); }) .addErrback(function(){ renderError(response, 404, 'No such file, ' + path); }); }; var getRequestBody = function (request) { var promise = new process.Promise(); if (request.method === 'GET') { reschedule(function () { promise.emitSuccess(''); }); } else { var body = []; request.setBodyEncoding('binary'); request .addListener('body', function (chunk) { body.push(chunk); }) .addListener('complete', function () { promise.emitSuccess(body.join('')); }); | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this._encoding = encoding; | return promise; | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); | var validResources = new Hash('static', 'handshake', 'comet', 'send', 'close', 'reflect', 'streamtest'), validMethods = new Hash('GET', 'POST'); this._handleRequest = function (request, response) { getRequestBody(request).addCallback(bind(this, function(body) { logger.debug('received request', request.url); try { var uri = nodeUrl.parse(request.url, true), path = uri.pathname, sessionUrl = this._sessionUrl; assertOrRenderError(startswith(path, sessionUrl + '/'), 404, 'Request to invalid session URL'); logger.debug(request.method); assertOrRenderError(validMethods.contains(request.method), 405, 'Invalid HTTP method, ' + request.method); var resource = path.split('/').pop(); if (resource === 'static') { assertOrRenderError(startswith(path, sessionUrl + '/'), 404, 'sendStatic Not Implemented'); return; }; assertOrRenderError(validResources.contains(resource), 404, 'Invalid resource, ' + path); var params = uri.query; request.data = body || params.d || null; if (resource === 'handshake') { assertOrRenderError(!params.s, 400, 'Handshake cannot have session'); try { var dict = JSON.parse(request.data); assert((dict instanceof Object) && !(dict instanceof Array)); } catch (err) { logger.debug('INVALID HANDSHAKE, ', request, err); throw new CSPError(400, 'Invalid data parameter for handshake'); }; var session = new exports.Session(); var connection = new exports.Connection(session); session.connection = connection; this.emit('connection', connection); connection.emit('connect'); } else { var session = sessionDict[params.s]; assertOrRenderError(session, 400, 'Invalid or missing session'); var ackId = parseInt(request.headers['Last-Event-Id']) || parseInt(params.a) || -1; session.receiveAck(ackId); }; session.updateVars(params); session.dispatch[resource].call(session, request, response); } catch (err) { if (err instanceof CSPError) { renderError(response, err.code, err.message); } else { logger.debug('Unexpected Error: ', err.message); renderError(response, 500, 'Unknown Server error'); }; }; })); | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this.close = function () { this._session.close(); | this.listen = function (port, host) { var server = http.createServer(bind(this, this._handleRequest)); if (!port) { throw logger.error('No port specified'); } server.listen(port, host); | csp.Connection = Class(process.EventEmitter, function() { this.init = function (session) { this.remoteAddress = null; // XXX get remote address from requests this.readyState = 'open'; this._session = session; this._encoding = 'binary'; this._utf8buffer = ''; }; this._receive = function (data) { if (this._encoding === 'utf8') { this._utf8buffer += data; // data, len_parsed = utf8.decode(this._utf8buffer) var x = utf8.decode(this._utf8buffer), data = x[0], len_parsed = x[1]; this._utf8buffer = this._utf8buffer.slice(len_parsed) // buffer unparsed bytes }; this.emit('receive', data); }; var known_encodings = Set('utf8', 'binary'); this.setEncoding = function (encoding) { assert(encoding in known_encodings, 'unrecognized encoding'); if (encoding !== 'utf8') { assert(!(this._utf8buffer), 'cannot switch encodings with dirty utf8 buffer'); }; this._encoding = encoding; }; this.send = function (data, encoding) { if (!(this.readyState in Set('writeOnly', 'open'))) { // XXX make error type for this throw new Error("Socket is not writable in readyState: " + this.readyState); }; encoding = encoding || 'binary'; // default to 'binary' assert(encoding in known_encodings, 'unrecognized encoding'); data = (encoding === 'utf8') ? utf8.encode(data) : data; this._session.send(data); }; this.close = function () { this._session.close(); };}); |
this._user[mode].some(function (map) map.hasName(cmd) && self._matchingUrlsTest(map, patternOrUrl)), | template.map(maps, function (map) template.map(map.names, function (name) <tr> <td>{modeSign} {name}</td> <td>{map.noremap ? "*" : " "}</td> <td>{map.rhs || "function () { ... }"}</td> </tr>)) | this._user[mode].some(function (map) map.hasName(cmd) && self._matchingUrlsTest(map, patternOrUrl)), |
bt_delete_volume.target.bind('click',function(){ bt_delete_volume.open(c_list.getCheckedInstanceIds()); | bt_create_volume.target.bind('click',function(){ bt_create_volume.open(); | bt_delete_volume.target.bind('click',function(){ bt_delete_volume.open(c_list.getCheckedInstanceIds()); }); |
url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) | url:DcmgrGUI.Util.getPagePath('/images/show/',check_id) | $.each(c_list.checked_list,function(check_id,obj){ //remove $($('#detail').find('#'+check_id)).remove(); //update c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/images/detail/',check_id) },true); }); |
commandline.echo(msg, commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES); | commandline.echo(msg, commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); | this.setTimeout(function () { let msg = this.rangeFind.backward ? "search hit TOP, continuing at BOTTOM" : "search hit BOTTOM, continuing at TOP"; commandline.echo(msg, commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES); }, 0); |
layers: layers.map(function(name, i){ return { name: "../" + name.replace(/\./g,'/') + ".js", dependencies: [ name.replace(/\ ], layerDependencies: layers.slice(0, i).map(function(name){ return "../" + name.replace(/\./g,'/') + ".js" }) }; }), | layers[scriptName] = layers[scriptName].filter(function(scriptName){ return priorLayers.indexOf(scriptName) > -1; }); | layers: layers.map(function(name, i){ // for each layer, create a layer object return { name: "../" + name.replace(/\./g,'/') + ".js", // use filename dependencies: [ name.replace(/\//g,'.') // use module name ], //use all previous layers as layer dependencies layerDependencies: layers.slice(0, i).map(function(name){ return "../" + name.replace(/\./g,'/') + ".js" }) }; }), |
var visBindings = this.bindings.filter(function(el) { return el.visType == visualization.type.value; } ) | var visBindings = this.bindings.results.bindings.filter(function(el) { return el.visType == visualization.type.value; } ) | var visBindings = this.bindings.filter(function(el) { return el.visType == visualization.type.value; } ) |
if (!el.hasClassName("broadcast")) el.disabled = false; | if (!el.hasClassName("broadcast")) el.enable(); | e.observe("change", function(ev) { if (ev.element().checked) { $$("input[chip=\"" + ev.element().readAttribute("chip") + "\"]").each(function(el) { if (!el.hasClassName("broadcast")) el.disabled = true; }); } else { $$("input[chip=\"" + ev.element().readAttribute("chip") + "\"]").each(function(el) { if (!el.hasClassName("broadcast")) el.disabled = false; }); } }); |
chrome.tabs.getSelected(null, function(tab){ if(background.TBRL.Service.isEnableSite(tab.url)){ d.callback(tab); } else { window.close(); } | }, function(res){ d.callback(res.title); | chrome.tabs.getSelected(null, function(tab){ if(background.TBRL.Service.isEnableSite(tab.url)){ d.callback(tab); } else { window.close(); } }); |
context.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text)); | context.quote = [args.last, function (text) util.escapeString(text, ""), args.last]; | context.filters.push(function (item) /^[a-zA-Z_$][\w$]*$/.test(item.text)); |
liberator.open(folder); | liberator.open(folder, {from: "goto"}); | function (args) { let count = Math.max(0, args.count - 1); let arg = args.literalArg || "Inbox"; let folder = mail.getFolders(arg, true, true)[count]; if (!folder) liberator.echoerr("Exxx: Folder \"" + arg + "\" does not exist"); else liberator.open(folder); }, |
this.element.bind('dcmgrGUI.afterUpdate',function(event){ var bg; var kids; $("table").find('td').hover( function () { | function () { | this.element.bind('dcmgrGUI.afterUpdate',function(event){ var bg; var kids; $("table").find('td').hover( function () { //Mouse over bg = $(this).parent().css("background-color"); kids = $(this).parent().children(); kids.css("background-color","#82c9d9"); }, function () { //Mouse over kids.css("background-color",bg); } ); self.element.find("[type='checkbox']").each(function(key,value){ var id = $(value).val(); if(self.checked_list[id]){ $(event.target).find("[type='checkbox']").each(function(){ if($(this).val() === id){ $(this).attr('checked',true); } }) } }) }); |
function () { kids.css("background-color",bg); } ); self.element.find("[type='checkbox']").each(function(key,value){ var id = $(value).val(); if(self.checked_list[id]){ $(event.target).find("[type='checkbox']").each(function(){ if($(this).val() === id){ $(this).attr('checked',true); } }) } }) }); | this.element.bind('dcmgrGUI.afterUpdate',function(event){ var bg; var kids; $("table").find('td').hover( function () { //Mouse over bg = $(this).parent().css("background-color"); kids = $(this).parent().children(); kids.css("background-color","#82c9d9"); }, function () { //Mouse over kids.css("background-color",bg); } ); self.element.find("[type='checkbox']").each(function(key,value){ var id = $(value).val(); if(self.checked_list[id]){ $(event.target).find("[type='checkbox']").each(function(){ if($(this).val() === id){ $(this).attr('checked',true); } }) } }) }); |
|
d = $.grep(d, function (e) { return e >= b[j]; }); | q.sort(function (a, b) { return a - b; }); | d = $.grep(d, function (e) { return e >= b[j]; }); |
function (count) { if (typeof count != "number" || count < 1) count = 1; | let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } | function (count) { if (typeof count != "number" || count < 1) count = 1; let controller = buffer.selectionController; let sel = controller.getSelection(controller.SELECTION_NORMAL); if (!sel.rangeCount) // Hack. sel.addRange(RangeFind.endpoint( RangeFind.nodeRange(buffer.focusedFrame.document.documentElement), true)); while (count--) controller[caretModeMethod](caretModeArg, false); }, |
let controller = buffer.selectionController; let sel = controller.getSelection(controller.SELECTION_NORMAL); if (!sel.rangeCount) sel.addRange(RangeFind.endpoint( RangeFind.nodeRange(buffer.focusedFrame.document.documentElement), true)); while (count--) controller[caretModeMethod](caretModeArg, false); }, | if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); this.editFileExternally(tmpfile.path); if (textBox) textBox.removeAttribute("readonly"); let val = tmpfile.read(); if (textBox) textBox.value = val; else { let editor = GetCurrentEditor(); let wholeDocRange = editor.document.createRange(); let rootNode = editor.rootElement.QueryInterface(Ci.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); editor.selection.addRange(wholeDocRange); editor.selection.deleteFromDocument(); editor.insertText(val); } }, this); | function (count) { if (typeof count != "number" || count < 1) count = 1; let controller = buffer.selectionController; let sel = controller.getSelection(controller.SELECTION_NORMAL); if (!sel.rangeCount) // Hack. sel.addRange(RangeFind.endpoint( RangeFind.nodeRange(buffer.focusedFrame.document.documentElement), true)); while (count--) controller[caretModeMethod](caretModeArg, false); }, |
return; | exports.transports.xhr = Class(baseTransport, function(supr) { var createXHR = function() { return window.XMLHttpRequest ? new XMLHttpRequest() : window.XDomainRequest ? new XDomainRequest() : window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : null; }; var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { var xhr; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(xhr); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(); } logger.debug('XHR data received'); cb(eval(xhr.responseText)); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(); abortXHR(xhr); logger.debug('done handling XHR error'); } }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } if(data) { xhr.send(data); } else { xhr.send(); } };}); |
|
dirs = dirs.map(function (dir) File.joinPaths(dir, name, this.cwd)) | dirs = dirs.map(function (dir) File.joinPaths(dir, name, this.cwd), this) | dirs = dirs.map(function (dir) File.joinPaths(dir, name, this.cwd)) |
this.modules = {preprocessors:{}}; this.frameworks = []; | this.setCachedSrc = function(filePath, src) { sourceCache[filePath] = { filePath: filePath, src: src }; } this.getCachedSrc = function(filePath) { return sourceCache[filePath]; } | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.modules = {preprocessors:{}}; this.frameworks = []; this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.path[baseModule] = path; } else { jsio.path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } | this.__path = {__default__:[]}; this.setPath = function(path) { this.__path.__default__ = typeof path == 'string' ? [path] : path; } | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.modules = {preprocessors:{}}; this.frameworks = []; this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.path[baseModule] = path; } else { jsio.path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
jsio.path[baseModule] = path; | jsio.__path[baseModule] = path; | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.modules = {preprocessors:{}}; this.frameworks = []; this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.path[baseModule] = path; } else { jsio.path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
jsio.path.__default__.push(path); | jsio.__path.__default__.push(path); | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.modules = {preprocessors:{}}; this.frameworks = []; this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.path[baseModule] = path; } else { jsio.path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } | if(!jsio.__path.__default__.length) { jsio.setPath(ENV.getPath()); } | (function() { this.__filename = 'jsio.js'; this.__preprocessors = {}; this.__cmds = []; this.__jsio = this; this.modules = {preprocessors:{}}; this.frameworks = []; this.setCachedSrc = function(pkg, filePath, src) { sourceCache[pkg] = { filePath: filePath, src: src }; } this.getCachedSrc = function(pkg) { return sourceCache[pkg]; } this.addFramework = function(name, init) { this.frameworks[name] = init; } this.path = {__default__:[]}; this.setPath = function(path) { this.path.__default__ = typeof path == 'string' ? [path] : path; } this.addPath = function(path, baseModule) { if (baseModule) { jsio.path[baseModule] = path; } else { jsio.path.__default__.push(path); } } this.addPreprocessor = function(name, preprocessor) { this.__preprocessors[name] = preprocessor; } this.addCmd = function(processor) { this.__cmds.push(processor); } this.setEnv = function(env) { if(ENV && (env == ENV || env == ENV.name)) { return; } if(typeof env == 'string') { switch(env) { case 'node': ENV = new ENV_node(); break; case 'browser': default: ENV = new ENV_browser(); break; } } else { ENV = env; } jsio.__env = ENV; jsio.__dir = ENV.getCwd(); if(!jsio.path.__default__.length) { jsio.setPath(ENV.getPath()); } } }).call(jsio = bind(this, importer, null, '')); |
jsonObj.each(function(vals) { vals = vals.toString(); strListVal += '<li><a class="DDlink" onclick="setInputValue(\'' + strElmntID + '\', \'' + vals.sub("'", "\\'") + '\')">' + vals + '</a></li>'; }); | $(strParentID).select('input[type=checkbox]').each(function(cb) { var cbData = cb.getValue(); if (cbData) { serialized += 'itemID[]='+cbData+'&'; } }) | jsonObj.each(function(vals) { vals = vals.toString(); strListVal += '<li><a class="DDlink" onclick="setInputValue(\'' + strElmntID + '\', \'' + vals.sub("'", "\\'") + '\')">' + vals + '</a></li>'; }); |
return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; | return mustEncode ? [ packetId, 1, base64.encode(data) ] : [ packetId, 0, data ]; | transports.xhr = Class(baseTransport, function(supr) { var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = xhr.ontimeout = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { this._aborted = true; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(this._xhr[i]); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { var response = ''; try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } var response = eval(xhr.responseText); if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(xhr.status, response); return; } logger.debug('XHR data received'); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(xhr.status, response); abortXHR(xhr); logger.debug('done handling XHR error'); return; } cb(response); }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { if (this._aborted) { return; } var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } // NOTE WELL: Firefox (and probably everyone else) likes to encode our nice // binary strings as utf8. Don't let them! Say no to double utf8 // encoding. Once is good, twice isn't better. if (xhr.overrideMimeType) { xhr.overrideMimeType("text/plain; charset=ISO-8859-1"); } setTimeout(bind(xhr, 'send', data), 0); };}); |
if (xhr.overrideMimeType) { xhr.overrideMimeType("text/plain; charset=ISO-8859-1"); } setTimeout(bind(xhr, 'send', data), 0); | setTimeout(bind(xhr, xhr.sendAsBinary ? 'sendAsBinary' : 'send', data), 0); | transports.xhr = Class(baseTransport, function(supr) { var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = xhr.ontimeout = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { this._aborted = true; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(this._xhr[i]); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { var response = ''; try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } var response = eval(xhr.responseText); if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(xhr.status, response); return; } logger.debug('XHR data received'); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(xhr.status, response); abortXHR(xhr); logger.debug('done handling XHR error'); return; } cb(response); }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { if (this._aborted) { return; } var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } // NOTE WELL: Firefox (and probably everyone else) likes to encode our nice // binary strings as utf8. Don't let them! Say no to double utf8 // encoding. Once is good, twice isn't better. if (xhr.overrideMimeType) { xhr.overrideMimeType("text/plain; charset=ISO-8859-1"); } setTimeout(bind(xhr, 'send', data), 0); };}); |
test("creates a context and then invokes renderContent and updateContent to call renderToContext or updateLayer on each childView", function() { | test("creates a context and then invokes renderContent to call renderToContext on each childView", function() { | test("creates a context and then invokes renderContent and updateContent to call renderToContext or updateLayer on each childView", function() { var runCount = 0, curContext ; var ChildView = SC.View.extend({ renderToContext: function(context) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run }, updateLayer: function() { runCount++; } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); equals(view.renderContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'renderToContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); equals(view.updateContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'updateLayer() invoked for each child view');}); |
}, updateLayer: function() { runCount++; | test("creates a context and then invokes renderContent and updateContent to call renderToContext or updateLayer on each childView", function() { var runCount = 0, curContext ; var ChildView = SC.View.extend({ renderToContext: function(context) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run }, updateLayer: function() { runCount++; } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); equals(view.renderContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'renderToContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); equals(view.updateContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'updateLayer() invoked for each child view');}); |
|
runCount = 0 ; curContext = view.renderContext('div'); equals(view.updateContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'updateLayer() invoked for each child view'); | test("creates a context and then invokes renderContent and updateContent to call renderToContext or updateLayer on each childView", function() { var runCount = 0, curContext ; var ChildView = SC.View.extend({ renderToContext: function(context) { equals(context.prevObject, curContext, 'passed child context of curContext'); equals(context.tagName(), this.get('tagName'), 'context setup with current tag name'); runCount++; // record run }, updateLayer: function() { runCount++; } }); var view = SC.View.create({ childViews: [ ChildView.extend({ tagName: 'foo' }), ChildView.extend({ tagName: 'bar' }), ChildView.extend({ tagName: 'baz' }) ] }); // VERIFY: firstTime= YES curContext = view.renderContext('div'); equals(view.renderContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'renderToContext() invoked for each child view'); // VERIFY: firstTime= NO runCount = 0 ; //reset curContext = view.renderContext('div'); equals(view.updateContent(curContext), undefined, 'returns nothing'); equals(runCount, 3, 'updateLayer() invoked for each child view');}); |
|
list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) | list_request.data = DcmgrGUI.Util.getPagenateData(c_pagenate.start,c_pagenate.row); | bt_refresh.element.bind('dcmgrGUI.refresh',function(){ //Update list element c_list.page = c_pagenate.current_page; list_request.url = DcmgrGUI.Util.getPagePath('/security_groups/list/',c_list.page); list_request.data = DcmgrGUI.Util.getPagenateData(c_list.page,c_list.maxrow) c_list.element.trigger('dcmgrGUI.updateList',{request:list_request}) $.each(c_list.checked_list,function(check_id,obj){ //All remove detail element $($('#detail').find('#'+check_id)).remove(); //All reload detail element c_list.checked_list[check_id].c_detail.update({ url:DcmgrGUI.Util.getPagePath('/security_groups/show/',check_id) },true); }); }); |
equals(selectedItem.title, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked'); | equals(selectedItem ? selectedItem.title : null, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked'); | setTimeout(function() { selectedItem = menu.get('selectedItem'); ok(selectedItem, 'menu should have selectedItem property set after clicking on menu item'); equals(selectedItem.title, menuItem.get('content').title, 'selectedItem should be set to the content item that was clicked'); equals(1, menu._selectedItemCount, 'selectedItem should only change once when a menu item is clicked'); equals(1, menu._actionCount, 'action is fired once when menu item is clicked'); menu.remove(); ok(!menu.get('isVisibleInWindow'), 'menu should not be visible after being removed'); equals(menu.get('currentMenuItem'), null, 'currentMenuItem should be null after being removed'); start(); }, 250); |
matches = array.nth(tabs.allTabs, function (t) (t.linkedBrowser.lastURI || {}).spec === buffer, 0); | tab.__defineSetter__("ordinal", function (i) nodes.icon.value = nodes.label.textContent = i); | matches = array.nth(tabs.allTabs, function (t) (t.linkedBrowser.lastURI || {}).spec === buffer, 0); |
var f1_keycode = 112; if(jQuery.browser.safari) { f1_keycode = 63236; } | $("#send_chat_message").keypress( function(key) { var retval = false; var f1_keycode = 112; if(jQuery.browser.safari) { f1_keycode = 63236; } if(Speeqe._clear_text) { $("#send_chat_message").empty(); $("#send_chat_message").attr("value",""); Speeqe._clear_text = false; } if(key.keyCode == f1_keycode) //F1 { Speeqe.loadHelpDialog(); return false; } if (key.which == 13) //enter key { Speeqe.sendmessage(); this._last_key = null; } else if(key.keyCode == 9) { //tab key, detect username and try to auto complete var alpha_numeric = this._last_key; if(alpha_numeric) { var match = alpha_numeric.match(/\w/g); if(match) { var username = app.findRosterItem(alpha_numeric); if(username) { var msg_text=$("#send_chat_message").attr("value"); var new_msg = msg_text.replace(alpha_numeric,username); $("#send_chat_message").attr("value",new_msg); this._last_key = null; } } } } else { var keyval = String.fromCharCode(key.which); if(keyval && keyval.match(/\w/g)) { if(this._last_key) { this._last_key += keyval; } else { this._last_key = keyval; } } else { this._last_key = null; } retval = true; } return retval; }); |
|
} if(key.keyCode == f1_keycode) { Speeqe.loadHelpDialog(); return false; | $("#send_chat_message").keypress( function(key) { var retval = false; var f1_keycode = 112; if(jQuery.browser.safari) { f1_keycode = 63236; } if(Speeqe._clear_text) { $("#send_chat_message").empty(); $("#send_chat_message").attr("value",""); Speeqe._clear_text = false; } if(key.keyCode == f1_keycode) //F1 { Speeqe.loadHelpDialog(); return false; } if (key.which == 13) //enter key { Speeqe.sendmessage(); this._last_key = null; } else if(key.keyCode == 9) { //tab key, detect username and try to auto complete var alpha_numeric = this._last_key; if(alpha_numeric) { var match = alpha_numeric.match(/\w/g); if(match) { var username = app.findRosterItem(alpha_numeric); if(username) { var msg_text=$("#send_chat_message").attr("value"); var new_msg = msg_text.replace(alpha_numeric,username); $("#send_chat_message").attr("value",new_msg); this._last_key = null; } } } } else { var keyval = String.fromCharCode(key.which); if(keyval && keyval.match(/\w/g)) { if(this._last_key) { this._last_key += keyval; } else { this._last_key = keyval; } } else { this._last_key = null; } retval = true; } return retval; }); |
|
xhr.overrideMimeType("text/plain; charset=ISO-8859-1"); | transports.xhr = Class(baseTransport, function(supr) { var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = xhr.ontimeout = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { this._aborted = true; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(this._xhr[i]); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { var response = ''; try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } var response = eval(xhr.responseText); if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(xhr.status, response); return; } logger.debug('XHR data received'); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(xhr.status, response); abortXHR(xhr); logger.debug('done handling XHR error'); return; } cb(response); }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { if (this._aborted) { return; } var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } setTimeout(bind(xhr, 'send', data), 0); };}); |
|
i?f:1;return{fragment:f,cacheable:e}}function T(a){for(var b=0,d,f;(d=a[b])!=null;b++)if(!c.noData[d.nodeName.toLowerCase()]&&(f=d[H]))delete c.cache[f]}function L(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)},Ma=A.jQuery,Na=A.$,s=A.document,U,Oa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Pa=/^.[^:#\[\.,]*$/,Qa=/\S/, | 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/, | i?f:1;return{fragment:f,cacheable:e}}function T(a){for(var b=0,d,f;(d=a[b])!=null;b++)if(!c.noData[d.nodeName.toLowerCase()]&&(f=d[H]))delete c.cache[f]}function L(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)},Ma=A.jQuery,Na=A.$,s=A.document,U,Oa=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Pa=/^.[^:#\[\.,]*$/,Qa=/\S/, |
request(ctx.href).addCallback(function(res){ var doc = createHTML(res.responseText); var content = $X('(descendant::span[@class="entry-content"])[1]', doc)[0]; $X('./descendant-or-self::a', content).forEach(function(l){ l.href = resolveRelativePath(l.href, ctx.href); }); body = content.innerHTML. replace(/ (?:rel|target)=".+?"/g, ''). replace('<a href="' + ctx.href.replace('/statuses/', '/status/') + '">...</a>', ''); return body; }) | $X('./descendant::a', content).forEach(function(l){ l.href = l.href; }); | request(ctx.href).addCallback(function(res){ var doc = createHTML(res.responseText); var content = $X('(descendant::span[@class="entry-content"])[1]', doc)[0]; $X('./descendant-or-self::a', content).forEach(function(l){ l.href = resolveRelativePath(l.href, ctx.href); }); body = content.innerHTML. replace(/ (?:rel|target)=".+?"/g, ''). replace('<a href="' + ctx.href.replace('/statuses/', '/status/') + '">...</a>', ''); return body; }) |
q.sort(function (a, b) { return a - b; }); | $.each(q, function (i_, e) { if (e == t) { found = true; return false; } }); | q.sort(function (a, b) { return a - b; }); |
test("adds text-selectable class if view has isTextSelectable", function() { | test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout'); | test("adds text-selectable class if view has isTextSelectable", function() { var view = SC.View.create() ; var context ; context = view.renderContext(); view.set('isTextSelectable', YES); view.prepareContext(context, YES); ok(context.hasClass('allow-select'), 'should have text-selectable class'); context = view.renderContext(); view.set('isTextSelectable', NO); view.prepareContext(context, YES); ok(!context.hasClass('allow-select'), 'should NOT have text-selectable class'); }); |
var view = SC.View.create() ; var context ; context = view.renderContext(); view.set('isTextSelectable', YES); view.prepareContext(context, YES); ok(context.hasClass('allow-select'), 'should have text-selectable class'); context = view.renderContext(); view.set('isTextSelectable', NO); view.prepareContext(context, YES); ok(!context.hasClass('allow-select'), 'should NOT have text-selectable class'); | test("adds text-selectable class if view has isTextSelectable", function() { var view = SC.View.create() ; var context ; context = view.renderContext(); view.set('isTextSelectable', YES); view.prepareContext(context, YES); ok(context.hasClass('allow-select'), 'should have text-selectable class'); context = view.renderContext(); view.set('isTextSelectable', NO); view.prepareContext(context, YES); ok(!context.hasClass('allow-select'), 'should NOT have text-selectable class'); }); |
|
$('#detail').find('#update_'+self.id).live('click',function(){ $.ajax({ "type": "POST", "async": true, "url": '/security_groups/config', "data":"id="+self.id, "dataType": "json", success: function(json,status){ console.log(status); } }); }); | c_list.element.bind('dcmgrGUI.contentChange',function(event,params){ c_list.page = c_pagenate.current_page; c_list.setData(params.data); c_list.singleCheckList(c_list.detail_template); }); | $('#detail').find('#update_'+self.id).live('click',function(){ $.ajax({ "type": "POST", "async": true, "url": '/security_groups/config', "data":"id="+self.id, "dataType": "json", success: function(json,status){ console.log(status); } }); }); |
"string")e=document.getElementById(e);return function(c){e.parentNode.replaceChild(c,e)}};o.fromTextArea=function(e,c){if(typeof e=="string")e=document.getElementById(e);c=c||{};if(e.style.width&&c.width==null)c.width=e.style.width;if(e.style.height&&c.height==null)c.height=e.style.height;if(c.content==null)c.content=e.value;if(e.form){var a=function(){e.value=f.getCode()};typeof e.form.addEventListener=="function"?e.form.addEventListener("submit",a,false):e.form.attachEvent("onsubmit",a);var b=e.form.submit, | "string")a=document.getElementById(a);return function(b){a.parentNode.replaceChild(b,a)}};s.fromTextArea=function(a,b){if(typeof a=="string")a=document.getElementById(a);b=b||{};if(a.style.width&&b.width==null)b.width=a.style.width;if(a.style.height&&b.height==null)b.height=a.style.height;if(b.content==null)b.content=a.value;if(a.form){var c=function(){a.value=d.getCode()};typeof a.form.addEventListener=="function"?a.form.addEventListener("submit",c,false):a.form.attachEvent("onsubmit",c);var e=a.form.submit, | "string")e=document.getElementById(e);return function(c){e.parentNode.replaceChild(c,e)}};o.fromTextArea=function(e,c){if(typeof e=="string")e=document.getElementById(e);c=c||{};if(e.style.width&&c.width==null)c.width=e.style.width;if(e.style.height&&c.height==null)c.height=e.style.height;if(c.content==null)c.content=e.value;if(e.form){var a=function(){e.value=f.getCode()};typeof e.form.addEventListener=="function"?e.form.addEventListener("submit",a,false):e.form.attachEvent("onsubmit",a);var b=e.form.submit, |
var xhr; | exports.transports.xhr = Class(baseTransport, function(supr) { var createXHR = function() { return window.XMLHttpRequest ? new XMLHttpRequest() : window.XDomainRequest ? new XDomainRequest() : window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : null; }; var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { var xhr; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(xhr); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(); return; } logger.debug('XHR data received'); cb(eval(xhr.responseText)); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(); abortXHR(xhr); logger.debug('done handling XHR error'); } }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } if(data) { xhr.send(data); } else { xhr.send(); } };}); |
|
abortXHR(xhr); | abortXHR(this._xhr[i]); | exports.transports.xhr = Class(baseTransport, function(supr) { var createXHR = function() { return window.XMLHttpRequest ? new XMLHttpRequest() : window.XDomainRequest ? new XDomainRequest() : window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : null; }; var abortXHR = function(xhr) { logger.debug('aborting XHR'); try { if('onload' in xhr) { xhr.onload = xhr.onerror = null; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = null; } if(xhr.abort) { xhr.abort(); } } catch(e) { logger.debug('error aborting xhr', e); } }; this.init = function() { supr(this, 'init'); this._xhr = { 'send': createXHR(), 'comet': createXHR() }; }; this.abort = function() { var xhr; for(var i in this._xhr) { if(this._xhr.hasOwnProperty(i)) { abortXHR(xhr); } } }; this.encodePacket = function(packetId, data, options) { // we don't need to base64 encode things unless there's a null character in there return data.indexOf('\0') == -1 ? [ packetId, 0, data ] : [ packetId, 1, base64.encode(data) ]; }; this._onReadyStateChange = function(rType, cb, eb) { try { var xhr = this._xhr[rType]; if(xhr.readyState != 4) { return; } if(xhr.status != 200) { logger.debug('XHR failed with status ', xhr.status); eb(); return; } logger.debug('XHR data received'); cb(eval(xhr.responseText)); } catch(e) { var xhr = this._xhr[rType]; logger.debug('Error in XHR::onReadyStateChange', e); eb(); abortXHR(xhr); logger.debug('done handling XHR error'); } }; /** * even though we encode the POST body as in application/x-www-form-urlencoded */ this._makeRequest = function(rType, url, args, cb, eb) { var xhr = this._xhr[rType], data = args.d || null; if('d' in args) { delete args.d; } xhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first xhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting if('onload' in xhr) { xhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb); xhr.onerror = xhr.ontimeout = eb; } else if('onreadystatechange' in xhr) { xhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb); } if(data) { xhr.send(data); } else { xhr.send(); } };}); |
this._backend.loadConfig(schemaName, function (config) { schema = new Schema (schemaName, config); | this._backend.loadSchema(schemaName, function (schema) { | this._backend.loadConfig(schemaName, function (config) { schema = new Schema (schemaName, config); me.engine = new Engine(schema, me, me._backend); testAll(me); }); |
}); | }, "_sync"); | this._backend.loadConfig(schemaName, function (config) { schema = new Schema (schemaName, config); me.engine = new Engine(schema, me, me._backend); testAll(me); }); |
test("invokes renderLayout if first time", function() { | test("invokes renderLayout each time", function() { | test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); // test w/ firstTime context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); // test w/o firstTime runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');}); |
equals(runCount, 0, 'should not call renderLayout'); | equals(runCount, 1, 'should call renderLayout'); | test("invokes renderLayout if first time", function() { var runCount = 0; var context, isFirstTime ; var view = SC.View.create({ renderLayout: function(aContext, firstTime) { equals(aContext, context, 'passed context'); equals(firstTime, isFirstTime, 'passed firstTime'); runCount++; } }); // test w/ firstTime context = view.renderContext(); isFirstTime = YES ; view.prepareContext(context, YES); equals(runCount, 1, 'should call renderLayout'); // test w/o firstTime runCount = 0 ; context = view.renderContext(); isFirstTime = NO ; view.prepareContext(context, NO); equals(runCount, 0, 'should not call renderLayout');}); |
$.each(xformRules, function (i_, r) { | this.xform = (xformRules.length == 0) ? null : function (s) { $.each(xformRules, function (i_, r) { | $.each(xformRules, function (i_, r) { s = s.replace(r.pattern, r.repl); }); |
return s; }; | $.each(xformRules, function (i_, r) { s = s.replace(r.pattern, r.repl); }); |
|
function (count) { if (typeof count != "number" || count < 1) count = 1; | let res = io.withTempFiles(function (tmpfile) { if (textBox) { textBox.setAttribute("readonly", "true"); oldBg = textBox.style.backgroundColor; tmpBg = "yellow"; textBox.style.backgroundColor = "#bbbbbb"; } | function (count) { if (typeof count != "number" || count < 1) count = 1; while (count--) caretExecute(false, true); }, |
while (count--) caretExecute(false, true); }, | if (!tmpfile.write(text)) throw Error("Input contains characters not valid in the current " + "file encoding"); let lastUpdate = Date.now(); function update(force) { if (force !== true && tmpfile.lastModifiedTime <= lastUpdate) return; lastUpdate = Date.now(); let val = tmpfile.read(); if (textBox) textBox.value = val; else { while (editor.rootElement.firstChild) editor.rootElement.removeChild(editor.rootElement.firstChild); editor.rootElement.innerHTML = val; } } let timer = services.create("timer"); timer.initWithCallback({ notify: update }, 100, timer.TYPE_REPEATING_SLACK); try { this.editFileExternally(tmpfile.path); } finally { timer.cancel(); } update(true); if (textBox) textBox.removeAttribute("readonly"); }, this); | function (count) { if (typeof count != "number" || count < 1) count = 1; while (count--) caretExecute(false, true); }, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.