_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q30000
train
function() { // Awful Hack to work in IE6 and below (the checkbox doesn't fire the change event) // It seems IE 8 removed this behavior from IE7 so it only works with IE 7 ?? /*if( YAHOO.env.ua.ie && parseInt(YAHOO.env.ua.ie,10) != 7 ) { Event.addListener(this.el, "click", function() { this.fireUpdatedEvt(); }, this, true); }*/ if( YAHOO.env.ua.ie ) { Event.addListener(this.el, "click", function(e) { YAHOO.lang.later(10,this,function(){this.onChange(e);}); }, this, true); } else { Event.addListener(this.el, "change", this.onChange, this, true); } Event.addFocusListener(this.el, this.onFocus, this, true); Event.addBlurListener(this.el, this.onBlur, this, true); }
javascript
{ "resource": "" }
q30001
train
function(value, sendUpdatedEvt) { if (value===this.checkedValue || (typeof(value) == 'string' && typeof(this.checkedValue) == 'boolean' && value === String(this.checkedValue))) { this.hiddenEl.value = this.checkedValue; // check checkbox (all browsers) this.el.checked = true; // hacks for IE6, because input is not operational at init, // so "this.el.checked = true" would work for default values ! // (but still work for later setValue calls) if (YAHOO.env.ua.ie === 6) { this.el.setAttribute("defaultChecked","checked"); // for IE6 } } else { // DEBUG : /*if (value!==this.uncheckedValue && lang.isObject(console) && lang.isFunction(console.log) ) { console.log("inputEx.CheckBox: value is *"+value+"*, schould be in ["+this.checkedValue+","+this.uncheckedValue+"]"); }*/ this.hiddenEl.value = this.uncheckedValue; // uncheck checkbox (all browsers) this.el.checked = false; // hacks for IE6, because input is not operational at init, // so "this.el.checked = false" would work for default values ! // (but still work for later setValue calls) if (YAHOO.env.ua.ie === 6) { this.el.removeAttribute("defaultChecked"); // for IE6 } } // Call Field.setValue to set class and fire updated event inputEx.CheckBox.superclass.setValue.call(this,value, sendUpdatedEvt); }
javascript
{ "resource": "" }
q30002
train
function(text) { var sel, startPos, endPos; //IE support if (document.selection) { this.el.focus(); sel = document.selection.createRange(); sel.text = text; } //Mozilla/Firefox/Netscape 7+ support else if (this.el.selectionStart || this.el.selectionStart == '0') { startPos = this.el.selectionStart; endPos = this.el.selectionEnd; this.el.value = this.el.value.substring(0, startPos)+ text+ this.el.value.substring(endPos, this.el.value.length); } else { this.el.value += text; } }
javascript
{ "resource": "" }
q30003
train
function() { this.editorContainer = inputEx.cn('div', {className: CSS_PREFIX+'editor'}, {display: 'none'}); // Render the editor field this.editorField = inputEx(this.options.editorField,this); var editorFieldEl = this.editorField.getEl(); this.editorContainer.appendChild( editorFieldEl ); Dom.addClass( editorFieldEl , CSS_PREFIX+'editorDiv'); this.okButton = new inputEx.widget.Button({ type: this.options.buttonTypes.ok, parentEl: this.editorContainer, value: inputEx.messages.okEditor, className: "inputEx-Button "+CSS_PREFIX+'OkButton', onClick: {fn: this.onOkEditor, scope:this} }); this.cancelLink = new inputEx.widget.Button({ type: this.options.buttonTypes.cancel, parentEl: this.editorContainer, value: inputEx.messages.cancelEditor, className: "inputEx-Button "+CSS_PREFIX+'CancelLink', onClick: {fn: this.onCancelEditor, scope:this} }); // Line breaker () this.editorContainer.appendChild( inputEx.cn('div',null, {clear: 'both'}) ); this.fieldContainer.appendChild(this.editorContainer); }
javascript
{ "resource": "" }
q30004
train
function(e) { if(this.colorAnim) { this.colorAnim.stop(true); } inputEx.sn(this.formattedContainer, null, {backgroundColor: this.options.animColors.from }); }
javascript
{ "resource": "" }
q30005
train
function(e) { // Start animation if(this.colorAnim) { this.colorAnim.stop(true); } this.colorAnim = new YAHOO.util.ColorAnim(this.formattedContainer, {backgroundColor: this.options.animColors}, 1); this.colorAnim.onComplete.subscribe(function() { Dom.setStyle(this.formattedContainer, 'background-color', ''); }, this, true); this.colorAnim.animate(); }
javascript
{ "resource": "" }
q30006
train
function() { this.formattedContainer = inputEx.cn('div', {className: 'inputEx-InPlaceEdit-visu'}); if( lang.isFunction(this.options.formatDom) ) { this.formattedContainer.appendChild( this.options.formatDom(this.options.value) ); } else if( lang.isFunction(this.options.formatValue) ) { this.formattedContainer.innerHTML = this.options.formatValue(this.options.value); } else { this.formattedContainer.innerHTML = lang.isUndefined(this.options.value) ? inputEx.messages.emptyInPlaceEdit: this.options.value; } this.fieldContainer.appendChild(this.formattedContainer); }
javascript
{ "resource": "" }
q30007
train
function() { Event.addListener(this.formattedContainer, "click", this.openEditor, this, true); // For color animation (if specified) if (this.options.animColors) { Event.addListener(this.formattedContainer, 'mouseover', this.onVisuMouseOver, this, true); Event.addListener(this.formattedContainer, 'mouseout', this.onVisuMouseOut, this, true); } if(this.editorField.el) { // Register some listeners Event.addListener(this.editorField.el, "keyup", this.onKeyUp, this, true); Event.addListener(this.editorField.el, "keydown", this.onKeyDown, this, true); } }
javascript
{ "resource": "" }
q30008
train
function() { var value = this.getValue(); this.editorContainer.style.display = ''; this.formattedContainer.style.display = 'none'; if(!lang.isUndefined(value)) { this.editorField.setValue(value); } // Set focus in the element ! this.editorField.focus(); // Select the content if(this.editorField.el && lang.isFunction(this.editorField.el.setSelectionRange) && (!!value && !!value.length)) { this.editorField.el.setSelectionRange(0,value.length); } }
javascript
{ "resource": "" }
q30009
train
function(value, sendUpdatedEvt) { // Store the value this.value = value; if(lang.isUndefined(value) || value == "") { inputEx.renderVisu(this.options.visu, inputEx.messages.emptyInPlaceEdit, this.formattedContainer); } else { inputEx.renderVisu(this.options.visu, this.value, this.formattedContainer); } // If the editor is opened, update it if(this.editorContainer.style.display == '') { this.editorField.setValue(value); } inputEx.InPlaceEdit.superclass.setValue.call(this, value, sendUpdatedEvt); }
javascript
{ "resource": "" }
q30010
train
function() { try { // Save the previous value: var previousVal = null; // Close a previously created group if(this.group) { previousVal = this.group.getValue(); this.group.close(); this.group.destroy(); this.groupOptionsWrapper.innerHTML = ""; } // Get value is directly the class !! var classO = inputEx.getFieldClass(this.typeSelect.getValue()); // Instanciate the group var groupParams = {fields: classO.groupOptions, parentEl: this.groupOptionsWrapper}; this.group = new inputEx.Group(groupParams); // Set the previous name/label if(previousVal) { this.group.setValue({ name: previousVal.name, label: previousVal.label }); } // Register the updated event this.group.updatedEvt.subscribe(this.onChangeGroupOptions, this, true); // Create the value field this.updateFieldValue(); } catch(ex) { if(YAHOO.lang.isObject(window["console"]) && YAHOO.lang.isFunction(window["console"]["log"]) ) { console.log("inputEx.TypeField.rebuildGroupOptions: ", ex); } } }
javascript
{ "resource": "" }
q30011
train
function() { if (this.propertyPanel.style.display == 'none') { this.propertyPanel.style.display = ''; Dom.addClass(this.button, "opened"); } else { this.propertyPanel.style.display = 'none'; Dom.removeClass(this.button, "opened"); } }
javascript
{ "resource": "" }
q30012
train
function() { try { // Close previous field if(this.fieldValue) { this.fieldValue.close(); this.fieldValue.destroy(); delete this.fieldValue; this.fieldValueWrapper.innerHTML = ''; } // Re-build the fieldValue var fieldOptions = this.group.getValue(); fieldOptions.type = this.getValue().type; fieldOptions.parentEl = this.fieldValueWrapper; this.fieldValue = inputEx(fieldOptions,this); // Refire the event when the fieldValue is updated this.fieldValue.updatedEvt.subscribe(this.fireUpdatedEvt, this, true); } catch(ex) { console.log("Error while updateFieldValue", ex.message); } }
javascript
{ "resource": "" }
q30013
train
function(value, sendUpdatedEvt) { // Set type in property panel this.typeSelect.setValue(value.type, false); // Rebuild the panel propertues this.rebuildGroupOptions(); // Set the parameters value // Retro-compatibility with deprecated inputParams Object if (lang.isObject(value.inputParams)) { this.group.setValue(value.inputParams, false); // New prefered way to describe a field } else { this.group.setValue(value, false); } // Rebuild the fieldValue this.updateFieldValue(); // Set field value : TODO -> fix it for default value (because updateFieldValue is called after first setValue) // Retro-compatibility with deprecated inputParams Object if(lang.isObject(value.inputParams) && !lang.isUndefined(value.inputParams.value)) { this.fieldValue.setValue(value.inputParams.value); // New prefered way to describe a field } else if (!lang.isUndefined(value.value)) { this.fieldValue.setValue(value.value); } if(sendUpdatedEvt !== false) { // fire update event this.fireUpdatedEvt(); } }
javascript
{ "resource": "" }
q30014
train
function() { var getDefaultValueForField = function (classObj, paramName) { var i, length = classObj.groupOptions.length, f; for(i = 0 ; i < length ; i++) { f = classObj.groupOptions[i]; // Retro-compatibility with deprecated inputParams Object if(lang.isObject(f.inputParams) && f.inputParams.name == paramName) { return f.inputParams.value; // New prefered way to use field options } else if (f.name == paramName) { return f.value; } } return undefined; }; // The field parameters var fieldParams = this.group.getValue(); var classObj = inputEx.getFieldClass(this.typeSelect.getValue()); // + default values for(var key in fieldParams) { if( fieldParams.hasOwnProperty(key) ) { var value1 = getDefaultValueForField(classObj, key); var value2 = fieldParams[key]; if(value1 == value2) { fieldParams[key] = undefined; } } } // The field type fieldParams.type = this.typeSelect.getValue(); // The value defined by the fieldValue if(this.fieldValue) fieldParams.value = this.fieldValue.getValue(); return fieldParams; }
javascript
{ "resource": "" }
q30015
train
function() { // Render the help panel this.renderHelpPanel(); /** * @property layout * @type {YAHOO.widget.Layout} */ this.layout = new widget.Layout(this.el, this.options.layoutOptions); this.layout.render(); // Right accordion this.renderPropertiesAccordion(); // Render buttons this.renderButtons(); // Saved status this.renderSavedStatus(); // Properties Form this.renderPropertiesForm(); }
javascript
{ "resource": "" }
q30016
train
function() { /** * @property helpPanel * @type {YAHOO.widget.Panel} */ this.helpPanel = new widget.Panel('helpPanel', { fixedcenter: true, draggable: true, visible: false, modal: true }); this.helpPanel.render(); }
javascript
{ "resource": "" }
q30017
train
function() { /** * @property alertPanel * @type {YAHOO.widget.Panel} */ this.alertPanel = new widget.Panel('WiringEditor-alertPanel', { fixedcenter: true, draggable: true, width: '500px', visible: false, modal: true }); this.alertPanel.setHeader("Message"); this.alertPanel.setBody("<div id='alertPanelBody'></div><button id='alertPanelButton'>Ok</button>"); this.alertPanel.render(document.body); Event.addListener('alertPanelButton','click', function() { this.alertPanel.hide(); }, this, true); }
javascript
{ "resource": "" }
q30018
train
function() { this.propertiesForm = new inputEx.Group({ parentEl: YAHOO.util.Dom.get('propertiesForm'), fields: this.options.propertiesFields }); this.propertiesForm.updatedEvt.subscribe(function() { this.markUnsaved(); }, this, true); }
javascript
{ "resource": "" }
q30019
train
function(e) { WireIt.ModuleProxy.superclass.startDrag.call(this,e); var del = this.getDragEl(), lel = this.getEl(); del.innerHTML = lel.innerHTML; del.className = lel.className; }
javascript
{ "resource": "" }
q30020
train
function(e, ddTargets) { // The layer is the only target : var layerTarget = ddTargets[0], layer = ddTargets[0]._layer, del = this.getDragEl(), pos = Dom.getXY(del), layerPos = Dom.getXY(layer.el); this._WiringEditor.addModule( this._module ,[pos[0]-layerPos[0]+layer.el.scrollLeft, pos[1]-layerPos[1]+layer.el.scrollTop]); }
javascript
{ "resource": "" }
q30021
train
function() { WireIt.WiringEditor.superclass.render.call(this); /** * @property layer * @type {WireIt.Layer} */ this.layer = new WireIt.Layer(this.options.layerOptions); this.layer.eventChanged.subscribe(this.onLayerChanged, this, true); // Left Accordion this.renderModulesAccordion(); // Render module list this.buildModulesList(); }
javascript
{ "resource": "" }
q30022
train
function() { // Create the modules accordion DOM if not found if(!Dom.get('modulesAccordionView')) { Dom.get('left').appendChild( WireIt.cn('ul', {id: 'modulesAccordionView'}) ); var li = WireIt.cn('li'); li.appendChild(WireIt.cn('h2',null,null,"Main")); var d = WireIt.cn('div'); d.appendChild( WireIt.cn('div', {id: "module-category-main"}) ); li.appendChild(d); Dom.get('modulesAccordionView').appendChild(li); } this.modulesAccordionView = new YAHOO.widget.AccordionView('modulesAccordionView', this.options.modulesAccordionViewParams); // Open all panels for(var l = 1, n = this.modulesAccordionView.getPanels().length; l < n ; l++) { this.modulesAccordionView.openPanel(l); } }
javascript
{ "resource": "" }
q30023
train
function() { var modules = this.modules; for(var i = 0 ; i < modules.length ; i++) { this.addModuleToList(modules[i]); } // Make the layer a drag drop target if(!this.ddTarget) { this.ddTarget = new YAHOO.util.DDTarget(this.layer.el, "module"); this.ddTarget._layer = this.layer; } }
javascript
{ "resource": "" }
q30024
train
function(module) { try { var div = WireIt.cn('div', {className: "WiringEditor-module"}); if(module.description) { div.title = module.description; } if(module.container.icon) { div.appendChild( WireIt.cn('img',{src: module.container.icon}) ); } div.appendChild( WireIt.cn('span', null, null, module.name) ); var ddProxy = new WireIt.ModuleProxy(div, this); ddProxy._module = module; // Get the category element in the accordion or create a new one var category = module.category || "main"; var el = Dom.get("module-category-"+category); if( !el ) { this.modulesAccordionView.addPanel({ label: category, content: "<div id='module-category-"+category+"'></div>" }); this.modulesAccordionView.openPanel(this.modulesAccordionView._panels.length-1); el = Dom.get("module-category-"+category); } el.appendChild(div); }catch(ex){ console.log(ex);} }
javascript
{ "resource": "" }
q30025
train
function(module, pos) { try { var containerConfig = module.container; containerConfig.position = pos; containerConfig.title = module.name; var temp = this; containerConfig.getGrouper = function() { return temp.getCurrentGrouper(temp); }; var container = this.layer.addContainer(containerConfig); // Adding the category CSS class name var category = module.category || "main"; Dom.addClass(container.el, "WiringEditor-module-category-"+category.replace(/ /g,'-')); // Adding the module CSS class name Dom.addClass(container.el, "WiringEditor-module-"+module.name.replace(/ /g,'-')); } catch(ex) { this.alert("Error Layer.addContainer: "+ ex.message); if(window.console && YAHOO.lang.isFunction(console.log)) { console.log(ex); } } }
javascript
{ "resource": "" }
q30026
train
function() { if(this.inputFilterTimeout) { clearTimeout(this.inputFilterTimeout); this.inputFilterTimeout = null; } var that = this; this.inputFilterTimeout = setTimeout(function() { that.updateLoadPanelList(Dom.get('loadFilter').value); }, 500); }
javascript
{ "resource": "" }
q30027
train
function() { var i; var obj = {modules: [], wires: [], properties: null}; for( i = 0 ; i < this.layer.containers.length ; i++) { obj.modules.push( {name: this.layer.containers[i].title, value: this.layer.containers[i].getValue(), config: this.layer.containers[i].getConfig()}); } for( i = 0 ; i < this.layer.wires.length ; i++) { var wire = this.layer.wires[i]; var wireObj = wire.getConfig(); wireObj.src = {moduleId: WireIt.indexOf(wire.terminal1.container, this.layer.containers), terminal: wire.terminal1.name }; wireObj.tgt = {moduleId: WireIt.indexOf(wire.terminal2.container, this.layer.containers), terminal: wire.terminal2.name }; obj.wires.push(wireObj); } obj.properties = this.propertiesForm.getValue(); return { name: obj.properties.name, working: obj }; }
javascript
{ "resource": "" }
q30028
train
function(group, deep, func, context) { if (!lang.isValue(context)) context = this; if (lang.isValue(group.groupContainer)) func.call(context, group.groupContainer); else { for (var cI in group.containers) func.call(context, group.containers[cI].container) if (deep) { for (var gI in group.groups) WireIt.GroupUtils.applyToContainers(group.groups[gI].group, deep, func, context); } } }
javascript
{ "resource": "" }
q30029
train
function(group, layer) { group.collapsing = true; if (lang.isValue(group.groupContainer)) layer.removeContainer(group.groupContainer); else { for (var i in group.containers) layer.removeContainer(group.containers[i]) for (var i in group.groups) WireIt.GroupUtils.removeGroupFromLayer(group.groups[i], layer); } group.collapsing = false; }
javascript
{ "resource": "" }
q30030
train
function(group, map) { if (!lang.isObject(map)) map = WireIt.GroupUtils.getMap(group); var fieldConfigs = []; var terminalConfigs = []; var generateExternal = function(ftMap) { for (var cI in ftMap) { var c = ftMap[cI]; for (var fName in c.fields) { var fMap = c.fields[fName]; if (fMap.visible) { var fc = {}; lang.augmentObject(fc, fMap.fieldConfig); fc.name = fMap.externalName; fc.label = fMap.externalName; lang.augmentObject(fc, fMap.fieldConfig) fieldConfigs.push(fc); } } for (var tName in c.terminals) { var tMap = c.terminals[tName]; if (tMap.visible) { var tc = {}; tc.name = tMap.externalName; tc.side = tMap.side; lang.augmentObject(tc, tMap.terminalConfig); terminalConfigs.push(tc) } } } } if (lang.isValue(map.groupContainerMap)) generateExternal([map.groupContainerMap]) else { generateExternal(map.containerMap); generateExternal(map.groupMap); } var center = this.workOutCenter(group); return { "fields" : fieldConfigs, "terminals" : terminalConfigs, "position" : center, "center" : center}; }
javascript
{ "resource": "" }
q30031
train
function(group) { var bounds = {}; var setBound = function(position) { var left, top; left = position[0]; top = position[1]; if ((typeof bounds["left"] == "undefined") || bounds["left"] > left) bounds["left"] = left; if ((typeof bounds["right"] == "undefined") || bounds["right"] < left) bounds["right"] = left; if ((typeof bounds["top"] == "undefined") || bounds["top"] > top) bounds["top"] = top; if ((typeof bounds["bottom"] == "undefined") || bounds["bottom"] < top) bounds["bottom"] = top; } if (lang.isObject(group.groupContainer)) { setBound(group.groupContainer.getConfig().position) } else { for (var cI in group.containers) { var c = group.containers[cI].container; var config = c.getConfig(); setBound(config.position); } for (var gI in group.groups) { var g = group.groups[gI].group; setBound(WireIt.GroupUtils.workOutCenter(g)); } } return [ ((bounds.right + bounds.left)/2), ((bounds.top + bounds.bottom)/2) ]; }
javascript
{ "resource": "" }
q30032
train
function(event) { var elem = this.grouper.layer.el; var rect = elem.getBoundingClientRect(); var xNoScroll = event.clientX-rect.left; var yNoScroll = event.clientY-rect.top; if (xNoScroll < elem.clientWidth && yNoScroll < elem.clientHeight) { this.start(); } }
javascript
{ "resource": "" }
q30033
train
function() { this.show(); this.SetCanvasRegion(0, 0, this.grouper.layer.el.scrollWidth, this.grouper.layer.el.scrollHeight); var ctxt = this.getContext(); ctxt.beginPath(); ctxt.moveTo(this.lastX, this.lastY); this.startX = this.lastX; this.startY = this.lastY; this.timer = YAHOO.lang.later(WireIt.RubberBand.defaultDelay, this, function() { this.nextPoint(this.lastX, this.lastY); this.scroll(this.directions); }, 0, true); }
javascript
{ "resource": "" }
q30034
train
function(directions) { var elem = this.grouper.layer.el; if (directions.left) elem.scrollLeft = Math.max(0, elem.scrollLeft-this.scrollAmount); else if (directions.right) elem.scrollLeft = Math.min(elem.scrollWidth, elem.scrollLeft+this.scrollAmount); if (directions.up) elem.scrollTop = Math.max(0, elem.scrollTop-this.scrollAmount); else if (directions.down) elem.scrollTop = Math.min(elem.scrollHeight, elem.scrollTop+this.scrollAmount); }
javascript
{ "resource": "" }
q30035
train
function() { if (lang.isObject(this.timer)) { this.timer.cancel(); this.timer = null; var ctxt = this.getContext(); this.nextPoint(this.startX, this.startY); YAHOO.lang.later(1000, this, this.hide, 0, false); } }
javascript
{ "resource": "" }
q30036
train
function(x, y) { if (lang.isValue(x) && lang.isValue(y)) { var ctxt = this.getContext(); // Draw the inner bezier curve ctxt.lineCap= "round"; ctxt.strokeStyle="green"; ctxt.lineWidth="3"; ctxt.lineTo(x, y); ctxt.stroke(); } }
javascript
{ "resource": "" }
q30037
parse
train
function parse(data, options, next) { data = this.get(data); if ('function' === typeof options) { next = options; options = {}; } // // We cannot detect a license so we call the callback without any arguments // which symbolises a failed attempt. // if (!data) return next(); // // Optimize the matches by trying to locate where the licensing information // starts in the given content. Usually, we, as developers add it at the // bottom of our README.md files and prefix it with "LICENSE" as header. // if (data.file && /readme/i.test(data.file)) { data.content.split('\n') .some(function some(line, index, lines) { if ( /^.{0,7}\s{0,}(?:licen[cs]e[s]?|copyright).{0,2}\s{0,}$/gim.test( line.trim()) ) { data.content = lines.slice(index).join('\n'); debug('matched %s as license header, slicing data', JSON.stringify(line)); return true; } return false; }); } var license = this.scan(data.content); if (!license) { license = this.test(data.content); if (license) debug('used regexp to detect %s in content', license); } else { debug('license file scan resulted in %s as matching license', license); } next(undefined, this.normalize(license)); }
javascript
{ "resource": "" }
q30038
get
train
function get(data) { if ('string' === typeof data) return { content: data }; if (data.readme) return { content: data.readme, file: 'readme' }; if (data.content) return data; }
javascript
{ "resource": "" }
q30039
xmlValue
train
function xmlValue(node) { if (!node) { return ''; } var ret = ''; if (node.nodeType == DOM_TEXT_NODE || node.nodeType == DOM_CDATA_SECTION_NODE) { ret += node.nodeValue; } else if (node.nodeType == DOM_ATTRIBUTE_NODE) { if (ajaxsltIsIE6) { ret += xmlValueIE6Hack(node); } else { ret += node.nodeValue; } } else if (node.nodeType == DOM_ELEMENT_NODE || node.nodeType == DOM_DOCUMENT_NODE || node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) { for (var i = 0; i < node.childNodes.length; ++i) { ret += arguments.callee(node.childNodes[i]); } } return ret; }
javascript
{ "resource": "" }
q30040
train
function(name, value) { //we must jsonify this because Flash Player versions below 9.0.60 don't handle //complex ExternalInterface parsing correctly value = YAHOO.lang.JSON.stringify(value); this._swf.setStyle(name, value); }
javascript
{ "resource": "" }
q30041
train
function(styles) { //we must jsonify this because Flash Player versions below 9.0.60 don't handle //complex ExternalInterface parsing correctly styles = YAHOO.lang.JSON.stringify(styles); this._swf.setStyles(styles); }
javascript
{ "resource": "" }
q30042
train
function(styles) { //we must jsonify this because Flash Player versions below 9.0.60 don't handle //complex ExternalInterface parsing correctly for(var i = 0; i < styles.length; i++) { styles[i] = YAHOO.lang.JSON.stringify(styles[i]); } this._swf.setSeriesStyles(styles); }
javascript
{ "resource": "" }
q30043
train
function(request, response, error) { if(this._swf) { if(error) { } else { var i; if(this._seriesFunctions) { var count = this._seriesFunctions.length; for(i = 0; i < count; i++) { YAHOO.widget.Chart.removeProxyFunction(this._seriesFunctions[i]); } this._seriesFunctions = null; } this._seriesFunctions = []; //make a copy of the series definitions so that we aren't //editing them directly. var dataProvider = []; var seriesCount = 0; var currentSeries = null; if(this._seriesDefs !== null) { seriesCount = this._seriesDefs.length; for(i = 0; i < seriesCount; i++) { currentSeries = this._seriesDefs[i]; var clonedSeries = {}; for(var prop in currentSeries) { if(YAHOO.lang.hasOwnProperty(currentSeries, prop)) { if(prop == "style") { if(currentSeries.style !== null) { clonedSeries.style = YAHOO.lang.JSON.stringify(currentSeries.style); } } else if(prop == "labelFunction") { if(currentSeries.labelFunction !== null) { clonedSeries.labelFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.labelFunction); this._seriesFunctions.push(clonedSeries.labelFunction); } } else if(prop == "dataTipFunction") { if(currentSeries.dataTipFunction !== null) { clonedSeries.dataTipFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.dataTipFunction); this._seriesFunctions.push(clonedSeries.dataTipFunction); } } else if(prop == "legendLabelFunction") { if(currentSeries.legendLabelFunction !== null) { clonedSeries.legendLabelFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.legendLabelFunction); this._seriesFunctions.push(clonedSeries.legendLabelFunction); } } else { clonedSeries[prop] = currentSeries[prop]; } } } dataProvider.push(clonedSeries); } } if(seriesCount > 0) { for(i = 0; i < seriesCount; i++) { currentSeries = dataProvider[i]; if(!currentSeries.type) { currentSeries.type = this._type; } currentSeries.dataProvider = response.results; } } else { var series = {type: this._type, dataProvider: response.results}; dataProvider.push(series); } try { if(this._swf.setDataProvider) this._swf.setDataProvider(dataProvider); } catch(e) { this._swf.setDataProvider(dataProvider); } } } }
javascript
{ "resource": "" }
q30044
train
function(value) { if(this._dataTipFunction) { YAHOO.widget.Chart.removeProxyFunction(this._dataTipFunction); } if(value) { this._dataTipFunction = value = YAHOO.widget.Chart.getFunctionReference(value); } this._swf.setDataTipFunction(value); }
javascript
{ "resource": "" }
q30045
train
function(value) { if(this._legendLabelFunction) { YAHOO.widget.Chart.removeProxyFunction(this._legendLabelFunction); } if(value) { this._legendLabelFunction = value = YAHOO.widget.Chart.getFunctionReference(value); } this._swf.setLegendLabelFunction(value); }
javascript
{ "resource": "" }
q30046
train
function(value) { var clonedAxis = {}; for(var prop in value) { if(prop == "labelFunction") { if(value.labelFunction && value.labelFunction !== null) { clonedAxis.labelFunction = YAHOO.widget.Chart.getFunctionReference(value.labelFunction); } } else { clonedAxis[prop] = value[prop]; } } return clonedAxis; }
javascript
{ "resource": "" }
q30047
train
function(axisFunctions) { if(axisFunctions && axisFunctions.length > 0) { var len = axisFunctions.length; for(var i = 0; i < len; i++) { if(axisFunctions[i] !== null) { YAHOO.widget.Chart.removeProxyFunction(axisFunctions[i]); } } axisFunctions = []; } }
javascript
{ "resource": "" }
q30048
train
function(value) { if(value.position != "bottom" && value.position != "top") value.position = "bottom"; this._removeAxisFunctions(this._xAxisLabelFunctions); value = this._getClonedAxis(value); this._xAxisLabelFunctions.push(value.labelFunction); this._swf.setHorizontalAxis(value); }
javascript
{ "resource": "" }
q30049
train
function(value) { this._removeAxisFunctions(this._xAxisLabelFunctions); var len = value.length; for(var i = 0; i < len; i++) { if(value[i].position == "left") value[i].position = "bottom"; value[i] = this._getClonedAxis(value[i]); if(value[i].labelFunction) this._xAxisLabelFunctions.push(value[i].labelFunction); this._swf.setHorizontalAxis(value[i]); } }
javascript
{ "resource": "" }
q30050
train
function(value) { this._removeAxisFunctions(this._yAxisLabelFunctions); value = this._getClonedAxis(value); this._yAxisLabelFunctions.push(value.labelFunction); this._swf.setVerticalAxis(value); }
javascript
{ "resource": "" }
q30051
train
function(value) { this._removeAxisFunctions(this._yAxisLabelFunctions); var len = value.length; for(var i = 0; i < len; i++) { value[i] = this._getClonedAxis(value[i]); if(value[i].labelFunction) this._yAxisLabelFunctions.push(value[i].labelFunction); this._swf.setVerticalAxis(value[i]); } }
javascript
{ "resource": "" }
q30052
train
function(index, style) { style = YAHOO.lang.JSON.stringify(style); if(this._swf && this._swf.setSeriesStylesByIndex) this._swf.setSeriesStylesByIndex(index, style); }
javascript
{ "resource": "" }
q30053
train
function (err, length, data) { if (err) { if (self.autoClose) { self.destroy() } self.emit('error', err) } self.push(data) // self.once('finish', self.close) }
javascript
{ "resource": "" }
q30054
train
function(oConfigs) { Prog.superclass.constructor.call(this, document.createElement('div') , oConfigs); this._init(oConfigs); }
javascript
{ "resource": "" }
q30055
train
function(parent,before) { if (this._rendered) { return; } this._rendered = true; var direction = this.get(DIRECTION); // If the developer set a className attribute on initialization, // Element would have wiped out my own classNames // So I need to insist on them, plus add the one for direction. this.addClass(CLASS_PROGBAR); this.addClass(CLASS_PROGBAR + '-' + direction); var container = this.get('element'); container.tabIndex = 0; container.setAttribute('role','progressbar'); container.setAttribute('aria-valuemin',this.get(MIN_VALUE)); container.setAttribute('aria-valuemax',this.get(MAX_VALUE)); this.appendTo(parent,before); // I need to use the non-animated bar resizing function for initial redraw this._barSizeFunction = this._barSizeFunctions[0][direction]; this.redraw(); this._previousValue = this.get(VALUE); this._fixEdges(); // I can now set the correct bar resizer if (this.get(ANIM)) { this._barSizeFunction = this._barSizeFunctions[1][direction]; } this.on('minValueChange',this.redraw); this.on('maxValueChange',this.redraw); return this; }
javascript
{ "resource": "" }
q30056
train
function() { this.set(ANIM,false); this.unsubscribeAll(); var el = this.get('element'); if (el.parentNode) { el.parentNode.removeChild(el); } }
javascript
{ "resource": "" }
q30057
train
function() { var barEl = this.get(BAR_EL); switch (this.get(DIRECTION)) { case DIRECTION_LTR: case DIRECTION_RTL: this._barSpace = parseInt(this.get(WIDTH),10) - (parseInt(Dom.getStyle(barEl,'marginLeft'),10) || 0) - (parseInt(Dom.getStyle(barEl,'marginRight'),10) || 0); break; case DIRECTION_TTB: case DIRECTION_BTT: this._barSpace = parseInt(this.get(HEIGHT),10) - (parseInt(Dom.getStyle(barEl,'marginTop'),10) || 0)- (parseInt(Dom.getStyle(barEl,'marginBottom'),10) || 0); break; } this._barFactor = this._barSpace / (this.get(MAX_VALUE) - (this.get(MIN_VALUE) || 0)) || 1; }
javascript
{ "resource": "" }
q30058
train
function(value) { var container = this.get('element'), text = Lang.substitute(this.get(ARIA_TEXT_TEMPLATE),{ value:value, minValue:this.get(MIN_VALUE), maxValue:this.get(MAX_VALUE) }); container.setAttribute('aria-valuenow',value); container.setAttribute('aria-valuetext',text); }
javascript
{ "resource": "" }
q30059
train
function (needle) { var path = null, keys = [], i = 0; if (needle) { // Strip the ["string keys"] and [1] array indexes needle = needle. replace(/\[(['"])(.*?)\1\]/g, function (x,$1,$2) {keys[i]=$2;return '.@'+(i++);}). replace(/\[(\d+)\]/g, function (x,$1) {keys[i]=parseInt($1,10)|0;return '.@'+(i++);}). replace(/^\./,''); // remove leading dot // If the cleaned needle contains invalid characters, the // path is invalid if (!/[^\w\.\$@]/.test(needle)) { path = needle.split('.'); for (i=path.length-1; i >= 0; --i) { if (path[i].charAt(0) === '@') { path[i] = keys[parseInt(path[i].substr(1),10)]; } } } else { } } return path; }
javascript
{ "resource": "" }
q30060
train
function(oRequest, oFullResponse) { var bError = false; var elTable = oFullResponse; var fields = this.responseSchema.fields; var oParsedResponse = {results:[]}; if(lang.isArray(fields)) { // Iterate through each TBODY for(var i=0; i<elTable.tBodies.length; i++) { var elTbody = elTable.tBodies[i]; // Iterate through each TR for(var j=elTbody.rows.length-1; j>-1; j--) { var elRow = elTbody.rows[j]; var oResult = {}; for(var k=fields.length-1; k>-1; k--) { var field = fields[k]; var key = (lang.isValue(field.key)) ? field.key : field; var data = elRow.cells[k].innerHTML; // Backward compatibility if(!field.parser && field.converter) { field.parser = field.converter; } var parser = (typeof field.parser === 'function') ? field.parser : DS.Parser[field.parser+'']; if(parser) { data = parser.call(this, data); } // Safety measure if(data === undefined) { data = null; } oResult[key] = data; } oParsedResponse.results[j] = oResult; } } } else { bError = true; } if(bError) { oParsedResponse.error = true; } else { } return oParsedResponse; }
javascript
{ "resource": "" }
q30061
train
function(oRequest, oCallback, oCaller) { var tId = DS._nTransactionId++; this.fireEvent("requestEvent", {tId:tId,request:oRequest,callback:oCallback,caller:oCaller}); // If there are no global pending requests, it is safe to purge global callback stack and global counter if(util.ScriptNodeDataSource._nPending === 0) { util.ScriptNodeDataSource.callbacks = []; util.ScriptNodeDataSource._nId = 0; } // ID for this request var id = util.ScriptNodeDataSource._nId; util.ScriptNodeDataSource._nId++; // Dynamically add handler function with a closure to the callback stack var oSelf = this; util.ScriptNodeDataSource.callbacks[id] = function(oRawResponse) { if((oSelf.asyncMode !== "ignoreStaleResponses")|| (id === util.ScriptNodeDataSource.callbacks.length-1)) { // Must ignore stale responses // Try to sniff data type if it has not been defined if(oSelf.responseType === DS.TYPE_UNKNOWN) { if(YAHOO.lang.isArray(oRawResponse)) { // array oSelf.responseType = DS.TYPE_JSARRAY; } // xml else if(oRawResponse.nodeType && oRawResponse.nodeType == 9) { oSelf.responseType = DS.TYPE_XML; } else if(oRawResponse.nodeName && (oRawResponse.nodeName.toLowerCase() == "table")) { // table oSelf.responseType = DS.TYPE_HTMLTABLE; } else if(YAHOO.lang.isObject(oRawResponse)) { // json oSelf.responseType = DS.TYPE_JSON; } else if(YAHOO.lang.isString(oRawResponse)) { // text oSelf.responseType = DS.TYPE_TEXT; } } oSelf.handleResponse(oRequest, oRawResponse, oCallback, oCaller, tId); } else { } delete util.ScriptNodeDataSource.callbacks[id]; }; // We are now creating a request util.ScriptNodeDataSource._nPending++; var sUri = this.liveData + oRequest + this.generateRequestCallback(id); sUri = this.doBeforeGetScriptNode(sUri); this.getUtility.script(sUri, {autopurge: true, onsuccess: util.ScriptNodeDataSource._bumpPendingDown, onfail: util.ScriptNodeDataSource._bumpPendingDown}); return tId; }
javascript
{ "resource": "" }
q30062
train
function() { // Div to display the invite, then the selected text this.el = inputEx.cn('div', {className:'inputEx-Result'}, null, this.options.typeInvite); YAHOO.util.Dom.addClass(this.el, (this.options.menuPosition[1] == "tr") ? "inputEx-RightArrow" : "inputEx-DownArrow"); this.fieldContainer.appendChild(this.el); // Keep selected value in a hidden field this.hiddenEl = inputEx.cn('input', {type: 'hidden', name: this.options.name || '', value: this.options.value || ''}); this.fieldContainer.appendChild(this.hiddenEl); // Init Menu this.initMenu(); }
javascript
{ "resource": "" }
q30063
train
function() { // Keep corresponding text for each value selectable in the menu // -> will be used to display selection after click this._textFromValue = {}; var that = this; /* * Recursive function to edit a level of menuItems * * args : * -> conf : an array of menuItems * -> level : how deeply nested are these menuItems (4 is max) */ var levelInit = function (conf,level) { if (level>4) throw new Error("MenuField : too much recursion, menuItems property should be 5 level deep at most."); var item; for (var i=0, length = conf.length; i < length; i++) { item = conf[i]; if (YAHOO.lang.isUndefined(item.text) && !YAHOO.lang.isUndefined(item.value)) { item.text = item.value; } if (YAHOO.lang.isUndefined(item.value) && !YAHOO.lang.isUndefined(item.text)) { item.value = item.text; } // item with submenu // -> explore deeper if (!YAHOO.lang.isUndefined(item.submenu)) { // ensure there is an id on submenu (else submenu is not created) if (YAHOO.lang.isUndefined(item.submenu.id)) { item.submenu.id = YAHOO.util.Dom.generateId(); } // continue one level deeper levelInit(item.submenu.itemdata,level+1); // item without submenu // -> add click listener to this item // -> pass selected value to the listener (as the 3rd argument) } else { that._textFromValue[item.value] = item.text; item.onclick = {fn:function() {that.onItemClick.apply(that,arguments);},obj:item.value}; } } }; levelInit(this.options.menuItems,0); }
javascript
{ "resource": "" }
q30064
train
function(fn, obj, overrideContext) { if (!fn) { throw new Error("Invalid callback for subscriber to '" + this.type + "'"); } if (this.subscribeEvent) { this.subscribeEvent.fire(fn, obj, overrideContext); } var s = new YAHOO.util.Subscriber(fn, obj, overrideContext); if (this.fireOnce && this.fired) { this.notify(s, this.firedWith); } else { this.subscribers.push(s); } }
javascript
{ "resource": "" }
q30065
train
function(fn, obj) { if (!fn) { return this.unsubscribeAll(); } var found = false; for (var i=0, len=this.subscribers.length; i<len; ++i) { var s = this.subscribers[i]; if (s && s.contains(fn, obj)) { this._delete(i); found = true; } } return found; }
javascript
{ "resource": "" }
q30066
train
function() { var l = this.subscribers.length, i; for (i=l-1; i>-1; i--) { this._delete(i); } this.subscribers=[]; return l; }
javascript
{ "resource": "" }
q30067
train
function(e) { return fn.call(context, YAHOO.util.Event.getEvent(e, el), obj); }
javascript
{ "resource": "" }
q30068
train
function (el, fn, obj, overrideContext) { return this.on(el, FOCUSOUT, fn, obj, overrideContext); }
javascript
{ "resource": "" }
q30069
train
function(ev) { var x = ev.pageX; if (!x && 0 !== x) { x = ev.clientX || 0; if ( this.isIE ) { x += this._getScrollLeft(); } } return x; }
javascript
{ "resource": "" }
q30070
train
function(ev) { var y = ev.pageY; if (!y && 0 !== y) { y = ev.clientY || 0; if ( this.isIE ) { y += this._getScrollTop(); } } return y; }
javascript
{ "resource": "" }
q30071
train
function(ev) { var t = ev.relatedTarget; if (!t) { if (ev.type == "mouseout") { t = ev.toElement; } else if (ev.type == "mouseover") { t = ev.fromElement; } } return this.resolveTextNode(t); }
javascript
{ "resource": "" }
q30072
train
function(ev) { if (!ev.time) { var t = new Date().getTime(); try { ev.time = t; } catch(ex) { this.lastError = ex; return t; } } return ev.time; }
javascript
{ "resource": "" }
q30073
train
function(ev) { var code = ev.keyCode || ev.charCode || 0; // webkit key normalization if (YAHOO.env.ua.webkit && (code in webkitKeymap)) { code = webkitKeymap[code]; } return code; }
javascript
{ "resource": "" }
q30074
train
function(e) { var EU = YAHOO.util.Event; if (!EU.DOMReady) { EU.DOMReady=true; // Fire the content ready custom event EU.DOMReadyEvent.fire(); // Remove the DOMContentLoaded (FF/Opera) EU._simpleRemove(document, "DOMContentLoaded", EU._ready); } }
javascript
{ "resource": "" }
q30075
train
function() { var dd = document.documentElement, db = document.body; if (dd && (dd.scrollTop || dd.scrollLeft)) { return [dd.scrollTop, dd.scrollLeft]; } else if (db) { return [db.scrollTop, db.scrollLeft]; } else { return [0, 0]; } }
javascript
{ "resource": "" }
q30076
train
function(p_type, p_fn, p_obj, overrideContext) { this.__yui_events = this.__yui_events || {}; var ce = this.__yui_events[p_type]; if (ce) { ce.subscribe(p_fn, p_obj, overrideContext); } else { this.__yui_subscribers = this.__yui_subscribers || {}; var subs = this.__yui_subscribers; if (!subs[p_type]) { subs[p_type] = []; } subs[p_type].push( { fn: p_fn, obj: p_obj, overrideContext: overrideContext } ); } }
javascript
{ "resource": "" }
q30077
train
function(p_type, p_fn, p_obj) { this.__yui_events = this.__yui_events || {}; var evts = this.__yui_events; if (p_type) { var ce = evts[p_type]; if (ce) { return ce.unsubscribe(p_fn, p_obj); } } else { var ret = true; for (var i in evts) { if (YAHOO.lang.hasOwnProperty(evts, i)) { ret = ret && evts[i].unsubscribe(p_fn, p_obj); } } return ret; } return false; }
javascript
{ "resource": "" }
q30078
handleKeyPress
train
function handleKeyPress(e, obj) { if (! keyData.shift) { keyData.shift = false; } if (! keyData.alt) { keyData.alt = false; } if (! keyData.ctrl) { keyData.ctrl = false; } // check held down modifying keys first if (e.shiftKey == keyData.shift && e.altKey == keyData.alt && e.ctrlKey == keyData.ctrl) { // if we pass this, all modifiers match var dataItem, keys = keyData.keys, key; if (YAHOO.lang.isArray(keys)) { for (var i=0;i<keys.length;i++) { dataItem = keys[i]; key = Event.getCharCode(e); if (dataItem == key) { keyEvent.fire(key, e); break; } } } else { key = Event.getCharCode(e); if (keys == key ) { keyEvent.fire(key, e); } } } }
javascript
{ "resource": "" }
q30079
train
function (pairCode, linkUrl, includeStyles) { /** @type {string} Pair code. */ this.pairCode = pairCode; /** @type {string} URL for 'Connect' button. */ this.linkUrl = linkUrl; /** @type {Element} Overlay element. */ this.el = document.createElement('div'); /** @type {Element} Overlay stylesheet. */ this.stylesheet = null; if (includeStyles) { this.stylesheet = document.createElement('style'); this.appendStyles(); } this.render(); }
javascript
{ "resource": "" }
q30080
train
function(codeText) { this.textarea = WireIt.cn('textarea', null, {width: "90%", height: "70px", border: "0", padding: "5px"}, codeText); this.setBody(this.textarea); YAHOO.util.Event.addListener(this.textarea, 'change', this.createTerminals, this, true); }
javascript
{ "resource": "" }
q30081
train
function() { var width = WireIt.getIntStyle(this.el, "width"); var inputsIntervall = Math.floor(width/(this.nParams+1)); for(var i = 1 ; i < this.terminals.length ; i++) { var term = this.terminals[i]; YAHOO.util.Dom.setStyle(term.el, "left", (inputsIntervall*(i))-15+"px" ); for(var j = 0 ; j < term.wires.length ; j++) { term.wires[j].redraw(); } } // Output terminal WireIt.sn(this.outputTerminal.el, null, {position: "absolute", bottom: "-15px", left: (Math.floor(width/2)-15)+"px"}); for(var j = 0 ; j < this.outputTerminal.wires.length ; j++) { this.outputTerminal.wires[j].redraw(); } }
javascript
{ "resource": "" }
q30082
train
function() { var obj = jsBox.Container.superclass.getConfig.call(this); obj.codeText = this.textarea.value; return obj; }
javascript
{ "resource": "" }
q30083
train
function () { // Grab the first callback in the queue var c = this.q[0], fn; // If there is no callback in the queue or the Chain is currently // in an execution mode, return if (!c) { this.fireEvent('end'); return this; } else if (this.id) { return this; } fn = c.method || c; if (typeof fn === 'function') { var o = c.scope || {}, args = c.argument || [], ms = c.timeout || 0, me = this; if (!(args instanceof Array)) { args = [args]; } // Execute immediately if the callback timeout is negative. if (ms < 0) { this.id = ms; if (c.until) { for (;!c.until();) { // Execute the callback from scope, with argument fn.apply(o,args); } } else if (c.iterations) { for (;c.iterations-- > 0;) { fn.apply(o,args); } } else { fn.apply(o,args); } this.q.shift(); this.id = 0; return this.run(); } else { // If the until condition is set, check if we're done if (c.until) { if (c.until()) { // Shift this callback from the queue and execute the next // callback this.q.shift(); return this.run(); } // Otherwise if either iterations is not set or we're // executing the last iteration, shift callback from the queue } else if (!c.iterations || !--c.iterations) { this.q.shift(); } // Otherwise set to execute after the configured timeout this.id = setTimeout(function () { // Execute the callback from scope, with argument fn.apply(o,args); // Check if the Chain was not paused from inside the callback if (me.id) { // Indicate ready to run state me.id = 0; // Start the fun all over again me.run(); } },ms); } } return this; }
javascript
{ "resource": "" }
q30084
train
function(tree) { var maxRowDepth = 1; var currentRow; var currentColumn; // Calculate the max depth of descendants for this row var countMaxRowDepth = function(row, tmpRowDepth) { tmpRowDepth = tmpRowDepth || 1; for(var n=0; n<row.length; n++) { var col = row[n]; // Column has children, so keep counting if(YAHOO.lang.isArray(col.children)) { tmpRowDepth++; countMaxRowDepth(col.children, tmpRowDepth); tmpRowDepth--; } // No children, is it the max depth? else { if(tmpRowDepth > maxRowDepth) { maxRowDepth = tmpRowDepth; } } } }; // Count max row depth for each row for(var m=0; m<tree.length; m++) { currentRow = tree[m]; countMaxRowDepth(currentRow); // Assign the right ROWSPAN values to each Column in the row for(var p=0; p<currentRow.length; p++) { currentColumn = currentRow[p]; if(!YAHOO.lang.isArray(currentColumn.children)) { currentColumn._nRowspan = maxRowDepth; } else { currentColumn._nRowspan = 1; } } // Reset counter for next row maxRowDepth = 1; } }
javascript
{ "resource": "" }
q30085
train
function(row, tmpRowDepth) { tmpRowDepth = tmpRowDepth || 1; for(var n=0; n<row.length; n++) { var col = row[n]; // Column has children, so keep counting if(YAHOO.lang.isArray(col.children)) { tmpRowDepth++; countMaxRowDepth(col.children, tmpRowDepth); tmpRowDepth--; } // No children, is it the max depth? else { if(tmpRowDepth > maxRowDepth) { maxRowDepth = tmpRowDepth; } } } }
javascript
{ "resource": "" }
q30086
train
function(i, oColumn) { headers[i].push(oColumn.getSanitizedKey()); if(oColumn._oParent) { recurseAncestorsForHeaders(i, oColumn._oParent); } }
javascript
{ "resource": "" }
q30087
train
function() { var aDefinitions = this._aDefinitions; // Internal recursive function to define Column instances var parseColumns = function(nodeList, oSelf) { // Parse each node at this depth for attributes and any children for(var j=0; j<nodeList.length; j++) { var currentNode = nodeList[j]; // Get the Column for each node var oColumn = oSelf.getColumnById(currentNode.yuiColumnId); if(oColumn) { // Update the current values var oDefinition = oColumn.getDefinition(); for(var name in oDefinition) { if(YAHOO.lang.hasOwnProperty(oDefinition, name)) { currentNode[name] = oDefinition[name]; } } } // The Column has descendants if(YAHOO.lang.isArray(currentNode.children)) { // The children themselves must also be parsed for Column instances parseColumns(currentNode.children, oSelf); } } }; parseColumns(aDefinitions, this); this._aDefinitions = aDefinitions; return aDefinitions; }
javascript
{ "resource": "" }
q30088
train
function(column) { if(YAHOO.lang.isString(column)) { var allColumns = this.flat; for(var i=allColumns.length-1; i>-1; i--) { if(allColumns[i]._sId === column) { return allColumns[i]; } } } return null; }
javascript
{ "resource": "" }
q30089
train
function(column) { if(YAHOO.lang.isNumber(column) && this.keys[column]) { return this.keys[column]; } else if(YAHOO.lang.isString(column)) { var allColumns = this.flat; var aColumns = []; for(var i=0; i<allColumns.length; i++) { if(allColumns[i].key === column) { aColumns.push(allColumns[i]); } } if(aColumns.length === 1) { return aColumns[0]; } else if(aColumns.length > 1) { return aColumns; } } return null; }
javascript
{ "resource": "" }
q30090
train
function() { var oDefinition = {}; // Update the definition oDefinition.abbr = this.abbr; oDefinition.className = this.className; oDefinition.editor = this.editor; oDefinition.editorOptions = this.editorOptions; //TODO: deprecated oDefinition.field = this.field; oDefinition.formatter = this.formatter; oDefinition.hidden = this.hidden; oDefinition.key = this.key; oDefinition.label = this.label; oDefinition.minWidth = this.minWidth; oDefinition.maxAutoWidth = this.maxAutoWidth; oDefinition.resizeable = this.resizeable; oDefinition.selected = this.selected; oDefinition.sortable = this.sortable; oDefinition.sortOptions = this.sortOptions; oDefinition.width = this.width; return oDefinition; }
javascript
{ "resource": "" }
q30091
train
function(e) { this.startWidth = this.headCellLiner.offsetWidth; this.startX = YAHOO.util.Event.getXY(e)[0]; this.nLinerPadding = (parseInt(YAHOO.util.Dom.getStyle(this.headCellLiner,"paddingLeft"),10)|0) + (parseInt(YAHOO.util.Dom.getStyle(this.headCellLiner,"paddingRight"),10)|0); }
javascript
{ "resource": "" }
q30092
train
function() { // Shrinks height of all resizer els to not hold open TH els var allKeys = this.datatable.getColumnSet().keys, thisKey = this.column.getKeyIndex(), col; for(var i=0, len=allKeys.length; i<len; i++) { col = allKeys[i]; if(col._ddResizer) { YAHOO.util.Dom.get(col._ddResizer.handleElId).style.height = "1em"; } } }
javascript
{ "resource": "" }
q30093
train
function(e) { var newX = YAHOO.util.Event.getXY(e)[0]; if(newX > YAHOO.util.Dom.getX(this.headCellLiner)) { var offsetX = newX - this.startX; var newWidth = this.startWidth + offsetX - this.nLinerPadding; if(newWidth > 0) { this.datatable.setColumnWidth(this.column, newWidth); } } }
javascript
{ "resource": "" }
q30094
train
function(index, range) { if(!lang.isNumber(range) || (range < 0)) { range = 1; } this._records.splice(index, range); //this._length = this._length - range; }
javascript
{ "resource": "" }
q30095
train
function(record) { var i; if(record instanceof widget.Record) { for(i=0; i<this._records.length; i++) { if(this._records[i] && (this._records[i]._sId === record._sId)) { return record; } } } else if(lang.isNumber(record)) { if((record > -1) && (record < this.getLength())) { return this._records[record]; } } else if(lang.isString(record)) { for(i=0; i<this._records.length; i++) { if(this._records[i] && (this._records[i]._sId === record)) { return this._records[i]; } } } // Not a valid Record for this RecordSet return null; }
javascript
{ "resource": "" }
q30096
train
function(index, range) { if(!lang.isNumber(index)) { return this._records; } if(!lang.isNumber(range)) { return this._records.slice(index); } return this._records.slice(index, index+range); }
javascript
{ "resource": "" }
q30097
train
function (index, range) { var recs = this.getRecords(index,range); for (var i = 0; i < range; ++i) { if (typeof recs[i] === 'undefined') { return false; } } return true; }
javascript
{ "resource": "" }
q30098
train
function(oRecord) { if(oRecord) { for(var i=this._records.length-1; i>-1; i--) { if(this._records[i] && oRecord.getId() === this._records[i].getId()) { return i; } } } return null; }
javascript
{ "resource": "" }
q30099
train
function(aData, index) { if(lang.isArray(aData)) { var newRecords = [], idx,i,len; index = lang.isNumber(index) ? index : this._records.length; idx = index; // Can't go backwards bc we need to preserve order for(i=0,len=aData.length; i<len; ++i) { if(lang.isObject(aData[i])) { var record = this._addRecord(aData[i], idx++); newRecords.push(record); } } this.fireEvent("recordsAddEvent",{records:newRecords,data:aData}); return newRecords; } else if(lang.isObject(aData)) { var oRecord = this._addRecord(aData); this.fireEvent("recordsAddEvent",{records:[oRecord],data:aData}); return oRecord; } else { return null; } }
javascript
{ "resource": "" }