_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q53000
train
function (e) { var chart = this.chart; return chart.inverted ? chart.plotHeight + chart.plotTop - e.chartY : e.chartX - chart.plotLeft; }
javascript
{ "resource": "" }
q53001
train
function (attribs, clip) { var chart = this.chart, seriesAttribs; // Scale each series each(chart.series, function (series) { seriesAttribs = attribs || series.getPlotBox(); // #1701 if (series.xAxis && series.xAxis.zoomEnabled) { series.group.attr(seriesAttribs); if (series.markerGroup) { ...
javascript
{ "resource": "" }
q53002
train
function (e) { var self = this, chart = self.chart, pinchDown = self.pinchDown, followTouchMove = chart.tooltip && chart.tooltip.options.followTouchMove, touches = e.touches, touchesLength = touches.length, lastValidTouch = self.lastValidTouch, zoomHor = self.zoomHor || self.pinchHor, zoomVer...
javascript
{ "resource": "" }
q53003
train
function (e) { var chart = this.chart; // Record the start position chart.mouseIsDown = e.type; chart.cancelClick = false; chart.mouseDownX = this.mouseDownX = e.chartX; chart.mouseDownY = this.mouseDownY = e.chartY; }
javascript
{ "resource": "" }
q53004
train
function (e) { var chart = this.chart, chartOptions = chart.options.chart, chartX = e.chartX, chartY = e.chartY, zoomHor = this.zoomHor, zoomVert = this.zoomVert, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, clickedInsid...
javascript
{ "resource": "" }
q53005
train
function (element, className) { var elemClassName; while (element) { elemClassName = attr(element, 'class'); if (elemClassName) { if (elemClassName.indexOf(className) !== -1) { return true; } else if (elemClassName.indexOf(PREFIX + 'container') !== -1) { return false; } } element =...
javascript
{ "resource": "" }
q53006
train
function () { var legend = this, legendGroup = legend.group, box = legend.box; if (box) { legend.box = box.destroy(); } if (legendGroup) { legend.group = legendGroup.destroy(); } }
javascript
{ "resource": "" }
q53007
train
function () { var options = this.options, padding = this.padding, titleOptions = options.title, titleHeight = 0, bBox; if (titleOptions.text) { if (!this.title) { this.title = this.chart.renderer.label(titleOptions.text, padding - 3, padding - 4, null, null, null, null, null, 'legend-title') ...
javascript
{ "resource": "" }
q53008
train
function (userOptions, callback) { // Handle regular options var options, seriesOptions = userOptions.series; // skip merging data points to increase performance userOptions.series = null; options = merge(defaultOptions, userOptions); // do the merge options.series = userOptions.series = seriesOptions; /...
javascript
{ "resource": "" }
q53009
train
function (options, isX, redraw, animation) { var key = isX ? 'xAxis' : 'yAxis', chartOptions = this.options, axis; /*jslint unused: false*/ axis = new Axis(this, merge(options, { index: this[key].length, isX: isX })); /*jslint unused: true*/ // Push the new axis options to the chart options ...
javascript
{ "resource": "" }
q53010
train
function (plotX, plotY, inverted) { var x = inverted ? plotY : plotX, y = inverted ? plotX : plotY; return x >= 0 && x <= this.plotWidth && y >= 0 && y <= this.plotHeight; }
javascript
{ "resource": "" }
q53011
train
function (str) { var chart = this, options = chart.options, loadingDiv = chart.loadingDiv; var loadingOptions = options.loading; // create the layer at the first call if (!loadingDiv) { chart.loadingDiv = loadingDiv = createElement(DIV, { className: PREFIX + 'loading' }, extend(loadingOptions....
javascript
{ "resource": "" }
q53012
train
function () { var options = this.options, loadingDiv = this.loadingDiv; if (loadingDiv) { animate(loadingDiv, { opacity: 0 }, { duration: options.loading.hideDuration || 100, complete: function () { css(loadingDiv, { display: NONE }); } }); } this.loadingShown = false; }
javascript
{ "resource": "" }
q53013
train
function () { var points = []; each(this.series, function (serie) { points = points.concat(grep(serie.points || [], function (point) { return point.selected; })); }); return points; }
javascript
{ "resource": "" }
q53014
train
function () { var chart = this; // reset stacks for each yAxis each(chart.yAxis, function (axis) { if (axis.stacks && axis.hasVisibleSeries) { axis.oldStacks = axis.stacks; } }); each(chart.series, function (series) { if (series.options.stacking && (series.visible === true || chart.options.char...
javascript
{ "resource": "" }
q53015
train
function () { var chart = this, lang = defaultOptions.lang, btnOptions = chart.options.chart.resetZoomButton, theme = btnOptions.theme, states = theme.states, alignTo = btnOptions.relativeTo === 'chart' ? null : 'plotBox'; this.resetZoomButton = chart.renderer.button(lang.resetZoom, null, null, f...
javascript
{ "resource": "" }
q53016
train
function (event) { var chart = this, hasZoomed, pointer = chart.pointer, displayButton = false, resetZoomButton; // If zoom is called with no arguments, reset the axes if (!event || event.resetSelection) { each(chart.axes, function (axis) { hasZoomed = axis.zoom(); }); } else { // else, z...
javascript
{ "resource": "" }
q53017
train
function (e, panning) { var chart = this, hoverPoints = chart.hoverPoints, doRedraw; // remove active points for shared tooltip if (hoverPoints) { each(hoverPoints, function (point) { point.setState(); }); } each(panning === 'xy' ? [1, 0] : [1], function (isX) { // xy is used in maps var...
javascript
{ "resource": "" }
q53018
train
function (revert) { var clone = this.renderToClone, container = this.container; // Destroy the clone and bring the container back to the real renderTo div if (revert) { if (clone) { this.renderTo.appendChild(container); discardElement(clone); delete this.renderToClone; } // Set up the...
javascript
{ "resource": "" }
q53019
train
function () { var chart = this, spacing = chart.spacing, axisOffset, legend = chart.legend, margin = chart.margin, legendOptions = chart.options.legend, legendMargin = pick(legendOptions.margin, 10), legendX = legendOptions.x, legendY = legendOptions.y, align = legendOptions.align, verti...
javascript
{ "resource": "" }
q53020
train
function (skipAxes) { var chart = this, inverted = chart.inverted, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, optionsChart = chart.options.chart, spacing = chart.spacing, clipOffset = chart.clipOffset, clipX, clipY, plotLeft, plotTop, ...
javascript
{ "resource": "" }
q53021
train
function () { var chart = this, spacing = chart.spacing, margin = chart.margin; chart.plotTop = pick(margin[0], spacing[0]); chart.marginRight = pick(margin[1], spacing[1]); chart.marginBottom = pick(margin[2], spacing[2]); chart.plotLeft = pick(margin[3], spacing[3]); chart.axisOffset = [0, 0, 0, 0]...
javascript
{ "resource": "" }
q53022
train
function () { var chart = this, optionsChart = chart.options.chart, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, chartBackground = chart.chartBackground, plotBackground = chart.plotBackground, plotBorder = chart.plotBorder, plotBGImage = chart.plot...
javascript
{ "resource": "" }
q53023
train
function () { var chart = this, optionsChart = chart.options.chart, klass, seriesOptions = chart.options.series, i, value; each(['inverted', 'angular', 'polar'], function (key) { // The default series type's class klass = seriesTypes[optionsChart.type || optionsChart.defaultSeriesTy...
javascript
{ "resource": "" }
q53024
train
function () { var chart = this, chartSeries = chart.series; // Reset links each(chartSeries, function (series) { series.linkedSeries.length = 0; }); // Apply new links each(chartSeries, function (series) { var linkedTo = series.options.linkedTo; if (isString(linkedTo)) { if (linkedTo === '...
javascript
{ "resource": "" }
q53025
train
function () { var chart = this; // Note: in spite of JSLint's complaints, win == win.top is required /*jslint eqeq: true*/ if ((!hasSVG && (win == win.top && doc.readyState !== 'complete')) || (useCanVG && !win.canvg)) { /*jslint eqeq: false*/ if (useCanVG) { // Delay rendering until canvg library is ...
javascript
{ "resource": "" }
q53026
train
function (target, options) { var oVar = options[target], tArray = isObject(oVar) ? oVar : [oVar, oVar, oVar, oVar]; return [pick(options[target + 'Top'], tArray[0]), pick(options[target + 'Right'], tArray[1]), pick(options[target + 'Bottom'], tArray[2]), pick(options[target + 'Left'], tArray[3])]; ...
javascript
{ "resource": "" }
q53027
train
function (options) { var ret, series = this.series, pointArrayMap = series.pointArrayMap || ['y'], valueCount = pointArrayMap.length, firstItemType, i = 0, j = 0; if (typeof options === 'number' || options === null) { ret = { y: options }; } else if (isArray(options)) { ret = {}; // w...
javascript
{ "resource": "" }
q53028
train
function () { var point = this, props = ['graphic', 'dataLabel', 'dataLabelUpper', 'group', 'connector', 'shadowGroup'], prop, i = 6; while (i--) { prop = props[i]; if (point[prop]) { point[prop] = point[prop].destroy(); } } }
javascript
{ "resource": "" }
q53029
train
function () { var point = this; return { x: point.category, y: point.y, key: point.name || point.category, series: point.series, point: point, percentage: point.percentage, total: point.total || point.stackTotal }; }
javascript
{ "resource": "" }
q53030
train
function (eventType, eventArgs, defaultFunction) { var point = this, series = this.series, seriesOptions = series.options; // load event handlers on demand to save time on mouseover/out if (seriesOptions.point.events[eventType] || (point.options && point.options.events && point.options.events[eventType])) ...
javascript
{ "resource": "" }
q53031
train
function () { var series = this, lastNull = -1, segments = [], i, points = series.points, pointsLength = points.length; if (pointsLength) { // no action required for [] // if connect nulls, just remove null points if (series.options.connectNulls) { i = pointsLength; while (i--) { ...
javascript
{ "resource": "" }
q53032
train
function (redraw, animation) { var series = this, chart = series.chart; redraw = pick(redraw, true); if (!series.isRemoving) { /* prevent triggering native event in jQuery (calling the remove function from the remove event) */ series.isRemoving = true; // fire the event with a default handler of r...
javascript
{ "resource": "" }
q53033
train
function () { if (!this.options.stacking || (this.visible !== true && this.chart.options.chart.ignoreHiddenSeries !== false)) { return; } var series = this, xData = series.processedXData, yData = series.processedYData, stackedYData = [], yDataLength = yData.length, seriesOptions = series.option...
javascript
{ "resource": "" }
q53034
train
function () { var xAxis = this.xAxis, yAxis = this.yAxis, xData = this.processedXData, yData = this.stackedYData || this.processedYData, yDataLength = yData.length, activeYData = [], activeCounter = 0, xExtremes = xAxis.getExtremes(), // #2117, need to compensate for log X axis xMin = xExtreme...
javascript
{ "resource": "" }
q53035
train
function (point) { var series = this, tooltipOptions = series.tooltipOptions, xDateFormat = tooltipOptions.xDateFormat, dateTimeLabelFormats = tooltipOptions.dateTimeLabelFormats, xAxis = series.xAxis, isDateTime = xAxis && xAxis.options.type === 'datetime', headerFormat = tooltipOptions.headerForma...
javascript
{ "resource": "" }
q53036
train
function (point, dataLabel, options, alignTo, isNew) { var chart = this.chart, inverted = chart.inverted, plotX = pick(point.plotX, -999), plotY = pick(point.plotY, -999), bBox = dataLabel.getBBox(), visible = this.visible && chart.isInsidePlot(point.plotX, point.plotY, inverted), alignAttr; // the ...
javascript
{ "resource": "" }
q53037
train
function (dataLabel, options, alignAttr, bBox, alignTo, isNew) { var chart = this.chart, align = options.align, verticalAlign = options.verticalAlign, off, justified; // Off left off = alignAttr.x; if (off < 0) { if (align === 'right') { options.align = 'left'; } else { options.x = -o...
javascript
{ "resource": "" }
q53038
train
function (segment) { var series = this, segmentPath = [], step = series.options.step; // build the segment line each(segment, function (point, i) { var plotX = point.plotX, plotY = point.plotY, lastPoint; if (series.getPointSpline) { // generate the spline as defined in the SplineSe...
javascript
{ "resource": "" }
q53039
train
function () { var series = this, graphPath = [], segmentPath, singlePoints = []; // used in drawTracker // Divide into segments and build graph and area paths each(series.segments, function (segment) { segmentPath = series.getSegmentPath(segment); // add the segment to the graph, or a sing...
javascript
{ "resource": "" }
q53040
train
function () { var options = this.options, chart = this.chart, renderer = chart.renderer, negativeColor = options.negativeColor || options.negativeFillColor, translatedThreshold, posAttr, negAttr, graph = this.graph, area = this.area, posClip = this.posClip, negClip = this.negClip, cha...
javascript
{ "resource": "" }
q53041
train
function () { var series = this, chart = series.chart; // Pie, go away (#1736) if (!series.xAxis) { return; } // A fixed size is needed for inversion to work function setInvert() { var size = { width: series.yAxis.len, height: series.xAxis.len }; each(['group', 'markerGroup...
javascript
{ "resource": "" }
q53042
setInvert
train
function setInvert() { var size = { width: series.yAxis.len, height: series.xAxis.len }; each(['group', 'markerGroup'], function (groupName) { if (series[groupName]) { series[groupName].attr(size).invert(); } }); }
javascript
{ "resource": "" }
q53043
train
function (prop, name, visibility, zIndex, parent) { var group = this[prop], isNew = !group; // Generate it on first call if (isNew) { this[prop] = group = this.chart.renderer.g(name) .attr({ visibility: visibility, zIndex: zIndex || 0.1 // IE8 needs this }) .add(parent); } // P...
javascript
{ "resource": "" }
q53044
train
function (path, segment, translatedThreshold) { path.push( L, segment[segment.length - 1].plotX, translatedThreshold, L, segment[0].plotX, translatedThreshold ); }
javascript
{ "resource": "" }
q53045
train
function () { // Define or reset areaPath this.areaPath = []; // Call the base method Series.prototype.drawGraph.apply(this); // Define local variables var series = this, areaPath = this.areaPath, options = this.options, negativeColor = options.negativeColor, negativeFillColor = options...
javascript
{ "resource": "" }
q53046
train
function () { var series = this, options = series.options, xAxis = series.xAxis, yAxis = series.yAxis, reversedXAxis = xAxis.reversed, stackKey, stackGroups = {}, columnIndex, columnCount = 0; // Get the total number of column type series. // This is called on every series. Consider movi...
javascript
{ "resource": "" }
q53047
train
function () { var series = this, chart = series.chart, pointer = chart.pointer, cursor = series.options.cursor, css = cursor && { cursor: cursor }, onMouseOver = function (e) { var target = e.target, point; if (chart.hoverSeries !== series) { series.onMouseOver(); } while (ta...
javascript
{ "resource": "" }
q53048
train
function () { var series = this, chart = series.chart; // column and bar series affects other series of the same type // as they are either stacked or grouped if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; ...
javascript
{ "resource": "" }
q53049
train
function (init) { var series = this, points = series.points, startAngleRad = series.startAngleRad; if (!init) { each(points, function (point) { var graphic = point.graphic, args = point.shapeArgs; if (graphic) { // start values graphic.attr({ r: series.center[3] / 2, // anima...
javascript
{ "resource": "" }
q53050
train
function (data, redraw) { Series.prototype.setData.call(this, data, false); this.processData(); this.generatePoints(); if (pick(redraw, true)) { this.chart.redraw(); } }
javascript
{ "resource": "" }
q53051
train
function () { var i, total = 0, points, len, point, ignoreHiddenPoint = this.options.ignoreHiddenPoint; Series.prototype.generatePoints.call(this); // Populate local vars points = this.points; len = points.length; // Get the total sum for (i = 0; i < len; i++) { point = points[i]; ...
javascript
{ "resource": "" }
q53052
train
function () { var options = this.options, chart = this.chart, slicingRoom = 2 * (options.slicedOffset || 0), handleSlicingRoom, plotWidth = chart.plotWidth - 2 * slicingRoom, plotHeight = chart.plotHeight - 2 * slicingRoom, centerOption = options.center, positions = [pick(centerOption[0], '50%...
javascript
{ "resource": "" }
q53053
train
function (points, sign) { points.sort(function (a, b) { return a.angle !== undefined && (b.angle - a.angle) * sign; }); }
javascript
{ "resource": "" }
q53054
train
function () { each(this.points, function (point) { var dataLabel = point.dataLabel, _pos; if (dataLabel) { _pos = dataLabel._pos; if (_pos) { dataLabel.attr(dataLabel._attr); dataLabel[dataLabel.moved ? 'animate' : 'attr'](_pos); dataLabel.moved = true; } else if (dataLabel...
javascript
{ "resource": "" }
q53055
train
function(viewPort) { if (!that.hasValue()) return 0; var s = that.value+''; if (s.match(/em$/)) return that.numValue() * this.EM(viewPort); if (s.match(/ex$/)) return that.numValue() * this.EM(viewPort) / 2.0; if (s.match(/px$/)) return that.numValue(); if (s.match(/pt$/)) return that.numV...
javascript
{ "resource": "" }
q53056
train
function (chart) { var renderer = this, options = chart.options.tooltip, borderWidth = options.borderWidth, tooltipDiv = renderer.ttDiv, tooltipDivStyle = options.style, tooltipLine = renderer.ttLine, padding = parseInt(tooltipDivStyle.padding, 10); // Add border styling from options to t...
javascript
{ "resource": "" }
q53057
train
function () { var renderer = this; // Remove the canvas discardElement(renderer.canvas); // Kill the timer if (renderer.ttTimer !== UNDEFINED) { clearTimeout(renderer.ttTimer); } // Remove the divs for tooltip and line discardElement(renderer.ttLine); discardElement(renderer.ttDiv); ...
javascript
{ "resource": "" }
q53058
train
function (pathAnim) { var fxProto = Fx.prototype, fxStart = fxProto.start, morphProto = Fx.Morph.prototype, morphCompute = morphProto.compute; // override Fx.start to allow animation of SVG element wrappers /*jslint unparam: true*//* allow unused parameters in fx functions */ fxProto.start = function ...
javascript
{ "resource": "" }
q53059
train
function (scriptLocation, callback) { // We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script. var head = doc.getElementsByTagName('head')[0]; var script = doc.createElement('script'); script.type = 'text/javascript'; script.src = scriptLocation...
javascript
{ "resource": "" }
q53060
train
function (el) { var offsets = el.getPosition(); // #1496 return { left: offsets.x, top: offsets.y }; }
javascript
{ "resource": "" }
q53061
train
function (e) { var chart = this.chart; e = this.normalize(e); if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) { chart.mapZoom( 0.5, chart.xAxis[0].toValue(e.chartX), chart.yAxis[0].toValue(e.chartY) ); } }
javascript
{ "resource": "" }
q53062
train
function (inner, outer) { each([['x', 'width'], ['y', 'height']], function (dim) { var pos = dim[0], size = dim[1]; if (inner[pos] + inner[size] > outer[pos] + outer[size]) { // right overflow if (inner[size] > outer[size]) { // the general size is greater, fit fully to outer inner[size] = ou...
javascript
{ "resource": "" }
q53063
train
function (howMuch, centerXArg, centerYArg) { if (this.isMapZooming) { return; } var chart = this, xAxis = chart.xAxis[0], xRange = xAxis.max - xAxis.min, centerX = pick(centerXArg, xAxis.min + xRange / 2), newXRange = xRange * howMuch, yAxis = chart.yAxis[0], yRange = yAxis.max - ...
javascript
{ "resource": "" }
q53064
train
function (options, x) { var point = Point.prototype.applyOptions.call(this, options, x); if (point.path && typeof point.path === 'string') { point.path = point.options.path = Highcharts.splitPath(point.path); } return point; }
javascript
{ "resource": "" }
q53065
train
function () { var point = this, start = +new Date(), normalColor = Color(point.options.color), hoverColor = Color(point.pointAttr.hover.fill), animation = point.series.options.states.normal.animation, duration = animation && (animation.duration || 500); if (duration && normalColor.rgba.length...
javascript
{ "resource": "" }
q53066
train
function (chart) { var series = this, valueDecimals = chart.options.legend.valueDecimals, legendItems = [], name, from, to, fromLabel, toLabel, colorRange, valueRanges, gradientColor, grad, tmpLabel, horizontal = chart.options.legend.layout === 'horizontal'; ...
javascript
{ "resource": "" }
q53067
train
function (legend, item) { var spacing = legend.options.symbolPadding, padding = pick(legend.options.padding, 8), positionY, positionX, gradientSize = this.chart.renderer.fontMetrics(legend.options.itemStyle.fontSize).h, horizontal = legend.options.layout === 'horizontal', box1, box2, ...
javascript
{ "resource": "" }
q53068
train
function (paths) { var maxX = Number.MIN_VALUE, minX = Number.MAX_VALUE, maxY = Number.MIN_VALUE, minY = Number.MAX_VALUE; // Find the bounding box each(paths || this.options.data, function (point) { var path = point.path, i = path.length, even = false, // while loop read...
javascript
{ "resource": "" }
q53069
train
function (path) { var series = this, even = false, // while loop reads from the end xAxis = series.xAxis, yAxis = series.yAxis, i; // Preserve the original path = [].concat(path); // Do the translation i = path.length; while (i--) { if (typeof path[i] === 'number') { ...
javascript
{ "resource": "" }
q53070
train
function () { var series = this, dataMin = Number.MAX_VALUE, dataMax = Number.MIN_VALUE; series.generatePoints(); each(series.data, function (point) { point.shapeType = 'path'; point.shapeArgs = { d: series.translatePath(point.path) }; // TODO: do point colors in draw...
javascript
{ "resource": "" }
q53071
train
function (dataMin, dataMax) { var seriesOptions = this.options, valueRanges = seriesOptions.valueRanges, colorRange = seriesOptions.colorRange, colorKey = this.colorKey, from, to; if (colorRange) { from = Color(colorRange.from); to = Color(colorRange.to); } each(this.dat...
javascript
{ "resource": "" }
q53072
train
function () { var series = this, xAxis = series.xAxis, yAxis = series.yAxis, colorKey = series.colorKey; // Make points pass test in drawing each(series.data, function (point) { point.plotY = 1; // pass null test in column.drawPoints if (point[colorKey] === null) { point[colorKey] ...
javascript
{ "resource": "" }
q53073
train
function (init) { var toBox = this.chart.plotBox, level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1], fromBox = level.bBox, animationOptions = this.chart.options.drilldown.animation, scale; if (!init) { scale = Math.min(fromBox.width / toBox.width, fromBox.height /...
javascript
{ "resource": "" }
q53074
train
function(highlighter) { var html = '<div class="toolbar">', items = sh.toolbar.items, list = items.list ; function defaultGetHtml(highlighter, name) { return sh.toolbar.getButtonH...
javascript
{ "resource": "" }
q53075
train
function(e) { var target = e.target, className = target.className || '' ; function getValue(name) { var r = new RegExp(name + '_(\\w+)'), match = r.exec(className) ...
javascript
{ "resource": "" }
q53076
train
function(globalParams, element) { var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)), conf = sh.config, result = [] ; // support for <SCRIPT TYPE="syntaxhighlighter" /> feature if (co...
javascript
{ "resource": "" }
q53077
train
function(globalParams, element) { var elements = this.findElements(globalParams, element), propertyName = 'innerHTML', highlighter = null, conf = sh.config ; if (elements.length === 0) return; f...
javascript
{ "resource": "" }
q53078
indexOf
train
function indexOf(array, searchElement, fromIndex) { fromIndex = Math.max(fromIndex || 0, 0); for (var i = fromIndex; i < array.length; i++) if(array[i] == searchElement) return i; return -1; }
javascript
{ "resource": "" }
q53079
merge
train
function merge(obj1, obj2) { var result = {}, name; for (name in obj1) result[name] = obj1[name]; for (name in obj2) result[name] = obj2[name]; return result; }
javascript
{ "resource": "" }
q53080
toBoolean
train
function toBoolean(value) { var result = { "true" : true, "false" : false }[value]; return result == null ? value : result; }
javascript
{ "resource": "" }
q53081
popup
train
function popup(url, name, width, height, options) { var x = (screen.width - width) / 2, y = (screen.height - height) / 2 ; options += ', left=' + x + ', top=' + y + ', width=' + width + ', height=' + height ; options = opti...
javascript
{ "resource": "" }
q53082
attachEvent
train
function attachEvent(obj, type, func, scope) { function handler(e) { e = e || window.event; if (!e.target) { e.target = e.srcElement; e.preventDefault = function() { this.returnValue = false; ...
javascript
{ "resource": "" }
q53083
findBrush
train
function findBrush(alias, showAlert) { var brushes = sh.vars.discoveredBrushes, result = null ; if (brushes == null) { brushes = {}; // Find all brushes for (var brush in sh.brushes) { var info = sh.bru...
javascript
{ "resource": "" }
q53084
eachLine
train
function eachLine(str, callback) { var lines = splitLines(str); for (var i = 0; i < lines.length; i++) lines[i] = callback(lines[i], i); // include \r to enable copy-paste on windows (ie8) without getting everything on one line return lines.join('\r\n'); }
javascript
{ "resource": "" }
q53085
padNumber
train
function padNumber(number, length) { var result = number.toString(); while (result.length < length) result = '0' + result; return result; }
javascript
{ "resource": "" }
q53086
processTabs
train
function processTabs(code, tabSize) { var tab = ''; for (var i = 0; i < tabSize; i++) tab += ' '; return code.replace(/\t/g, tab); }
javascript
{ "resource": "" }
q53087
processSmartTabs
train
function processSmartTabs(code, tabSize) { var lines = splitLines(code), tab = '\t', spaces = '' ; // Create a string with 1000 spaces to copy spaces from... // It's assumed that there would be no indentation longer than that. for (var i = 0; i < ...
javascript
{ "resource": "" }
q53088
insertSpaces
train
function insertSpaces(line, pos, count) { return line.substr(0, pos) + spaces.substr(0, count) + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab ; }
javascript
{ "resource": "" }
q53089
fixInputString
train
function fixInputString(str) { var br = /<br\s*\/?>|&lt;br\s*\/?&gt;/gi; if (sh.config.bloggerMode == true) str = str.replace(br, '\n'); if (sh.config.stripBrs == true) str = str.replace(br, ''); return str; }
javascript
{ "resource": "" }
q53090
unindent
train
function unindent(str) { var lines = splitLines(fixInputString(str)), indents = new Array(), regex = /^\s*/, min = 1000 ; // go through every line and check for common number of indents for (var i = 0; i < lines.length && min > 0; i++) ...
javascript
{ "resource": "" }
q53091
getMatches
train
function getMatches(code, regexInfo) { function defaultAdd(match, regexInfo) { return match[0]; }; var index = 0, match = null, matches = [], func = regexInfo.func ? regexInfo.func : defaultAdd ; while((match = reg...
javascript
{ "resource": "" }
q53092
quickCodeHandler
train
function quickCodeHandler(e) { var target = e.target, highlighterDiv = findParentElement(target, '.syntaxhighlighter'), container = findParentElement(target, '.container'), textarea = document.createElement('textarea'), highlighter ; if (!...
javascript
{ "resource": "" }
q53093
train
function(name, defaultValue) { var result = this.params[name]; return toBoolean(result == null ? defaultValue : result); }
javascript
{ "resource": "" }
q53094
train
function(regexList, code) { var result = []; if (regexList != null) for (var i = 0; i < regexList.length; i++) // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com) if (typeof (regexList[i]) ...
javascript
{ "resource": "" }
q53095
train
function(matches) { // Optimized by Jose Prado (http://joseprado.com) for (var i = 0; i < matches.length; i++) { if (matches[i] === null) continue; var itemI = matches[i], itemIEndPos = itemI.index + ite...
javascript
{ "resource": "" }
q53096
train
function(lineNumber) { var list = this.getParam('highlight', []); if (typeof(list) != 'object' && list.push == null) list = [ list ]; return indexOf(list, lineNumber.toString()) != -1; }
javascript
{ "resource": "" }
q53097
train
function(code) { if (code === null) code = ''; this.code = code; var div = this.create('div'); // create main HTML div.innerHTML = this.getHtml(code); // set up click handlers if (this.getParam('toolbar')) ...
javascript
{ "resource": "" }
q53098
train
function(regexGroup) { var regex = { 'end' : regexGroup.right.source }; if(regexGroup.eof) regex.end = "(?:(?:" + regex.end + ")|$)"; this.htmlScript = { left : { regex: regexGroup.left, css: 'script' }, right : { regex: regex...
javascript
{ "resource": "" }
q53099
train
function(id, options, ready){ var tag; // Element of ID // Allow for element or ID to be passed in // String ID if (typeof id === 'string') { // Adjust for jQuery ID syntax if (id.indexOf('#') === 0) { id = id.slice(1); } // If a player instance has already been created for this ID retu...
javascript
{ "resource": "" }