_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q61400
validation
function () { var f = [], len, i; this.filters.each(function (filter) { if (filter.active) { f.push(filter); } }); len = f.length; return function (record) { for (i = 0; i < len; i++) { if (!f[i].validateRecord(record)) { return false; } } return true; }; }
javascript
{ "resource": "" }
q61401
validation
function (config) { var me = this, columns = me.getGridPanel().columns, i, columnsLength, column, filtersLength, filter; for (i = 0, columnsLength = columns.length; i < columnsLength; i++) { column = columns[i]; if (column.dataIndex === config.dataIndex) { column.filter = config; } } if (me.view.headerCt.menu) { me.createFilters(); } else { // Call getMenu() to ensure the menu is created, and so, also are the filters. We cannot call // createFilters() withouth having a menu because it will cause in a recursion to applyState() // that ends up to clear all the filter values. This is likely to happen when we reorder a column // and then add a new filter before the menu is recreated. me.view.headerCt.getMenu(); } for (i = 0, filtersLength = me.filters.items.length; i < filtersLength; i++) { filter = me.filters.items[i]; if (filter.dataIndex === config.dataIndex) { return filter; } } }
javascript
{ "resource": "" }
q61402
validation
function (filters) { if (filters) { var me = this, i, filtersLength; for (i = 0, filtersLength = filters.length; i < filtersLength; i++) { me.addFilter(filters[i]); } } }
javascript
{ "resource": "" }
q61403
validation
function () { var items = this.getFilterItems(), filters = [], n, nlen, item, d, i, len; for (n = 0, nlen = items.length; n < nlen; n++) { item = items[n]; if (item.active) { d = [].concat(item.serialize()); for (i = 0, len = d.length; i < len; i++) { filters.push({ field: item.dataIndex, data: d[i] }); } } } return filters; }
javascript
{ "resource": "" }
q61404
validation
function (p) { // if encoding just delete the property if (this.encode) { delete p[this.paramPrefix]; // otherwise scrub the object of filter data } else { var regex, key; regex = new RegExp('^' + this.paramPrefix + '\[[0-9]+\]'); for (key in p) { if (regex.test(key)) { delete p[key]; } } } }
javascript
{ "resource": "" }
q61405
validation
function(record, columnHeader) { var me = this, grid = me.editingPlugin.grid, store = grid.store, view = grid.getView(), context = me.context = Ext.apply(me.editingPlugin.context, { view: view, store: store }); if (!me.rendered) { me.render(view.el); } // make sure our row is selected before editing context.grid.getSelectionModel().select(record); // Reload the record data me.loadRecord(record); if (!me.isVisible()) { me.show(); } me.reposition({ callback: this.focusContextCell }); }
javascript
{ "resource": "" }
q61406
Approximate
validation
function Approximate() { if(arguments.length > 0) { if(arguments[0].length < 1 || arguments[0].charAt(0) != 'A') { throw new Error('Invalid Approximate Date'); } try { Simple.call(this, arguments[0].substr(1)); } catch(e) { throw new Error(e.message+' in Approximate Date'); } } else { Simple.call(this); } }
javascript
{ "resource": "" }
q61407
validation
function(form, url, params, options) { form = Ext.getDom(form); options = options || {}; var id = Ext.id(), frame = document.createElement('iframe'), hiddens = [], encoding = 'multipart/form-data', buf = { target: form.target, method: form.method, encoding: form.encoding, enctype: form.enctype, action: form.action }, addField = function(name, value) { hiddenItem = document.createElement('input'); Ext.fly(hiddenItem).set({ type: 'hidden', value: value, name: name }); form.appendChild(hiddenItem); hiddens.push(hiddenItem); }, hiddenItem, obj, value, name, vLen, v, hLen, h; /* * Originally this behaviour was modified for Opera 10 to apply the secure URL after * the frame had been added to the document. It seems this has since been corrected in * Opera so the behaviour has been reverted, the URL will be set before being added. */ Ext.fly(frame).set({ id: id, name: id, cls: Ext.baseCSSPrefix + 'hide-display', src: Ext.SSL_SECURE_URL }); document.body.appendChild(frame); // This is required so that IE doesn't pop the response up in a new window. if (document.frames) { document.frames[id].name = id; } Ext.fly(form).set({ target: id, method: 'POST', enctype: encoding, encoding: encoding, action: url || buf.action }); // add dynamic params if (params) { obj = Ext.Object.fromQueryString(params) || {}; for (name in obj) { if (obj.hasOwnProperty(name)) { value = obj[name]; if (Ext.isArray(value)) { vLen = value.length; for (v = 0; v < vLen; v++) { addField(name, value[v]); } } else { addField(name, value); } } } } Ext.fly(frame).on('load', Ext.Function.bind(this.onUploadComplete, this, [frame, options]), null, {single: !Ext.isOpera}); form.submit(); Ext.fly(form).set(buf); hLen = hiddens.length; for (h = 0; h < hLen; h++) { Ext.removeNode(hiddens[h]); } }
javascript
{ "resource": "" }
q61408
validation
function(options) { var form = this.getForm(options); if (form) { return (options.isUpload || (/multipart\/form-data/i).test(form.getAttribute('enctype'))); } return false; }
javascript
{ "resource": "" }
q61409
validation
function(options, url) { var form = this.getForm(options); if (form) { url = url || form.action; } return url; }
javascript
{ "resource": "" }
q61410
validation
function(options, params) { var form = this.getForm(options), serializedForm; if (form && !this.isFormUpload(options)) { serializedForm = Ext.Element.serializeForm(form); params = params ? (params + '&' + serializedForm) : serializedForm; } return params; }
javascript
{ "resource": "" }
q61411
validation
function(request) { if (!request) { request = this.getLatest(); } if (!(request && request.xhr)) { return false; } // if there is a connection and readyState is not 0 or 4, or in case of BinaryXHR, not 4 var state = request.xhr.readyState; return ((request.xhr instanceof Ext.data.flash.BinaryXhr) && state != 4) || !(state === 0 || state == 4); }
javascript
{ "resource": "" }
q61412
validation
function(request) { var me = this, xhr; if (!request) { request = me.getLatest(); } if (request && me.isLoading(request)) { /* * Clear out the onreadystatechange here, this allows us * greater control, the browser may/may not fire the function * depending on a series of conditions. */ xhr = request.xhr; try { xhr.onreadystatechange = null; } catch (e) { // Setting onreadystatechange to null can cause problems in IE, see // http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_a_1.html xhr.onreadystatechange = Ext.emptyFn; } xhr.abort(); me.clearTimeout(request); if (!request.timedout) { request.aborted = true; } me.onComplete(request); me.cleanup(request); } }
javascript
{ "resource": "" }
q61413
validation
function(){ var requests = this.requests, id; for (id in requests) { if (requests.hasOwnProperty(id)) { this.abort(requests[id]); } } }
javascript
{ "resource": "" }
q61414
validation
function(request, xdrResult) { var me = this; // Using CORS with IE doesn't support readyState so we fake it if ((request.xhr && request.xhr.readyState == 4) || me.isXdr) { me.clearTimeout(request); me.onComplete(request, xdrResult); me.cleanup(request); Ext.EventManager.idleEvent.fire(); } }
javascript
{ "resource": "" }
q61415
validation
function(request, xdrResult) { var me = this, options = request.options, result, success, response; try { result = me.parseStatus(request.xhr.status); } catch (e) { // in some browsers we can't access the status if the readyState is not 4, so the request has failed result = { success : false, isException : false }; } success = me.isXdr ? xdrResult : result.success; if (success) { response = me.createResponse(request); me.fireEvent('requestcomplete', me, response, options); Ext.callback(options.success, options.scope, [response, options]); } else { if (result.isException || request.aborted || request.timedout) { response = me.createException(request); } else { response = me.createResponse(request); } me.fireEvent('requestexception', me, response, options); Ext.callback(options.failure, options.scope, [response, options]); } Ext.callback(options.callback, options.scope, [options, success, response]); delete me.requests[request.id]; return response; }
javascript
{ "resource": "" }
q61416
validation
function(status) { // see: https://prototype.lighthouseapp.com/projects/8886/tickets/129-ie-mangles-http-response-status-code-204-to-1223 status = status == 1223 ? 204 : status; var success = (status >= 200 && status < 300) || status == 304, isException = false; if (!success) { switch (status) { case 12002: case 12029: case 12030: case 12031: case 12152: case 13030: isException = true; break; } } return { success: success, isException: isException }; }
javascript
{ "resource": "" }
q61417
validation
function(request) { return { request : request, requestId : request.id, status : request.aborted ? -1 : 0, statusText : request.aborted ? 'transaction aborted' : 'communication failure', aborted: request.aborted, timedout: request.timedout }; }
javascript
{ "resource": "" }
q61418
validation
function() { var scriptTag = document.createElement('script'); scriptTag.type = 'text/vbscript'; scriptTag.text = [ 'Function getIEByteArray(byteArray, out)', 'Dim len, i', 'len = LenB(byteArray)', 'For i = 1 to len', 'out.push(AscB(MidB(byteArray, i, 1)))', 'Next', 'End Function' ].join('\n'); Ext.getHead().dom.appendChild(scriptTag); this.self.vbScriptInjected = true; }
javascript
{ "resource": "" }
q61419
daysInMonth
validation
function daysInMonth(month, year) { switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: var leapyear; if(year % 4 != 0) { leapyear = false; } else if(year % 100 != 0) { leapyear = true; } else if(year % 400 != 0) { leapyear = false; } else { leapyear = true; } if(leapyear) { return 29; } else { return 28; } default: throw new Error('Unknown Month'); } }
javascript
{ "resource": "" }
q61420
setDefaults
validation
function setDefaults() { // sequence: generate a random 3-byte integer initial value for the sequence counter if (seq === undefined) seq = ~~(Math.random() * 0xffffff) // processId: 2-byte integer derived from the PID assigned by the OS if (pid === undefined) pid = process.pid % 0xffff // machineId: first three bytes of the md5 hash calculated from OS hostname if (mid === undefined) mid = crypto.createHash('md5') .update(os.hostname()) .digest() .slice(0, 3) .readUIntBE(0, 3) // reset the counter // (if `mid` or `pid` changes then previously allocated ids in the current second are freed) ctr = 0 // `unique` is the fixed-length composition of `mid` and `pid` unique = pad(mid, 6, 16) + pad(pid, 4, 16) // calculate the initial sequence prefix seqpref = pad(~~(seq / 16), 5, 16) }
javascript
{ "resource": "" }
q61421
getTimestamp
validation
function getTimestamp() { // use `Math.floor()` here to avoid the "Unix Millennium Bug" var now = Math.floor(Date.now() / 1000) // it's another second since the last id were created, // so we need to regenerate the timestamp if (time !== now) { ctr = 0 timestamp = pad(time = now, 8, 16) } // Since changing parts of an identifier are the timestamp and // the sequence; the count of maximum allocatable ids in a second // is limited by the sequence size (3-bytes = about 16 million). // Otherwise uniqueness is not guaranteed. else assert(++ctr < 0x1000000, 'more than 16 million ids generated in 1 second') return timestamp }
javascript
{ "resource": "" }
q61422
getSequence
validation
function getSequence() { var mod = ++seq % 16 // reset counter if (seq > 0xffffff) seq = mod = 0 // If counter is divisible by 16 then // the sequence prefix should be regenerated. // Otherwise only the last digit changed, // so we don't need to update the prefix. if (!mod) seqpref = pad(~~(seq / 16), 5, 16) return seqpref + digits[ mod ] }
javascript
{ "resource": "" }
q61423
assertRange
validation
function assertRange(name, val, max) { assert.equal(typeof val, 'number', name + ' must be a number') assert(!isNaN(val), 'number', name + ' must be a number') if (val > max) throw new RangeError(name + ' must be lower than ' + max + ', but is ' + val) else if (val < 0) throw new RangeError(name + ' must be greater than or equal to zero, but is ' + val) else if (val % 1) throw new RangeError(name + ' must be an integer') }
javascript
{ "resource": "" }
q61424
proceedToFetch
validation
function proceedToFetch(loader, load, p) { proceedToTranslate(loader, load, p // 15.2.4.4.1 CallFetch .then(function(address) { if (load.linkSets.length == 0) return; load.address = address; return loader.loaderObj.fetch({ name: load.name, metadata: load.metadata, address: address }); }) ); }
javascript
{ "resource": "" }
q61425
asyncStartLoadPartwayThrough
validation
function asyncStartLoadPartwayThrough(stepState) { return function(resolve, reject) { var loader = stepState.loader; var name = stepState.moduleName; var step = stepState.step; if (loader.modules[name]) throw new TypeError('"' + name + '" already exists in the module table'); // NB this still seems wrong for LoadModule as we may load a dependency // of another module directly before it has finished loading. for (var i = 0, l = loader.loads.length; i < l; i++) if (loader.loads[i].name == name) throw new TypeError('"' + name + '" already loading'); var load = createLoad(name); load.metadata = stepState.moduleMetadata; var linkSet = createLinkSet(loader, load); loader.loads.push(load); resolve(linkSet.done); if (step == 'locate') proceedToLocate(loader, load); else if (step == 'fetch') proceedToFetch(loader, load, Promise.resolve(stepState.moduleAddress)); else { console.assert(step == 'translate', 'translate step'); load.address = stepState.moduleAddress; proceedToTranslate(loader, load, Promise.resolve(stepState.moduleSource)); } } }
javascript
{ "resource": "" }
q61426
updateLinkSetOnLoad
validation
function updateLinkSetOnLoad(linkSet, load) { console.assert(load.status == 'loaded' || load.status == 'linked', 'loaded or linked'); // console.log('update linkset on load ' + load.name); // snapshot(linkSet.loader); linkSet.loadingCount--; if (linkSet.loadingCount > 0) return; var startingLoad = linkSet.loads[0]; try { link(linkSet); } catch(exc) { return linkSetFailed(linkSet, exc); } console.assert(linkSet.loads.length == 0, 'loads cleared'); linkSet.resolve(startingLoad); }
javascript
{ "resource": "" }
q61427
finishLoad
validation
function finishLoad(loader, load) { // if not anonymous, add to the module table if (load.name) { console.assert(!loader.modules[load.name], 'load not in module table'); loader.modules[load.name] = load.module; } var loadIndex = indexOf.call(loader.loads, load); if (loadIndex != -1) loader.loads.splice(loadIndex, 1); for (var i = 0, l = load.linkSets.length; i < l; i++) { loadIndex = indexOf.call(load.linkSets[i].loads, load); if (loadIndex != -1) load.linkSets[i].loads.splice(loadIndex, 1); } load.linkSets.splice(0, load.linkSets.length); }
javascript
{ "resource": "" }
q61428
link
validation
function link(linkSet) { var loader = linkSet.loader; // console.log('linking {' + logloads(loads) + '}'); // snapshot(loader); // 15.2.5.3.1 LinkageGroups alternative implementation // build all the groups // because the first load represents the top of the tree // for a given linkset, we can work down from there var groups = []; var startingLoad = linkSet.loads[0]; startingLoad.groupIndex = 0; buildLinkageGroups(startingLoad, linkSet.loads, groups, loader); // determine the kind of the bottom group var curGroupDeclarative = (startingLoad.kind == 'declarative') == groups.length % 2; // run through the groups from bottom to top for (var i = groups.length - 1; i >= 0; i--) { var group = groups[i]; for (var j = 0; j < group.length; j++) { var load = group[j]; // 15.2.5.5 LinkDeclarativeModules adjusted if (curGroupDeclarative) { linkDeclarativeModule(load, linkSet.loads, loader); } // 15.2.5.6 LinkDynamicModules adjusted else { var module = load.execute(); if (!(module.__esModule)) throw new TypeError('Execution must define a Module instance'); load.module = { module: module }; load.status = 'linked'; } finishLoad(loader, load); } // alternative current kind for next loop curGroupDeclarative = !curGroupDeclarative; } }
javascript
{ "resource": "" }
q61429
linkDeclarativeModule
validation
function linkDeclarativeModule(load, loads, loader) { // only link if already not already started linking (stops at circular) if (load.module) return; // declare the module with an empty depMap var depMap = []; var sys = __global.System; __global.System = loader; var registryEntry = load.declare.call(__global, depMap); __global.System = sys; var moduleDependencies = []; // module is just a plain object, until we evaluate it var module = registryEntry.exports; console.assert(!load.module, 'Load module already declared!'); load.module = { name: load.name, dependencies: moduleDependencies, execute: registryEntry.execute, exports: module, evaluated: false }; // now link all the module dependencies // amending the depMap as we go for (var i = 0; i < load.dependencies.length; i++) { var depName = load.dependencies[i].value; var depModule; // if dependency already a module, use that if (loader.modules[depName]) { depModule = loader.modules[depName]; } // otherwise we need to link the dependency else { for (var j = 0; j < loads.length; j++) { if (loads[j].name != depName) continue; linkDeclarativeModule(loads[j], loads, loader); depModule = loads[j].exports || loads[j].module; } } console.assert(depModule, 'Dependency module not found!'); console.assert(depModule.exports, 'Dependency module not found!'); if (registryEntry.exportStar && indexOf.call(registryEntry.exportStar, load.dependencies[i].key) != -1) { // we are exporting * from this dependency (function(depModuleModule) { for (var p in depModuleModule) (function(p) { // if the property is already defined throw? defineProperty(module, p, { enumerable: true, get: function() { return depModuleModule[p]; }, set: function(value) { depModuleModule[p] = value; } }); })(p); })(depModule.exports); } moduleDependencies.push(depModule); depMap[i] = depModule.exports; } load.status = 'linked'; }
javascript
{ "resource": "" }
q61430
validation
function() { var me = this, view = me.view; view.on({ scope: me, groupclick: me.onGroupClick }); if (me.enableGroupingMenu) { me.injectGroupingMenu(); } me.pruneGroupedHeader(); me.lastGroupField = me.getGroupField(); me.block(); me.onGroupChange(); me.unblock(); }
javascript
{ "resource": "" }
q61431
validation
function(menuItem, e) { var me = this, menu = menuItem.parentMenu, hdr = menu.activeHeader, view = me.view, store = view.store; delete me.lastGroupIndex; me.block(); me.enable(); store.group(hdr.dataIndex); me.pruneGroupedHeader(); me.unblock(); me.refreshIf(); }
javascript
{ "resource": "" }
q61432
validation
function() { var me = this, header = me.getGroupedHeader(); if (me.hideGroupedHeader && header) { Ext.suspendLayouts(); if (me.prunedHeader && me.prunedHeader !== header) { me.prunedHeader.show(); } me.prunedHeader = header; header.hide(); Ext.resumeLayouts(true); } }
javascript
{ "resource": "" }
q61433
validation
function(dataIndex){ var view = this.view, header = view.headerCt.down('gridcolumn[dataIndex=' + dataIndex + ']'), menu = view.headerCt.getMenu(); return header ? menu.down('menuitem[headerId='+ header.id +']') : null; }
javascript
{ "resource": "" }
q61434
process
validation
function process(o, force_rich) { var dom = ed.dom, rng; // Execute pre process handlers t.onPreProcess.dispatch(t, o); // Create DOM structure o.node = dom.create('div', 0, o.content); // If pasting inside the same element and the contents is only one block // remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element if (tinymce.isGecko) { rng = ed.selection.getRng(true); if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) { // Is only one block node and it doesn't contain word stuff if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1) dom.remove(o.node.firstChild, true); } } // Execute post process handlers t.onPostProcess.dispatch(t, o); // Serialize content o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''}); // Plain text option active? if ((!force_rich) && (ed.pasteAsPlainText)) { t._insertPlainText(o.content); if (!getParam(ed, "paste_text_sticky")) { ed.pasteAsPlainText = false; ed.controlManager.setActive("pastetext", false); } } else { t._insert(o.content); } }
javascript
{ "resource": "" }
q61435
grabContent
validation
function grabContent(e) { var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent; // Check if browser supports direct plaintext access if (e.clipboardData || dom.doc.dataTransfer) { textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text'); if (ed.pasteAsPlainText) { e.preventDefault(); process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')}); return; } } if (dom.get('_mcePaste')) return; // Create container to paste into n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF'); // If contentEditable mode we need to find out the position of the closest element if (body != ed.getDoc().body) posY = dom.getPos(ed.selection.getStart(), body).y; else posY = body.scrollTop + dom.getViewPort(ed.getWin()).y; // Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles // If also needs to be in view on IE or the paste would fail dom.setStyles(n, { position : 'absolute', left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div top : posY - 25, width : 1, height : 1, overflow : 'hidden' }); if (tinymce.isIE) { // Store away the old range oldRng = sel.getRng(); // Select the container rng = dom.doc.body.createTextRange(); rng.moveToElementText(n); rng.execCommand('Paste'); // Remove container dom.remove(n); // Check if the contents was changed, if it wasn't then clipboard extraction failed probably due // to IE security settings so we pass the junk though better than nothing right if (n.innerHTML === '\uFEFF\uFEFF') { ed.execCommand('mcePasteWord'); e.preventDefault(); return; } // Restore the old range and clear the contents before pasting sel.setRng(oldRng); sel.setContent(''); // For some odd reason we need to detach the the mceInsertContent call from the paste event // It's like IE has a reference to the parent element that you paste in and the selection gets messed up // when it tries to restore the selection setTimeout(function() { // Process contents process({content : n.innerHTML}); }, 0); // Block the real paste event return tinymce.dom.Event.cancel(e); } else { function block(e) { e.preventDefault(); }; // Block mousedown and click to prevent selection change dom.bind(ed.getDoc(), 'mousedown', block); dom.bind(ed.getDoc(), 'keydown', block); or = ed.selection.getRng(); // Move select contents inside DIV n = n.firstChild; rng = ed.getDoc().createRange(); rng.setStart(n, 0); rng.setEnd(n, 2); sel.setRng(rng); // Wait a while and grab the pasted contents window.setTimeout(function() { var h = '', nl; // Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit if (!dom.select('div.mcePaste > div.mcePaste').length) { nl = dom.select('div.mcePaste'); // WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string each(nl, function(n) { var child = n.firstChild; // WebKit inserts a DIV container with lots of odd styles if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) { dom.remove(child, 1); } // Remove apply style spans each(dom.select('span.Apple-style-span', n), function(n) { dom.remove(n, 1); }); // Remove bogus br elements each(dom.select('br[data-mce-bogus]', n), function(n) { dom.remove(n); }); // WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV if (n.parentNode.className != 'mcePaste') h += n.innerHTML; }); } else { // Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc // So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>'; } // Remove the nodes each(dom.select('div.mcePaste'), function(n) { dom.remove(n); }); // Restore the old selection if (or) sel.setRng(or); process({content : h}); // Unblock events ones we got the contents dom.unbind(ed.getDoc(), 'mousedown', block); dom.unbind(ed.getDoc(), 'keydown', block); }, 0); } }
javascript
{ "resource": "" }
q61436
validation
function(pl, o) { var t = this, ed = t.editor, dom = ed.dom, styleProps; if (ed.settings.paste_enable_default_filters == false) { return; } if (o.wordContent) { // Remove named anchors or TOC links each(dom.select('a', o.node), function(a) { if (!a.href || a.href.indexOf('#_Toc') != -1) dom.remove(a, 1); }); if (getParam(ed, "paste_convert_middot_lists")) { t._convertLists(pl, o); } // Process styles styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties // Process only if a string was specified and not equal to "all" or "*" if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) { styleProps = tinymce.explode(styleProps.replace(/^none$/i, "")); // Retains some style properties each(dom.select('*', o.node), function(el) { var newStyle = {}, npc = 0, i, sp, sv; // Store a subset of the existing styles if (styleProps) { for (i = 0; i < styleProps.length; i++) { sp = styleProps[i]; sv = dom.getStyle(el, sp); if (sv) { newStyle[sp] = sv; npc++; } } } // Remove all of the existing styles dom.setAttrib(el, 'style', ''); if (styleProps && npc > 0) dom.setStyles(el, newStyle); // Add back the stored subset of styles else // Remove empty span tags that do not have class attributes if (el.nodeName == 'SPAN' && !el.className) dom.remove(el, true); }); } } // Remove all style information or only specifically on WebKit to avoid the style bug on that browser if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) { each(dom.select('*[style]', o.node), function(el) { el.removeAttribute('style'); el.removeAttribute('data-mce-style'); }); } else { if (tinymce.isWebKit) { // We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." /> // Removing the mce_style that contains the real value will force the Serializer engine to compress the styles each(dom.select('*', o.node), function(el) { el.removeAttribute('data-mce-style'); }); } } }
javascript
{ "resource": "" }
q61437
validation
function(h, skip_undo) { var ed = this.editor, r = ed.selection.getRng(); // First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells. if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer) ed.getDoc().execCommand('Delete', false, null); ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo}); }
javascript
{ "resource": "" }
q61438
validation
function() { var t = this, ed = t.editor; // Register command(s) for backwards compatibility ed.addCommand("mcePasteWord", function() { ed.windowManager.open({ file: t.url + "/pasteword.htm", width: parseInt(getParam(ed, "paste_dialog_width")), height: parseInt(getParam(ed, "paste_dialog_height")), inline: 1 }); }); if (getParam(ed, "paste_text_use_dialog")) { ed.addCommand("mcePasteText", function() { ed.windowManager.open({ file : t.url + "/pastetext.htm", width: parseInt(getParam(ed, "paste_dialog_width")), height: parseInt(getParam(ed, "paste_dialog_height")), inline : 1 }); }); } // Register button for backwards compatibility ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"}); }
javascript
{ "resource": "" }
q61439
manager
validation
function manager(map, key) { if (!(key instanceof Object)) { throw new TypeError('Key must be an object') } let contents = map.get(key) if (!contents) { map.set(key, contents = {}) } return contents }
javascript
{ "resource": "" }
q61440
end
validation
function end() { var transformed; if (ignore.some(minimatch.bind(null, file))) { var compiled = coffee.compile(data, { sourceMap: true, generatedFile: file, inline: true, bare: options.bare, literate: isLiterate(file) }); transformed = compiled.js; } else { var instrumented = instrumentor.instrumentCoffee(file, data); var js = options.noInit ? instrumented.js : instrumented.init + instrumented.js; transformed = js; } this.queue(transformed); this.queue(null); }
javascript
{ "resource": "" }
q61441
validation
function(view, initial){ var me = this, checkbox = me.injectCheckbox, headerCt = view.headerCt; // Preserve behaviour of false, but not clear why that would ever be done. if (checkbox !== false) { if (checkbox == 'first') { checkbox = 0; } else if (checkbox == 'last') { checkbox = headerCt.getColumnCount(); } Ext.suspendLayouts(); if (view.getStore().buffered) { me.showHeaderCheckbox = false; } headerCt.add(checkbox, me.getHeaderConfig()); Ext.resumeLayouts(); } if (initial !== true) { view.refresh(); } }
javascript
{ "resource": "" }
q61442
validation
function(isChecked) { var view = this.views[0], headerCt = view.headerCt, checkHd = headerCt.child('gridcolumn[isCheckerHd]'), cls = this.checkerOnCls; if (checkHd) { if (isChecked) { checkHd.addCls(cls); } else { checkHd.removeCls(cls); } } }
javascript
{ "resource": "" }
q61443
validation
function(headerCt, header, e) { if (header.isCheckerHd) { e.stopEvent(); var me = this, isChecked = header.el.hasCls(Ext.baseCSSPrefix + 'grid-hd-checker-on'); // Prevent focus changes on the view, since we're selecting/deselecting all records me.preventFocus = true; if (isChecked) { me.deselectAll(); } else { me.selectAll(); } delete me.preventFocus; } }
javascript
{ "resource": "" }
q61444
validation
function() { var me = this, showCheck = me.showHeaderCheckbox !== false; return { isCheckerHd: showCheck, text : '&#160;', width: me.headerWidth, sortable: false, draggable: false, resizable: false, hideable: false, menuDisabled: true, dataIndex: '', cls: showCheck ? Ext.baseCSSPrefix + 'column-header-checkbox ' : '', renderer: Ext.Function.bind(me.renderer, me), editRenderer: me.editRenderer || me.renderEmpty, locked: me.hasLockedHeader() }; }
javascript
{ "resource": "" }
q61445
validation
function(list) { var store = list.getStore(); return Ext.Array.sort(list.getSelectionModel().getSelection(), function(a, b) { a = store.indexOf(a); b = store.indexOf(b); if (a < b) { return -1; } else if (a > b) { return 1; } return 0; }); }
javascript
{ "resource": "" }
q61446
validation
function() { var me = this; me.mixins.field.setValue.call(me, me.setupValue(me.toField.store.getRange())); }
javascript
{ "resource": "" }
q61447
validation
function () { var me = this, cfg = { app: me, taskbarConfig: me.getTaskbarConfig() }; Ext.apply(cfg, me.desktopConfig); return cfg; }
javascript
{ "resource": "" }
q61448
validation
function () { var me = this, cfg = { app: me, menu: [] }, launcher; Ext.apply(cfg, me.startConfig); Ext.each(me.modules, function (module) { launcher = module.launcher; if (launcher) { launcher.handler = launcher.handler || Ext.bind(me.createWindow, me, [module]); cfg.menu.push(module.launcher); } }); return cfg; }
javascript
{ "resource": "" }
q61449
validation
function () { var me = this, cfg = { app: me, startConfig: me.getStartConfig() }; Ext.apply(cfg, me.taskbarConfig); return cfg; }
javascript
{ "resource": "" }
q61450
validation
function(id, lastEditId, readyCb){ //console.log('adding view task: ' + id + ' ' + lastEditId + ' ' + new Error().stack) addViewTasks.push({id: id, lastEditId: lastEditId, cb: readyCb}) if(!hasViews){ poll() } hasViews = true }
javascript
{ "resource": "" }
q61451
validation
function(array, fn, scope, reverse) { array = ExtArray.from(array); var i, ln = array.length; if (reverse !== true) { for (i = 0; i < ln; i++) { if (fn.call(scope || array[i], array[i], i, array) === false) { return i; } } } else { for (i = ln - 1; i > -1; i--) { if (fn.call(scope || array[i], array[i], i, array) === false) { return i; } } } return true; }
javascript
{ "resource": "" }
q61452
validation
function(array) { var clone = [], i = 0, ln = array.length, item; for (; i < ln; i++) { item = array[i]; if (ExtArray.indexOf(clone, item) === -1) { clone.push(item); } } return clone; }
javascript
{ "resource": "" }
q61453
validation
function(array, fn, scope) { var i = 0, len = array.length; for (; i < len; i++) { if (fn.call(scope || array, array[i], i)) { return array[i]; } } return null; }
javascript
{ "resource": "" }
q61454
validation
function(array, item) { var index = ExtArray.indexOf(array, item); if (index !== -1) { erase(array, index, 1); } return array; }
javascript
{ "resource": "" }
q61455
validation
function() { var args = slice.call(arguments), array = [], i, ln; for (i = 0, ln = args.length; i < ln; i++) { array = array.concat(args[i]); } return ExtArray.unique(array); }
javascript
{ "resource": "" }
q61456
validation
function() { var intersection = [], arrays = slice.call(arguments), arraysLength, array, arrayLength, minArray, minArrayIndex, minArrayCandidate, minArrayLength, element, elementCandidate, elementCount, i, j, k; if (!arrays.length) { return intersection; } // Find the smallest array arraysLength = arrays.length; for (i = minArrayIndex = 0; i < arraysLength; i++) { minArrayCandidate = arrays[i]; if (!minArray || minArrayCandidate.length < minArray.length) { minArray = minArrayCandidate; minArrayIndex = i; } } minArray = ExtArray.unique(minArray); erase(arrays, minArrayIndex, 1); // Use the smallest unique'd array as the anchor loop. If the other array(s) do contain // an item in the small array, we're likely to find it before reaching the end // of the inner loop and can terminate the search early. minArrayLength = minArray.length; arraysLength = arrays.length; for (i = 0; i < minArrayLength; i++) { element = minArray[i]; elementCount = 0; for (j = 0; j < arraysLength; j++) { array = arrays[j]; arrayLength = array.length; for (k = 0; k < arrayLength; k++) { elementCandidate = array[k]; if (element === elementCandidate) { elementCount++; break; } } } if (elementCount === arraysLength) { intersection.push(element); } } return intersection; }
javascript
{ "resource": "" }
q61457
validation
function(arrayA, arrayB) { var clone = slice.call(arrayA), ln = clone.length, i, j, lnB; for (i = 0,lnB = arrayB.length; i < lnB; i++) { for (j = 0; j < ln; j++) { if (clone[j] === arrayB[i]) { erase(clone, j, 1); j--; ln--; } } } return clone; }
javascript
{ "resource": "" }
q61458
validation
function (array, begin, end) { // After tested for IE 6, the one below is of the best performance // see http://jsperf.com/slice-fix if (typeof begin === 'undefined') { return slice.call(array); } if (typeof end === 'undefined') { return slice.call(array, begin); } return slice.call(array, begin, end); }
javascript
{ "resource": "" }
q61459
validation
function(array) { var worker = []; function rFlatten(a) { var i, ln, v; for (i = 0, ln = a.length; i < ln; i++) { v = a[i]; if (Ext.isArray(v)) { rFlatten(v); } else { worker.push(v); } } return worker; } return rFlatten(array); }
javascript
{ "resource": "" }
q61460
validation
function(array, comparisonFn) { var min = array[0], i, ln, item; for (i = 0, ln = array.length; i < ln; i++) { item = array[i]; if (comparisonFn) { if (comparisonFn(min, item) === 1) { min = item; } } else { if (item < min) { min = item; } } } return min; }
javascript
{ "resource": "" }
q61461
validation
function(array) { var sum = 0, i, ln, item; for (i = 0,ln = array.length; i < ln; i++) { item = array[i]; sum += item; } return sum; }
javascript
{ "resource": "" }
q61462
validation
function(array) { var len = arguments.length, i = 1, newItem; if (array === undefined) { array = []; } else if (!Ext.isArray(array)) { array = [array]; } for (; i < len; i++) { newItem = arguments[i]; Array.prototype.push[Ext.isIterable(newItem) ? 'apply' : 'call'](array, newItem); } return array; }
javascript
{ "resource": "" }
q61463
validation
function (xpath) { var me = this, parts = xpath.split('/'), regex = me.tagPathRegEx, i, n, m, count, tag, child, el = me.attachTo.document; el = (parts[0] == '~') ? el.body : el.getElementById(parts[0].substring(1)); // remove '#' for (i = 1, n = parts.length; el && i < n; ++i) { m = regex.exec(parts[i]); count = m[2] ? parseInt(m[2], 10) : 1; tag = m[1].toUpperCase(); for (child = el.firstChild; child; child = child.nextSibling) { if (child.tagName == tag) { if (count == 1) { break; } --count; } } el = child; } return el; }
javascript
{ "resource": "" }
q61464
validation
function (eventDescriptor) { var me = this, index = ++me.queueIndex; // keyframe events are inserted after a keyFrameEvent is played. if (me.keyFrameEvents[eventDescriptor.type]) { Ext.Array.insert(me.eventQueue, index, [ { keyframe: true, ts: eventDescriptor.ts } ]); } }
javascript
{ "resource": "" }
q61465
validation
function (eventDescriptor) { var me = this; // only fire keyframe event (and setup the eventDescriptor) once... if (!eventDescriptor.defer) { me.makeToken(eventDescriptor, 'done'); me.fireEvent('keyframe', me, eventDescriptor); } return eventDescriptor.done; }
javascript
{ "resource": "" }
q61466
getNonEditableParent
validation
function getNonEditableParent(node) { var state; while (node) { state = getContentEditable(node); if (state) { return state === "false" ? node : null; } node = node.parentNode; } }
javascript
{ "resource": "" }
q61467
removeCaretContainer
validation
function removeCaretContainer(caretContainer) { var child, currentCaretContainer, lastContainer; if (caretContainer) { rng = selection.getRng(true); rng.setStartBefore(caretContainer); rng.setEndBefore(caretContainer); child = findFirstTextNode(caretContainer); if (child && child.nodeValue.charAt(0) == invisibleChar) { child = child.deleteData(0, 1); } dom.remove(caretContainer, true); selection.setRng(rng); } else { currentCaretContainer = getParentCaretContainer(selection.getStart()); while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) { if (currentCaretContainer !== caretContainer) { child = findFirstTextNode(caretContainer); if (child && child.nodeValue.charAt(0) == invisibleChar) { child = child.deleteData(0, 1); } dom.remove(caretContainer, true); } lastContainer = caretContainer; } } }
javascript
{ "resource": "" }
q61468
moveSelection
validation
function moveSelection() { var nonEditableStart, nonEditableEnd, isCollapsed, rng, element; // Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside function hasSideContent(element, left) { var container, offset, walker, node, len; container = rng.startContainer; offset = rng.startOffset; // If endpoint is in middle of text node then expand to beginning/end of element if (container.nodeType == 3) { len = container.nodeValue.length; if ((offset > 0 && offset < len) || (left ? offset == len : offset == 0)) { return; } } else { // Can we resolve the node by index if (offset < container.childNodes.length) { // Browser represents caret position as the offset at the start of an element. When moving right // this is the element we are moving into so we consider our container to be child node at offset-1 var pos = !left && offset > 0 ? offset-1 : offset; container = container.childNodes[pos]; if (container.hasChildNodes()) { container = container.firstChild; } } else { // If not then the caret is at the last position in it's container and the caret container should be inserted after the noneditable element return !left ? element : null; } } // Walk left/right to look for contents walker = new TreeWalker(container, element); while (node = walker[left ? 'prev' : 'next']()) { if (node.nodeType === 3 && node.nodeValue.length > 0) { return; } else if (getContentEditable(node) === "true") { // Found contentEditable=true element return this one to we can move the caret inside it return node; } } return element; }; // Remove any existing caret containers removeCaretContainer(); // Get noneditable start/end elements isCollapsed = selection.isCollapsed(); nonEditableStart = getNonEditableParent(selection.getStart()); nonEditableEnd = getNonEditableParent(selection.getEnd()); // Is any fo the range endpoints noneditable if (nonEditableStart || nonEditableEnd) { rng = selection.getRng(true); // If it's a caret selection then look left/right to see if we need to move the caret out side or expand if (isCollapsed) { nonEditableStart = nonEditableStart || nonEditableEnd; var start = selection.getStart(); if (element = hasSideContent(nonEditableStart, true)) { // We have no contents to the left of the caret then insert a caret container before the noneditable element insertCaretContainerOrExpandToBlock(element, true); } else if (element = hasSideContent(nonEditableStart, false)) { // We have no contents to the right of the caret then insert a caret container after the noneditable element insertCaretContainerOrExpandToBlock(element, false); } else { // We are in the middle of a noneditable so expand to select it selection.select(nonEditableStart); } } else { rng = selection.getRng(true); // Expand selection to include start non editable element if (nonEditableStart) { rng.setStartBefore(nonEditableStart); } // Expand selection to include end non editable element if (nonEditableEnd) { rng.setEndAfter(nonEditableEnd); } selection.setRng(rng); } } }
javascript
{ "resource": "" }
q61469
convertRegExpsToNonEditable
validation
function convertRegExpsToNonEditable(ed, args) { var i = nonEditableRegExps.length, content = args.content, cls = tinymce.trim(nonEditClass); // Don't replace the variables when raw is used for example on undo/redo if (args.format == "raw") { return; } while (i--) { content = content.replace(nonEditableRegExps[i], function(match) { var args = arguments, index = args[args.length - 2]; // Is value inside an attribute then don't replace if (index > 0 && content.charAt(index - 1) == '"') { return match; } return '<span class="' + cls + '" data-mce-content="' + ed.dom.encode(args[0]) + '">' + ed.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>'; }); } args.content = content; }
javascript
{ "resource": "" }
q61470
setupLogger
validation
function setupLogger(name, cfg) { assume(name).is.a('string'); if (cfg) { assume(cfg).is.an('object'); assume(cfg).not.includes('name'); } else { cfg = {}; } cfg.name = name; // Sometimes, just make it easy to have everything show the file and line // number. This is supposed to be quite slow, so the name is what it is to // make it impossible to claim you didn't know it made things slow if (process.env.FORCE_LOG_LINE_NUMBERS_AND_BE_SLOW === '1') { cfg.src = true; } // We want to be able to override whatever the library or application has // specified by changing only an evironment variable. let envLevel = parseEnvironment(process.env.LOG_LEVEL, cfg); let oldLevel = cfg.level; cfg.level = envLevel; cfg.serializers = { err: bunyan.stdSerializers.err, }; let logger = bunyan.createLogger(cfg); // But let's make it clear that we did this by logging if (oldLevel) { if (oldLevel !== envLevel) { logger.warn({ requested: oldLevel, used: envLevel, }, 'using log level from environment instead of code'); } } assume(logger).does.not.include('debugCompat'); logger.debugCompat = makeCompat(logger); return logger; }
javascript
{ "resource": "" }
q61471
makeCompat
validation
function makeCompat(logger) { return function(name) { return function(...x) { assume(x).is.an('array'); assume(x.length).greaterThan(0); let msg = util.format.apply(null, x); let level = 'warn'; let msgObj = { dbgname: name, dbgcmpt: true, }; if (msg.match(/\[alert-operator\]/)) { level = 'fatal'; msgObj.alert = true; } logger[level].call(logger, msgObj, msg); }; }; }
javascript
{ "resource": "" }
q61472
validation
function(height) { var me = this, isNum = (typeof height == "number"); if (isNum && me.autoBoxAdjust && !me.isBorderBox()) { height -= (me.getBorderWidth("tb") + me.getPadding("tb")); } return (isNum && height < 0) ? 0 : height; }
javascript
{ "resource": "" }
q61473
validation
function(opacity, animate) { var me = this; if (!me.dom) { return me; } if (!animate || !me.anim) { me.setStyle('opacity', opacity); } else { if (typeof animate != 'object') { animate = { duration: 350, easing: 'ease-in' }; } me.animate(Ext.applyIf({ to: { opacity: opacity } }, animate)); } return me; }
javascript
{ "resource": "" }
q61474
validation
function(className, testFn, scope) { var me = this, dom = me.dom, hasTest = Ext.isFunction(testFn); me.hover( function() { if (hasTest && testFn.call(scope || me, me) === false) { return; } Ext.fly(dom, INTERNAL).addCls(className); }, function() { Ext.fly(dom, INTERNAL).removeCls(className); } ); return me; }
javascript
{ "resource": "" }
q61475
init
validation
function init(type) { // {{{2 O.ui.updateHistory(); O.inherited(this)('html5-dialog' + (type ? '-' + type : '')); this.appendTo(document.body); O.ui.newHistory(); this.lastHistory = O.ui.lastHistory; this.hook(); this.type = type; if (! O.ui.dialogs) { O.ui.dialogs = []; } O.ui.dialogs.push(this); this.on('removed', removed.bind(this)); this.on('closed', closed.bind(this)); }
javascript
{ "resource": "" }
q61476
validation
function(e, target) { var me = this, item, record; if (Ext.fly(target).hasCls(me.labelSelector) && !me.editing && !e.ctrlKey && !e.shiftKey) { e.stopEvent(); item = me.view.findItemByChild(target); record = me.view.store.getAt(me.view.indexOf(item)); me.startEdit(target, record.data[me.dataIndex]); me.activeRecord = record; } else if (me.editing) { me.field.blur(); e.preventDefault(); } }
javascript
{ "resource": "" }
q61477
validation
function(dir) { var cmd = path.normalize(config.bin); if (config.jdependChart !== undefined) { cmd += ' --jdepend-chart=' + config.jdependChart; } if (config.jdependXml !== undefined) { cmd += ' --jdepend-xml=' + config.jdependXml; } if (config.overviewPyramid !== undefined) { cmd += ' --overview-pyramid=' + config.overviewPyramid; } if (config.summaryXml !== undefined) { cmd += ' --summary-xml=' + config.summaryXml; } if (config.coderankMode !== undefined) { cmd += ' --coderank-mode=' + config.coderankMode; } if (config.coverageReport !== undefined) { cmd += ' --coverage-report=' + config.coverageReport; } if (config.configuration !== undefined) { cmd += ' --configuration=' + config.configuration; } if (config.ignoreDirectories !== undefined) { cmd += ' --ignore=' + config.ignoreDirectories; } if (config.debug) { cmd += ' --debug '; } return cmd; }
javascript
{ "resource": "" }
q61478
canonicalMd5
validation
function canonicalMd5(md5) { if (md5) { if (Buffer.isBuffer(md5)) md5 = md5.toString('base64') else if (md5 && md5.match(/^md5-/)) md5 = md5.replace(/^md5-/, '') if (md5.length === 32) md5 = new Buffer(md5, 'hex').toString('base64') } return md5 }
javascript
{ "resource": "" }
q61479
validation
function() { var me = this; if (me.fireEvent('beforedestroy', me) !== false) { me.remove(); me.surface.onDestroy(me); me.clearListeners(); me.fireEvent('destroy'); } }
javascript
{ "resource": "" }
q61480
validation
function (options) { this.astStack = new ASTStack(); this.tags = options.customTags; this.raw = ''; this.disableParseTag = false; this.line = 1; this.lineStart = 0; this.position = 0; this.parseTagStack = []; this.forItems = []; this.tablerowItems = []; this.forItems.test = this.tablerowItems.test = function (name) { var name = name.split('.')[0]; return this.indexOf(name) === -1 ? false : true; }; }
javascript
{ "resource": "" }
q61481
join_plugins
validation
function join_plugins(plugins) { debug.assert(plugins).is('array'); debug.assert( ARRAY(plugins).every(is.func) ).equals(true); return function join_plugins_(req, res, next) { var queue = [].concat(plugins); function do_iteration_() { if(queue.length === 0) { next(); return; } var plugin = queue.shift(); debug.assert(plugin).is('function'); plugin(req, res, function plugin_wrapper(err) { if(err) { next(err); return; } do_iteration_(); }); } function do_iteration() { try { do_iteration_(); } catch(err) { next(err); return; } } do_iteration(); }; }
javascript
{ "resource": "" }
q61482
setup_member
validation
function setup_member(context, k) { var handler; var routes = context.routes; var opts = context.opts; var middleware = context.middleware; var app = context.app; var target = context.target; var loop_counter = context.loop_counter; var v = routes[k]; var v_is_function = is.func(v) ? true : false; // Special methods if(_special_methods.indexOf(k) >= 0) { handler = v_is_function ? v : FUNCTION(do_send).curry(opts, v); if(middleware.length === 0) { app[_express_methods[k]](target, build_request(opts, handler) ); } else if(k === 'USE') { //debug.log('target = ', target); //debug.log('k = ', k); //debug.log('_express_methods[', k,'] = ', _express_methods[k]); app[_express_methods[k]](target, join_plugins( [fix_for_missing_req_route(target, 'use')].concat(middleware).concat([build_request(opts, handler)]) ) ); } else { app[_express_methods[k]](target, fix_for_missing_req_route(target, (''+k).toLowerCase() ), middleware, build_request(opts, handler)); } return; } // Functions if(process.env.DEBUG_NOR_EXPRESS) { debug.log( /*(req.id ? '['+req.id+'] ' : '') + */ 'target = ', target); debug.log( /*(req.id ? '['+req.id+'] ' : '') + */ 'k = ', k); } var new_target = (target==='/') ? ('/' + k) : (target + '/' + k); var new_route = ROUTES.parse(v); ROUTES.setup(app, new_route, new_target, merge(opts, {'loop_counter': loop_counter+1})); }
javascript
{ "resource": "" }
q61483
accept_multi
validation
function accept_multi(filename, state) { state = state || {}; debug.assert(filename).is('string'); debug.assert(state).is('object'); if(state.directory) { return accept_dir(filename, state); } if(state.file) { return accept_file(filename, state); } return; }
javascript
{ "resource": "" }
q61484
makeDefine
validation
function makeDefine(mapping, id) { var require = function(id) { return mapping[id]; }; var exports = mapping[id] = {}; var module = null; // Unused arg. Included for completeness. return function(factory) { factory(require, exports, module); }; }
javascript
{ "resource": "" }
q61485
validation
function(root, action) { var parts, ns, i, l; root = root || Ext.global; parts = action.toString().split('.'); for (i = 0, l = parts.length; i < l; i++) { ns = parts[i]; root = root[ns]; if (typeof root === 'undefined') { return root; } } return root; }
javascript
{ "resource": "" }
q61486
validation
function() { var me = this, actions = me.actions, namespace = me.namespace, action, cls, methods, i, len, method; for (action in actions) { if (actions.hasOwnProperty(action)) { if (me.disableNestedActions) { cls = namespace[action]; if (!cls) { cls = namespace[action] = {}; } } else { cls = me.getNamespace(namespace, action); if (!cls) { cls = me.createNamespaces(namespace, action); } } methods = actions[action]; for (i = 0, len = methods.length; i < len; ++i) { method = new Ext.direct.RemotingMethod(methods[i]); cls[method.name] = me.createHandler(action, method); } } } }
javascript
{ "resource": "" }
q61487
validation
function(action, method) { var me = this, slice = Array.prototype.slice, handler; if (!method.formHandler) { handler = function() { me.configureRequest(action, method, slice.call(arguments, 0)); }; } else { handler = function(form, callback, scope) { me.configureFormRequest(action, method, form, callback, scope); }; } handler.directCfg = { action: action, method: method }; return handler; }
javascript
{ "resource": "" }
q61488
validation
function(transaction, event) { var success = !!event.status, funcName = success ? 'success' : 'failure', callback, options, result; if (transaction && transaction.callback) { callback = transaction.callback; options = transaction.callbackOptions; result = typeof event.result !== 'undefined' ? event.result : event.data; if (Ext.isFunction(callback)) { callback(result, event, success, options); } else { Ext.callback(callback[funcName], callback.scope, [result, event, success, options]); Ext.callback(callback.callback, callback.scope, [result, event, success, options]); } } }
javascript
{ "resource": "" }
q61489
validation
function(options, success, response) { var me = this, i, len, events, event, transaction, transactions; if (success) { events = me.createEvents(response); for (i = 0, len = events.length; i < len; ++i) { event = events[i]; transaction = me.getTransaction(event); me.fireEvent('data', me, event); if (transaction && me.fireEvent('beforecallback', me, event, transaction) !== false) { me.runCallback(transaction, event, true); Ext.direct.Manager.removeTransaction(transaction); } } } else { transactions = [].concat(options.transaction); for (i = 0, len = transactions.length; i < len; ++i) { transaction = me.getTransaction(transactions[i]); if (transaction && transaction.retryCount < me.maxRetries) { transaction.retry(); } else { event = new Ext.direct.ExceptionEvent({ data: null, transaction: transaction, code: Ext.direct.Manager.exceptions.TRANSPORT, message: 'Unable to connect to the server.', xhr: response }); me.fireEvent('data', me, event); if (transaction && me.fireEvent('beforecallback', me, transaction) !== false) { me.runCallback(transaction, event, false); Ext.direct.Manager.removeTransaction(transaction); } } } } }
javascript
{ "resource": "" }
q61490
validation
function(options) { return options && options.tid ? Ext.direct.Manager.getTransaction(options.tid) : null; }
javascript
{ "resource": "" }
q61491
validation
function(action, method, args) { var me = this, callData, data, callback, scope, opts, transaction, params; callData = method.getCallData(args); data = callData.data; callback = callData.callback; scope = callData.scope; opts = callData.options || {}; params = Ext.apply({}, { provider: me, args: args, action: action, method: method.name, data: data, callbackOptions: opts, callback: scope && Ext.isFunction(callback) ? Ext.Function.bind(callback, scope) : callback }); if (opts.timeout) { Ext.applyIf(params, { timeout: opts.timeout }); }; transaction = new Ext.direct.Transaction(params); if (me.fireEvent('beforecall', me, transaction, method) !== false) { Ext.direct.Manager.addTransaction(transaction); me.queueTransaction(transaction); me.fireEvent('call', me, transaction, method); } }
javascript
{ "resource": "" }
q61492
validation
function(transaction) { return { action: transaction.action, method: transaction.method, data: transaction.data, type: 'rpc', tid: transaction.id }; }
javascript
{ "resource": "" }
q61493
validation
function(transaction) { var me = this, enableBuffer = me.enableBuffer; if (transaction.form) { me.sendFormRequest(transaction); return; } if (typeof transaction.timeout !== 'undefined') { me.sendRequest(transaction); return; } if (enableBuffer) { me.callBuffer.push(transaction); if (!me.callTask) { me.callTask = new Ext.util.DelayedTask(me.combineAndSend, me); } me.callTask.delay(Ext.isNumber(enableBuffer) ? enableBuffer : 10); } else { me.combineAndSend(); } }
javascript
{ "resource": "" }
q61494
validation
function() { var me = this, buffer = me.callBuffer, len = buffer.length; if (len > 0) { me.sendRequest(len == 1 ? buffer[0] : buffer); me.callBuffer = []; } }
javascript
{ "resource": "" }
q61495
createLookupTable
validation
function createLookupTable(option, default_value, extend) { var value = settings[option]; if (!value) { // Get cached default map or make it if needed value = mapCache[option]; if (!value) { value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' ')); value = tinymce.extend(value, extend); mapCache[option] = value; } } else { // Create custom map value = makeMap(value, ',', makeMap(value.toUpperCase(), ' ')); } return value; }
javascript
{ "resource": "" }
q61496
addCustomElements
validation
function addCustomElements(custom_elements) { var customElementRegExp = /^(~)?(.+)$/; if (custom_elements) { each(split(custom_elements), function(rule) { var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2]; children[name] = children[cloneName]; customElementsMap[name] = cloneName; // If it's not marked as inline then add it to valid block elements if (!inline) { blockElementsMap[name.toUpperCase()] = {}; blockElementsMap[name] = {}; } // Add elements clone if needed if (!elements[name]) { elements[name] = elements[cloneName]; } // Add custom elements at span/div positions each(children, function(element, child) { if (element[cloneName]) element[name] = element[cloneName]; }); }); } }
javascript
{ "resource": "" }
q61497
validation
function(node) { var contentEditable; // Check type if (node.nodeType != 1) { return null; } // Check for fake content editable contentEditable = node.getAttribute("data-mce-contenteditable"); if (contentEditable && contentEditable !== "inherit") { return contentEditable; } // Check for real content editable return node.contentEditable !== "inherit" ? node.contentEditable : null; }
javascript
{ "resource": "" }
q61498
done
validation
function done() { dom.remove(id); if (elm) elm.onreadystatechange = elm.onload = elm = null; callback(); }
javascript
{ "resource": "" }
q61499
eventHandler
validation
function eventHandler(evt, args) { var type = evt.type; // Don't fire events when it's removed if (self.removed) return; // Sends the native event out to a global dispatcher then to the specific event dispatcher if (self.onEvent.dispatch(self, evt, args) !== false) { self[nativeToDispatcherMap[evt.fakeType || evt.type]].dispatch(self, evt, args); } }
javascript
{ "resource": "" }