code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function fixExtentWithBands(extent, nTick) { var size = extent[1] - extent[0]; var len = nTick; var margin = size / len / 2; extent[0] += margin; extent[1] -= margin; }
Transform global coord to local coord, i.e. var globalCoord = axis.toLocalCoord(40); designate by module:echarts/coord/cartesian/Grid. @type {Function}
fixExtentWithBands
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) { var ticksLen = ticksCoords.length; if (!axis.onBand || alignWithLabel || !ticksLen) { return; } var axisExtent = axis.getExtent(); var last; var diffSize; if (ticksLen === 1) { ticksCoords[0].coord = axisExtent[0]; last = ticksCoords[1] = {coord: axisExtent[0]}; } else { var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue; var shift = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen; each$1(ticksCoords, function (ticksItem) { ticksItem.coord -= shift / 2; }); var dataExtent = axis.scale.getExtent(); diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue; last = {coord: ticksCoords[ticksLen - 1].coord + shift * diffSize}; ticksCoords.push(last); } var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp. if (littleThan(ticksCoords[0].coord, axisExtent[0])) { clamp ? (ticksCoords[0].coord = axisExtent[0]) : ticksCoords.shift(); } if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) { ticksCoords.unshift({coord: axisExtent[0]}); } if (littleThan(axisExtent[1], last.coord)) { clamp ? (last.coord = axisExtent[1]) : ticksCoords.pop(); } if (clamp && littleThan(last.coord, axisExtent[1])) { ticksCoords.push({coord: axisExtent[1]}); } function littleThan(a, b) { // Avoid rounding error cause calculated tick coord different with extent. // It may cause an extra unecessary tick added. a = round$1(a); b = round$1(b); return inverse ? a > b : a < b; } }
Transform global coord to local coord, i.e. var globalCoord = axis.toLocalCoord(40); designate by module:echarts/coord/cartesian/Grid. @type {Function}
fixOnBandTicksCoords
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function littleThan(a, b) { // Avoid rounding error cause calculated tick coord different with extent. // It may cause an extra unecessary tick added. a = round$1(a); b = round$1(b); return inverse ? a > b : a < b; }
Transform global coord to local coord, i.e. var globalCoord = axis.toLocalCoord(40); designate by module:echarts/coord/cartesian/Grid. @type {Function}
littleThan
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
Axis2D = function (dim, scale, coordExtent, axisType, position) { Axis.call(this, dim, scale, coordExtent); /** * Axis type * - 'category' * - 'value' * - 'time' * - 'log' * @type {string} */ this.type = axisType || 'value'; /** * Axis position * - 'top' * - 'bottom' * - 'left' * - 'right' */ this.position = position || 'bottom'; }
Transform global coord to local coord, i.e. var globalCoord = axis.toLocalCoord(40); designate by module:echarts/coord/cartesian/Grid. @type {Function}
Axis2D
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getAxisType(axisDim, option) { // Default axis with data is category axis return option.type || (option.data ? 'category' : 'value'); }
@type {Array.<module:echarts/coord/cartesian/Axis2D>} @private
getAxisType
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isAxisUsedInTheGrid(axisModel, gridModel, ecModel) { return axisModel.getCoordSysModel() === gridModel; }
Usage: grid.getCartesian(xAxisIndex, yAxisIndex); grid.getCartesian(xAxisIndex); grid.getCartesian(null, yAxisIndex); grid.getCartesian({xAxisIndex: ..., yAxisIndex: ...}); @param {number|Object} [xAxisIndex] @param {number} [yAxisIndex]
isAxisUsedInTheGrid
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function Grid(gridModel, ecModel, api) { /** * @type {Object.<string, module:echarts/coord/cartesian/Cartesian2D>} * @private */ this._coordsMap = {}; /** * @type {Array.<module:echarts/coord/cartesian/Cartesian>} * @private */ this._coordsList = []; /** * @type {Object.<string, Array.<module:echarts/coord/cartesian/Axis2D>>} * @private */ this._axesMap = {}; /** * @type {Array.<module:echarts/coord/cartesian/Axis2D>} * @private */ this._axesList = []; this._initCartesian(gridModel, ecModel, api); this.model = gridModel; }
Usage: grid.getCartesian(xAxisIndex, yAxisIndex); grid.getCartesian(xAxisIndex); grid.getCartesian(null, yAxisIndex); grid.getCartesian({xAxisIndex: ..., yAxisIndex: ...}); @param {number|Object} [xAxisIndex] @param {number} [yAxisIndex]
Grid
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function endTextLayout(opt, textPosition, textRotate, extent) { var rotationDiff = remRadian(textRotate - opt.rotation); var textAlign; var textVerticalAlign; var inverse = extent[0] > extent[1]; var onLeft = (textPosition === 'start' && !inverse) || (textPosition !== 'start' && inverse); if (isRadianAroundZero(rotationDiff - PI$2 / 2)) { textVerticalAlign = onLeft ? 'bottom' : 'top'; textAlign = 'center'; } else if (isRadianAroundZero(rotationDiff - PI$2 * 1.5)) { textVerticalAlign = onLeft ? 'top' : 'bottom'; textAlign = 'center'; } else { textVerticalAlign = 'middle'; if (rotationDiff < PI$2 * 1.5 && rotationDiff > PI$2 / 2) { textAlign = onLeft ? 'left' : 'right'; } else { textAlign = onLeft ? 'right' : 'left'; } } return { rotation: rotationDiff, textAlign: textAlign, textVerticalAlign: textVerticalAlign }; }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
endTextLayout
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function fixMinMaxLabelShow(axisModel, labelEls, tickEls) { if (shouldShowAllLabels(axisModel.axis)) { return; } // If min or max are user set, we need to check // If the tick on min(max) are overlap on their neighbour tick // If they are overlapped, we need to hide the min(max) tick label var showMinLabel = axisModel.get('axisLabel.showMinLabel'); var showMaxLabel = axisModel.get('axisLabel.showMaxLabel'); // FIXME // Have not consider onBand yet, where tick els is more than label els. labelEls = labelEls || []; tickEls = tickEls || []; var firstLabel = labelEls[0]; var nextLabel = labelEls[1]; var lastLabel = labelEls[labelEls.length - 1]; var prevLabel = labelEls[labelEls.length - 2]; var firstTick = tickEls[0]; var nextTick = tickEls[1]; var lastTick = tickEls[tickEls.length - 1]; var prevTick = tickEls[tickEls.length - 2]; if (showMinLabel === false) { ignoreEl(firstLabel); ignoreEl(firstTick); } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) { if (showMinLabel) { ignoreEl(nextLabel); ignoreEl(nextTick); } else { ignoreEl(firstLabel); ignoreEl(firstTick); } } if (showMaxLabel === false) { ignoreEl(lastLabel); ignoreEl(lastTick); } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) { if (showMaxLabel) { ignoreEl(prevLabel); ignoreEl(prevTick); } else { ignoreEl(lastLabel); ignoreEl(lastTick); } } }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
fixMinMaxLabelShow
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function ignoreEl(el) { el && (el.ignore = true); }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
ignoreEl
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isTwoLabelOverlapped(current, next, labelLayout) { // current and next has the same rotation. var firstRect = current && current.getBoundingRect().clone(); var nextRect = next && next.getBoundingRect().clone(); if (!firstRect || !nextRect) { return; } // When checking intersect of two rotated labels, we use mRotationBack // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`. var mRotationBack = identity([]); rotate(mRotationBack, mRotationBack, -current.rotation); firstRect.applyTransform(mul$1([], mRotationBack, current.getLocalTransform())); nextRect.applyTransform(mul$1([], mRotationBack, next.getLocalTransform())); return firstRect.intersect(nextRect); }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
isTwoLabelOverlapped
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isNameLocationCenter(nameLocation) { return nameLocation === 'middle' || nameLocation === 'center'; }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
isNameLocationCenter
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, aniid) { var tickEls = []; var pt1 = []; var pt2 = []; for (var i = 0; i < ticksCoords.length; i++) { var tickCoord = ticksCoords[i].coord; pt1[0] = tickCoord; pt1[1] = 0; pt2[0] = tickCoord; pt2[1] = tickEndCoord; if (tickTransform) { applyTransform(pt1, pt1, tickTransform); applyTransform(pt2, pt2, tickTransform); } // Tick line, Not use group transform to have better line draw var tickEl = new Line({ // Id for animation anid: aniid + '_' + ticksCoords[i].tickValue, subPixelOptimize: true, shape: { x1: pt1[0], y1: pt1[1], x2: pt2[0], y2: pt2[1] }, style: tickLineStyle, z2: 2, silent: true }); tickEls.push(tickEl); } return tickEls; }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
createTicks
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function buildAxisMajorTicks(axisBuilder, axisModel, opt) { var axis = axisModel.axis; var tickModel = axisModel.getModel('axisTick'); if (!tickModel.get('show') || axis.scale.isBlank()) { return; } var lineStyleModel = tickModel.getModel('lineStyle'); var tickEndCoord = opt.tickDirection * tickModel.get('length'); var ticksCoords = axis.getTicksCoords(); var ticksEls = createTicks(ticksCoords, axisBuilder._transform, tickEndCoord, defaults( lineStyleModel.getLineStyle(), { stroke: axisModel.get('axisLine.lineStyle.color') } ), 'ticks'); for (var i = 0; i < ticksEls.length; i++) { axisBuilder.group.add(ticksEls[i]); } return ticksEls; }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
buildAxisMajorTicks
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function buildAxisMinorTicks(axisBuilder, axisModel, opt) { var axis = axisModel.axis; var minorTickModel = axisModel.getModel('minorTick'); if (!minorTickModel.get('show') || axis.scale.isBlank()) { return; } var minorTicksCoords = axis.getMinorTicksCoords(); if (!minorTicksCoords.length) { return; } var lineStyleModel = minorTickModel.getModel('lineStyle'); var tickEndCoord = opt.tickDirection * minorTickModel.get('length'); var minorTickLineStyle = defaults( lineStyleModel.getLineStyle(), defaults( axisModel.getModel('axisTick').getLineStyle(), { stroke: axisModel.get('axisLine.lineStyle.color') } ) ); for (var i = 0; i < minorTicksCoords.length; i++) { var minorTicksEls = createTicks( minorTicksCoords[i], axisBuilder._transform, tickEndCoord, minorTickLineStyle, 'minorticks_' + i ); for (var k = 0; k < minorTicksEls.length; k++) { axisBuilder.group.add(minorTicksEls[k]); } } }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
buildAxisMinorTicks
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function buildAxisLabel(axisBuilder, axisModel, opt) { var axis = axisModel.axis; var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show')); if (!show || axis.scale.isBlank()) { return; } var labelModel = axisModel.getModel('axisLabel'); var labelMargin = labelModel.get('margin'); var labels = axis.getViewLabels(); // Special label rotate. var labelRotation = ( retrieve(opt.labelRotate, labelModel.get('rotate')) || 0 ) * PI$2 / 180; var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection); var rawCategoryData = axisModel.getCategories && axisModel.getCategories(true); var labelEls = []; var silent = isLabelSilent(axisModel); var triggerEvent = axisModel.get('triggerEvent'); each$1(labels, function (labelItem, index) { var tickValue = labelItem.tickValue; var formattedLabel = labelItem.formattedLabel; var rawLabel = labelItem.rawLabel; var itemLabelModel = labelModel; if (rawCategoryData && rawCategoryData[tickValue] && rawCategoryData[tickValue].textStyle) { itemLabelModel = new Model( rawCategoryData[tickValue].textStyle, labelModel, axisModel.ecModel ); } var textColor = itemLabelModel.getTextColor() || axisModel.get('axisLine.lineStyle.color'); var tickCoord = axis.dataToCoord(tickValue); var pos = [ tickCoord, opt.labelOffset + opt.labelDirection * labelMargin ]; var textEl = new Text({ // Id for animation anid: 'label_' + tickValue, position: pos, rotation: labelLayout.rotation, silent: silent, z2: 10 }); setTextStyle(textEl.style, itemLabelModel, { text: formattedLabel, textAlign: itemLabelModel.getShallow('align', true) || labelLayout.textAlign, textVerticalAlign: itemLabelModel.getShallow('verticalAlign', true) || itemLabelModel.getShallow('baseline', true) || labelLayout.textVerticalAlign, textFill: typeof textColor === 'function' ? textColor( // (1) In category axis with data zoom, tick is not the original // index of axis.data. So tick should not be exposed to user // in category axis. // (2) Compatible with previous version, which always use formatted label as // input. But in interval scale the formatted label is like '223,445', which // maked user repalce ','. So we modify it to return original val but remain // it as 'string' to avoid error in replacing. axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue, index ) : textColor }); // Pack data for mouse event if (triggerEvent) { textEl.eventData = makeAxisEventDataBase(axisModel); textEl.eventData.targetType = 'axisLabel'; textEl.eventData.value = rawLabel; } // FIXME axisBuilder._dumbGroup.add(textEl); textEl.updateTransform(); labelEls.push(textEl); axisBuilder.group.add(textEl); textEl.decomposeTransform(); }); return labelEls; }
@public @static @param {Object} opt @param {number} axisRotation in radian @param {number} textRotation in radian @param {number} direction @return {Object} { rotation, // according to axis textAlign, textVerticalAlign }
buildAxisLabel
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getAxisInfo(axisModel) { var coordSysAxesInfo = (axisModel.ecModel.getComponent('axisPointer') || {}).coordSysAxesInfo; return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)]; }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
getAxisInfo
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getAxisPointerModel(axisModel) { var axisInfo = getAxisInfo(axisModel); return axisInfo && axisInfo.axisPointerModel; }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
getAxisPointerModel
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isHandleTrigger(axisPointerModel) { return !!axisPointerModel.get('handle.show'); }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
isHandleTrigger
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function makeKey(model) { return model.type + '||' + model.id; }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
makeKey
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function updateAxisPointer(axisView, axisModel, ecModel, api, payload, forceRender) { var Clazz = AxisView.getAxisPointerClass(axisView.axisPointerClass); if (!Clazz) { return; } var axisPointerModel = getAxisPointerModel(axisModel); axisPointerModel ? (axisView._axisPointer || (axisView._axisPointer = new Clazz())) .render(axisModel, axisPointerModel, api, forceRender) : disposeAxisPointer(axisView, api); }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
updateAxisPointer
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function disposeAxisPointer(axisView, ecModel, api) { var axisPointer = axisView._axisPointer; axisPointer && axisPointer.dispose(ecModel, api); axisView._axisPointer = null; }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
disposeAxisPointer
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function layout$1(gridModel, axisModel, opt) { opt = opt || {}; var grid = gridModel.coordinateSystem; var axis = axisModel.axis; var layout = {}; var otherAxisOnZeroOf = axis.getAxesOnZeroOf()[0]; var rawAxisPosition = axis.position; var axisPosition = otherAxisOnZeroOf ? 'onZero' : rawAxisPosition; var axisDim = axis.dim; var rect = grid.getRect(); var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height]; var idx = {left: 0, right: 1, top: 0, bottom: 1, onZero: 2}; var axisOffset = axisModel.get('offset') || 0; var posBound = axisDim === 'x' ? [rectBound[2] - axisOffset, rectBound[3] + axisOffset] : [rectBound[0] - axisOffset, rectBound[1] + axisOffset]; if (otherAxisOnZeroOf) { var onZeroCoord = otherAxisOnZeroOf.toGlobalCoord(otherAxisOnZeroOf.dataToCoord(0)); posBound[idx.onZero] = Math.max(Math.min(onZeroCoord, posBound[1]), posBound[0]); } // Axis position layout.position = [ axisDim === 'y' ? posBound[idx[axisPosition]] : rectBound[0], axisDim === 'x' ? posBound[idx[axisPosition]] : rectBound[3] ]; // Axis rotation layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1); // Tick and label direction, x y is axisDim var dirMap = {top: -1, bottom: 1, left: -1, right: 1}; layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition]; layout.labelOffset = otherAxisOnZeroOf ? posBound[idx[rawAxisPosition]] - posBound[idx.onZero] : 0; if (axisModel.get('axisTick.inside')) { layout.tickDirection = -layout.tickDirection; } if (retrieve(opt.labelInside, axisModel.get('axisLabel.inside'))) { layout.labelDirection = -layout.labelDirection; } // Special label rotation var labelRotate = axisModel.get('axisLabel.rotate'); layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate; // Over splitLine and splitArea layout.z2 = 1; return layout; }
Can only be called after coordinate system creation stage. (Can be called before coordinate system update stage). @param {Object} opt {labelInside} @return {Object} { position, rotation, labelDirection, labelOffset, tickDirection, labelRotate, z2 }
layout$1
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) { var axis = axisModel.axis; if (axis.scale.isBlank()) { return; } var splitAreaModel = axisModel.getModel('splitArea'); var areaStyleModel = splitAreaModel.getModel('areaStyle'); var areaColors = areaStyleModel.get('color'); var gridRect = gridModel.coordinateSystem.getRect(); var ticksCoords = axis.getTicksCoords({ tickModel: splitAreaModel, clamp: true }); if (!ticksCoords.length) { return; } // For Making appropriate splitArea animation, the color and anid // should be corresponding to previous one if possible. var areaColorsLen = areaColors.length; var lastSplitAreaColors = axisView.__splitAreaColors; var newSplitAreaColors = createHashMap(); var colorIndex = 0; if (lastSplitAreaColors) { for (var i = 0; i < ticksCoords.length; i++) { var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue); if (cIndex != null) { colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen; break; } } } var prev = axis.toGlobalCoord(ticksCoords[0].coord); var areaStyle = areaStyleModel.getAreaStyle(); areaColors = isArray(areaColors) ? areaColors : [areaColors]; for (var i = 1; i < ticksCoords.length; i++) { var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord); var x; var y; var width; var height; if (axis.isHorizontal()) { x = prev; y = gridRect.y; width = tickCoord - x; height = gridRect.height; prev = x + width; } else { x = gridRect.x; y = prev; width = gridRect.width; height = tickCoord - y; prev = y + height; } var tickValue = ticksCoords[i - 1].tickValue; tickValue != null && newSplitAreaColors.set(tickValue, colorIndex); axisGroup.add(new Rect({ anid: tickValue != null ? 'area_' + tickValue : null, shape: { x: x, y: y, width: width, height: height }, style: defaults({ fill: areaColors[colorIndex] }, areaStyle), silent: true })); colorIndex = (colorIndex + 1) % areaColorsLen; } axisView.__splitAreaColors = newSplitAreaColors; }
@param {module:echarts/coord/cartesian/AxisModel} axisModel @param {module:echarts/coord/cartesian/GridModel} gridModel @private
rectCoordAxisBuildSplitArea
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function rectCoordAxisHandleRemove(axisView) { axisView.__splitAreaColors = null; }
@param {module:echarts/coord/cartesian/AxisModel} axisModel @param {module:echarts/coord/cartesian/GridModel} gridModel @private
rectCoordAxisHandleRemove
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function setLabel( normalStyle, hoverStyle, itemModel, color, seriesModel, dataIndex, labelPositionOutside ) { var labelModel = itemModel.getModel('label'); var hoverLabelModel = itemModel.getModel('emphasis.label'); setLabelStyle( normalStyle, hoverStyle, labelModel, hoverLabelModel, { labelFetcher: seriesModel, labelDataIndex: dataIndex, defaultText: getDefaultLabel(seriesModel.getData(), dataIndex), isRectText: true, autoColor: color } ); fixPosition(normalStyle); fixPosition(hoverStyle); }
Sausage: similar to sector, but have half circle on both sides @public
setLabel
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function fixPosition(style, labelPositionOutside) { if (style.textPosition === 'outside') { style.textPosition = labelPositionOutside; } }
Sausage: similar to sector, but have half circle on both sides @public
fixPosition
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getClipArea(coord, data) { var coordSysClipArea = coord.getArea && coord.getArea(); if (coord.type === 'cartesian2d') { var baseAxis = coord.getBaseAxis(); // When boundaryGap is false or using time axis. bar may exceed the grid. // We should not clip this part. // See test/bar2.html if (baseAxis.type !== 'category' || !baseAxis.onBand) { var expandWidth = data.getLayout('bandWidth'); if (baseAxis.isHorizontal()) { coordSysClipArea.x -= expandWidth; coordSysClipArea.width += expandWidth * 2; } else { coordSysClipArea.y -= expandWidth; coordSysClipArea.height += expandWidth * 2; } } } return coordSysClipArea; }
Sausage: similar to sector, but have half circle on both sides @public
getClipArea
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function removeRect(dataIndex, animationModel, el) { // Not show text when animating el.style.text = null; updateProps(el, { shape: { width: 0 } }, animationModel, dataIndex, function () { el.parent && el.parent.remove(el); }); }
Sausage: similar to sector, but have half circle on both sides @public
removeRect
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function removeSector(dataIndex, animationModel, el) { // Not show text when animating el.style.text = null; updateProps(el, { shape: { r: el.shape.r0 } }, animationModel, dataIndex, function () { el.parent && el.parent.remove(el); }); }
Sausage: similar to sector, but have half circle on both sides @public
removeSector
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isZeroOnPolar(layout) { return layout.startAngle != null && layout.endAngle != null && layout.startAngle === layout.endAngle; }
Sausage: similar to sector, but have half circle on both sides @public
isZeroOnPolar
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function updateStyle( el, data, dataIndex, itemModel, layout, seriesModel, isHorizontal, isPolar ) { var color = data.getItemVisual(dataIndex, 'color'); var opacity = data.getItemVisual(dataIndex, 'opacity'); var stroke = data.getVisual('borderColor'); var itemStyleModel = itemModel.getModel('itemStyle'); var hoverStyle = itemModel.getModel('emphasis.itemStyle').getBarItemStyle(); if (!isPolar) { el.setShape('r', itemStyleModel.get('barBorderRadius') || 0); } el.useStyle(defaults( { stroke: isZeroOnPolar(layout) ? 'none' : stroke, fill: isZeroOnPolar(layout) ? 'none' : color, opacity: opacity }, itemStyleModel.getBarItemStyle() )); var cursorStyle = itemModel.getShallow('cursor'); cursorStyle && el.attr('cursor', cursorStyle); var labelPositionOutside = isHorizontal ? (layout.height > 0 ? 'bottom' : 'top') : (layout.width > 0 ? 'left' : 'right'); if (!isPolar) { setLabel( el.style, hoverStyle, itemModel, color, seriesModel, dataIndex, labelPositionOutside ); } if (isZeroOnPolar(layout)) { hoverStyle.fill = hoverStyle.stroke = 'none'; } setHoverStyle(el, hoverStyle); }
Sausage: similar to sector, but have half circle on both sides @public
updateStyle
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getLineWidth(itemModel, rawLayout) { var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0; // width or height may be NaN for empty data var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width); var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height); return Math.min(lineWidth, width, height); }
Sausage: similar to sector, but have half circle on both sides @public
getLineWidth
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function createLarge(seriesModel, group, incremental) { // TODO support polar var data = seriesModel.getData(); var startPoint = []; var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0; startPoint[1 - baseDimIdx] = data.getLayout('valueAxisStart'); var largeDataIndices = data.getLayout('largeDataIndices'); var barWidth = data.getLayout('barWidth'); var backgroundModel = seriesModel.getModel('backgroundStyle'); var drawBackground = seriesModel.get('showBackground', true); if (drawBackground) { var points = data.getLayout('largeBackgroundPoints'); var backgroundStartPoint = []; backgroundStartPoint[1 - baseDimIdx] = data.getLayout('backgroundStart'); var bgEl = new LargePath({ shape: {points: points}, incremental: !!incremental, __startPoint: backgroundStartPoint, __baseDimIdx: baseDimIdx, __largeDataIndices: largeDataIndices, __barWidth: barWidth, silent: true, z2: 0 }); setLargeBackgroundStyle(bgEl, backgroundModel, data); group.add(bgEl); } var el = new LargePath({ shape: {points: data.getLayout('largePoints')}, incremental: !!incremental, __startPoint: startPoint, __baseDimIdx: baseDimIdx, __largeDataIndices: largeDataIndices, __barWidth: barWidth }); group.add(el); setLargeStyle(el, seriesModel, data); // Enable tooltip and user mouse/touch event handlers. el.seriesIndex = seriesModel.seriesIndex; if (!seriesModel.get('silent')) { el.on('mousedown', largePathUpdateDataIndex); el.on('mousemove', largePathUpdateDataIndex); } }
Sausage: similar to sector, but have half circle on both sides @public
createLarge
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function largePathFindDataIndex(largePath, x, y) { var baseDimIdx = largePath.__baseDimIdx; var valueDimIdx = 1 - baseDimIdx; var points = largePath.shape.points; var largeDataIndices = largePath.__largeDataIndices; var barWidthHalf = Math.abs(largePath.__barWidth / 2); var startValueVal = largePath.__startPoint[valueDimIdx]; _eventPos[0] = x; _eventPos[1] = y; var pointerBaseVal = _eventPos[baseDimIdx]; var pointerValueVal = _eventPos[1 - baseDimIdx]; var baseLowerBound = pointerBaseVal - barWidthHalf; var baseUpperBound = pointerBaseVal + barWidthHalf; for (var i = 0, len = points.length / 2; i < len; i++) { var ii = i * 2; var barBaseVal = points[ii + baseDimIdx]; var barValueVal = points[ii + valueDimIdx]; if ( barBaseVal >= baseLowerBound && barBaseVal <= baseUpperBound && ( startValueVal <= barValueVal ? (pointerValueVal >= startValueVal && pointerValueVal <= barValueVal) : (pointerValueVal >= barValueVal && pointerValueVal <= startValueVal) ) ) { return largeDataIndices[i]; } } return -1; }
[Usage]: (1) createListSimply(seriesModel, ['value']); (2) createListSimply(seriesModel, { coordDimensions: ['value'], dimensionsCount: 5 }); @param {module:echarts/model/Series} seriesModel @param {Object|Array.<string|Object>} opt opt or coordDimensions The options in opt, see `echarts/data/helper/createDimensions` @param {Array.<string>} [nameList] @return {module:echarts/data/List}
largePathFindDataIndex
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function setLargeStyle(el, seriesModel, data) { var borderColor = data.getVisual('borderColor') || data.getVisual('color'); var itemStyle = seriesModel.getModel('itemStyle').getItemStyle(['color', 'borderColor']); el.useStyle(itemStyle); el.style.fill = null; el.style.stroke = borderColor; el.style.lineWidth = data.getLayout('barWidth'); }
@param {Array.<Object>} targetList [{name, value, selected}, ...] If targetList is an array, it should like [{name: ..., value: ...}, ...]. If targetList is a "List", it must have coordDim: 'value' dimension and name.
setLargeStyle
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function setLargeBackgroundStyle(el, backgroundModel, data) { var borderColor = backgroundModel.get('borderColor') || backgroundModel.get('color'); var itemStyle = backgroundModel.getItemStyle(['color', 'borderColor']); el.useStyle(itemStyle); el.style.fill = null; el.style.stroke = borderColor; el.style.lineWidth = data.getLayout('barWidth'); }
@param {Array.<Object>} targetList [{name, value, selected}, ...] If targetList is an array, it should like [{name: ..., value: ...}, ...]. If targetList is a "List", it must have coordDim: 'value' dimension and name.
setLargeBackgroundStyle
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function createBackgroundShape(isHorizontalOrRadial, layout, coord) { var coordLayout; var isPolar = coord.type === 'polar'; if (isPolar) { coordLayout = coord.getArea(); } else { coordLayout = coord.grid.getRect(); } if (isPolar) { return { cx: coordLayout.cx, cy: coordLayout.cy, r0: isHorizontalOrRadial ? coordLayout.r0 : layout.r0, r: isHorizontalOrRadial ? coordLayout.r : layout.r, startAngle: isHorizontalOrRadial ? layout.startAngle : 0, endAngle: isHorizontalOrRadial ? layout.endAngle : Math.PI * 2 }; } else { return { x: isHorizontalOrRadial ? layout.x : coordLayout.x, y: isHorizontalOrRadial ? coordLayout.y : layout.y, width: isHorizontalOrRadial ? layout.width : coordLayout.width, height: isHorizontalOrRadial ? coordLayout.height : layout.height }; } }
Either name or id should be passed as input here. If both of them are defined, id is used. @param {string|undefined} name name of data @param {number|undefined} id dataIndex of data
createBackgroundShape
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function createBackgroundEl(coord, isHorizontalOrRadial, layout) { var ElementClz = coord.type === 'polar' ? Sector : Rect; return new ElementClz({ shape: createBackgroundShape(isHorizontalOrRadial, layout, coord), silent: true, z2: 0 }); }
Either name or id should be passed as input here. If both of them are defined, id is used. @param {string|undefined} name name of data @param {number|undefined} id dataIndex of data
createBackgroundEl
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
createListSimply = function (seriesModel, opt, nameList) { opt = isArray(opt) && {coordDimensions: opt} || extend({}, opt); var source = seriesModel.getSource(); var dimensionsInfo = createDimensions(source, opt); var list = new List(dimensionsInfo, seriesModel); list.initData(source, nameList); return list; }
LegendVisualProvider is an bridge that pick encoded color from data and provide to the legend component. @param {Function} getDataWithEncodedVisual Function to get data after filtered. It stores all the encoding info @param {Function} getRawData Function to get raw data before filtered.
createListSimply
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function LegendVisualProvider(getDataWithEncodedVisual, getRawData) { this.getAllNames = function () { var rawData = getRawData(); // We find the name from the raw data. In case it's filtered by the legend component. // Normally, the name can be found in rawData, but can't be found in filtered data will display as gray. return rawData.mapArray(rawData.getName); }; this.containName = function (name) { var rawData = getRawData(); return rawData.indexOfName(name) >= 0; }; this.indexOfName = function (name) { // Only get data when necessary. // Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet. // Invoking Series#getData immediately will throw an error. var dataWithEncodedVisual = getDataWithEncodedVisual(); return dataWithEncodedVisual.indexOfName(name); }; this.getItemVisual = function (dataIndex, key) { // Get encoded visual properties from final filtered data. var dataWithEncodedVisual = getDataWithEncodedVisual(); return dataWithEncodedVisual.getItemVisual(dataIndex, key); }; }
LegendVisualProvider is an bridge that pick encoded color from data and provide to the legend component. @param {Function} getDataWithEncodedVisual Function to get data after filtered. It stores all the encoding info @param {Function} getRawData Function to get raw data before filtered.
LegendVisualProvider
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function updateDataSelected(uid, seriesModel, hasAnimation, api) { var data = seriesModel.getData(); var dataIndex = this.dataIndex; var name = data.getName(dataIndex); var selectedOffset = seriesModel.get('selectedOffset'); api.dispatchAction({ type: 'pieToggleSelect', from: uid, name: name, seriesId: seriesModel.id }); data.each(function (idx) { toggleItemSelected( data.getItemGraphicEl(idx), data.getItemLayout(idx), seriesModel.isSelected(data.getName(idx)), selectedOffset, hasAnimation ); }); }
Piece of pie including Sector, Label, LabelLine @constructor @extends {module:zrender/graphic/Group}
updateDataSelected
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function toggleItemSelected(el, layout, isSelected, selectedOffset, hasAnimation) { var midAngle = (layout.startAngle + layout.endAngle) / 2; var dx = Math.cos(midAngle); var dy = Math.sin(midAngle); var offset = isSelected ? selectedOffset : 0; var position = [dx * offset, dy * offset]; hasAnimation // animateTo will stop revious animation like update transition ? el.animate() .when(200, { position: position }) .start('bounceOut') : el.attr('position', position); }
Piece of pie including Sector, Label, LabelLine @constructor @extends {module:zrender/graphic/Group}
toggleItemSelected
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function PiePiece(data, idx) { Group.call(this); var sector = new Sector({ z2: 2 }); var polyline = new Polyline(); var text = new Text(); this.add(sector); this.add(polyline); this.add(text); this.updateData(data, idx, true); }
Piece of pie including Sector, Label, LabelLine @constructor @extends {module:zrender/graphic/Group}
PiePiece
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
createDataSelectAction = function (seriesType, actionInfos) { each$1(actionInfos, function (actionInfo) { actionInfo.update = 'updateView'; /** * @payload * @property {string} seriesName * @property {string} name */ registerAction(actionInfo, function (payload, ecModel) { var selected = {}; ecModel.eachComponent( {mainType: 'series', subType: seriesType, query: payload}, function (seriesModel) { if (seriesModel[actionInfo.method]) { seriesModel[actionInfo.method]( payload.name, payload.dataIndex ); } var data = seriesModel.getData(); // Create selected map data.each(function (idx) { var name = data.getName(idx); selected[name] = seriesModel.isSelected(name) || false; }); } ); return { name: payload.name, selected: selected, seriesId: payload.seriesId }; }); }); }
@payload @property {string} seriesName @property {string} name
createDataSelectAction
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
dataColor = function (seriesType) { return { getTargetSeries: function (ecModel) { // Pie and funnel may use diferrent scope var paletteScope = {}; var seiresModelMap = createHashMap(); ecModel.eachSeriesByType(seriesType, function (seriesModel) { seriesModel.__paletteScope = paletteScope; seiresModelMap.set(seriesModel.uid, seriesModel); }); return seiresModelMap; }, reset: function (seriesModel, ecModel) { var dataAll = seriesModel.getRawData(); var idxMap = {}; var data = seriesModel.getData(); data.each(function (idx) { var rawIdx = data.getRawIndex(idx); idxMap[rawIdx] = idx; }); dataAll.each(function (rawIdx) { var filteredIdx = idxMap[rawIdx]; // If series.itemStyle.normal.color is a function. itemVisual may be encoded var singleDataColor = filteredIdx != null && data.getItemVisual(filteredIdx, 'color', true); var singleDataBorderColor = filteredIdx != null && data.getItemVisual(filteredIdx, 'borderColor', true); var itemModel; if (!singleDataColor || !singleDataBorderColor) { // FIXME Performance itemModel = dataAll.getItemModel(rawIdx); } if (!singleDataColor) { var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette( dataAll.getName(rawIdx) || (rawIdx + ''), seriesModel.__paletteScope, dataAll.count() ); // Data is not filtered if (filteredIdx != null) { data.setItemVisual(filteredIdx, 'color', color); } } if (!singleDataBorderColor) { var borderColor = itemModel.get('itemStyle.borderColor'); // Data is not filtered if (filteredIdx != null) { data.setItemVisual(filteredIdx, 'borderColor', borderColor); } } }); } }; }
@payload @property {string} seriesName @property {string} name
dataColor
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft, viewTop, farthestX) { list.sort(function (a, b) { return a.y - b.y; }); function shiftDown(start, end, delta, dir) { for (var j = start; j < end; j++) { if (list[j].y + delta > viewTop + viewHeight) { break; } list[j].y += delta; if (j > start && j + 1 < end && list[j + 1].y > list[j].y + list[j].height ) { shiftUp(j, delta / 2); return; } } shiftUp(end - 1, delta / 2); } function shiftUp(end, delta) { for (var j = end; j >= 0; j--) { if (list[j].y - delta < viewTop) { break; } list[j].y -= delta; if (j > 0 && list[j].y > list[j - 1].y + list[j - 1].height ) { break; } } } function changeX(list, isDownList, cx, cy, r, dir) { var lastDeltaX = dir > 0 ? isDownList // right-side ? Number.MAX_VALUE // down : 0 // up : isDownList // left-side ? Number.MAX_VALUE // down : 0; // up for (var i = 0, l = list.length; i < l; i++) { if (list[i].labelAlignTo !== 'none') { continue; } var deltaY = Math.abs(list[i].y - cy); var length = list[i].len; var length2 = list[i].len2; var deltaX = (deltaY < r + length) ? Math.sqrt( (r + length + length2) * (r + length + length2) - deltaY * deltaY ) : Math.abs(list[i].x - cx); if (isDownList && deltaX >= lastDeltaX) { // right-down, left-down deltaX = lastDeltaX - 10; } if (!isDownList && deltaX <= lastDeltaX) { // right-up, left-up deltaX = lastDeltaX + 10; } list[i].x = cx + deltaX * dir; lastDeltaX = deltaX; } } var lastY = 0; var delta; var len = list.length; var upList = []; var downList = []; for (var i = 0; i < len; i++) { if (list[i].position === 'outer' && list[i].labelAlignTo === 'labelLine') { var dx = list[i].x - farthestX; list[i].linePoints[1][0] += dx; list[i].x = farthestX; } delta = list[i].y - lastY; if (delta < 0) { shiftDown(i, len, -delta, dir); } lastY = list[i].y + list[i].height; } if (viewHeight - lastY < 0) { shiftUp(len - 1, lastY - viewHeight); } for (var i = 0; i < len; i++) { if (list[i].y >= cy) { downList.push(list[i]); } else { upList.push(list[i]); } } changeX(upList, false, cx, cy, r, dir); changeX(downList, true, cx, cy, r, dir); }
@payload @property {string} seriesName @property {string} name
adjustSingleSide
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function shiftDown(start, end, delta, dir) { for (var j = start; j < end; j++) { if (list[j].y + delta > viewTop + viewHeight) { break; } list[j].y += delta; if (j > start && j + 1 < end && list[j + 1].y > list[j].y + list[j].height ) { shiftUp(j, delta / 2); return; } } shiftUp(end - 1, delta / 2); }
@payload @property {string} seriesName @property {string} name
shiftDown
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function shiftUp(end, delta) { for (var j = end; j >= 0; j--) { if (list[j].y - delta < viewTop) { break; } list[j].y -= delta; if (j > 0 && list[j].y > list[j - 1].y + list[j - 1].height ) { break; } } }
@payload @property {string} seriesName @property {string} name
shiftUp
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function changeX(list, isDownList, cx, cy, r, dir) { var lastDeltaX = dir > 0 ? isDownList // right-side ? Number.MAX_VALUE // down : 0 // up : isDownList // left-side ? Number.MAX_VALUE // down : 0; // up for (var i = 0, l = list.length; i < l; i++) { if (list[i].labelAlignTo !== 'none') { continue; } var deltaY = Math.abs(list[i].y - cy); var length = list[i].len; var length2 = list[i].len2; var deltaX = (deltaY < r + length) ? Math.sqrt( (r + length + length2) * (r + length + length2) - deltaY * deltaY ) : Math.abs(list[i].x - cx); if (isDownList && deltaX >= lastDeltaX) { // right-down, left-down deltaX = lastDeltaX - 10; } if (!isDownList && deltaX <= lastDeltaX) { // right-up, left-up deltaX = lastDeltaX + 10; } list[i].x = cx + deltaX * dir; lastDeltaX = deltaX; } }
@payload @property {string} seriesName @property {string} name
changeX
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop) { var leftList = []; var rightList = []; var leftmostX = Number.MAX_VALUE; var rightmostX = -Number.MAX_VALUE; for (var i = 0; i < labelLayoutList.length; i++) { if (isPositionCenter(labelLayoutList[i])) { continue; } if (labelLayoutList[i].x < cx) { leftmostX = Math.min(leftmostX, labelLayoutList[i].x); leftList.push(labelLayoutList[i]); } else { rightmostX = Math.max(rightmostX, labelLayoutList[i].x); rightList.push(labelLayoutList[i]); } } adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX); adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight, viewLeft, viewTop, leftmostX); for (var i = 0; i < labelLayoutList.length; i++) { var layout = labelLayoutList[i]; if (isPositionCenter(layout)) { continue; } var linePoints = layout.linePoints; if (linePoints) { var isAlignToEdge = layout.labelAlignTo === 'edge'; var realTextWidth = layout.textRect.width; var targetTextWidth; if (isAlignToEdge) { if (layout.x < cx) { targetTextWidth = linePoints[2][0] - layout.labelDistance - viewLeft - layout.labelMargin; } else { targetTextWidth = viewLeft + viewWidth - layout.labelMargin - linePoints[2][0] - layout.labelDistance; } } else { if (layout.x < cx) { targetTextWidth = layout.x - viewLeft - layout.bleedMargin; } else { targetTextWidth = viewLeft + viewWidth - layout.x - layout.bleedMargin; } } if (targetTextWidth < layout.textRect.width) { layout.text = truncateText(layout.text, targetTextWidth, layout.font); if (layout.labelAlignTo === 'edge') { realTextWidth = getWidth(layout.text, layout.font); } } var dist = linePoints[1][0] - linePoints[2][0]; if (isAlignToEdge) { if (layout.x < cx) { linePoints[2][0] = viewLeft + layout.labelMargin + realTextWidth + layout.labelDistance; } else { linePoints[2][0] = viewLeft + viewWidth - layout.labelMargin - realTextWidth - layout.labelDistance; } } else { if (layout.x < cx) { linePoints[2][0] = layout.x + layout.labelDistance; } else { linePoints[2][0] = layout.x - layout.labelDistance; } linePoints[1][0] = linePoints[2][0] + dist; } linePoints[1][1] = linePoints[2][1] = layout.y; } } }
@payload @property {string} seriesName @property {string} name
avoidOverlap
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function isPositionCenter(layout) { // Not change x for center label return layout.position === 'center'; }
@payload @property {string} seriesName @property {string} name
isPositionCenter
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
labelLayout = function (seriesModel, r, viewWidth, viewHeight, viewLeft, viewTop) { var data = seriesModel.getData(); var labelLayoutList = []; var cx; var cy; var hasLabelRotate = false; var minShowLabelRadian = (seriesModel.get('minShowLabelAngle') || 0) * RADIAN$1; data.each(function (idx) { var layout = data.getItemLayout(idx); var itemModel = data.getItemModel(idx); var labelModel = itemModel.getModel('label'); // Use position in normal or emphasis var labelPosition = labelModel.get('position') || itemModel.get('emphasis.label.position'); var labelDistance = labelModel.get('distanceToLabelLine'); var labelAlignTo = labelModel.get('alignTo'); var labelMargin = parsePercent$1(labelModel.get('margin'), viewWidth); var bleedMargin = labelModel.get('bleedMargin'); var font = labelModel.getFont(); var labelLineModel = itemModel.getModel('labelLine'); var labelLineLen = labelLineModel.get('length'); labelLineLen = parsePercent$1(labelLineLen, viewWidth); var labelLineLen2 = labelLineModel.get('length2'); labelLineLen2 = parsePercent$1(labelLineLen2, viewWidth); if (layout.angle < minShowLabelRadian) { return; } var midAngle = (layout.startAngle + layout.endAngle) / 2; var dx = Math.cos(midAngle); var dy = Math.sin(midAngle); var textX; var textY; var linePoints; var textAlign; cx = layout.cx; cy = layout.cy; var text = seriesModel.getFormattedLabel(idx, 'normal') || data.getName(idx); var textRect = getBoundingRect( text, font, textAlign, 'top' ); var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner'; if (labelPosition === 'center') { textX = layout.cx; textY = layout.cy; textAlign = 'center'; } else { var x1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dx : layout.r * dx) + cx; var y1 = (isLabelInside ? (layout.r + layout.r0) / 2 * dy : layout.r * dy) + cy; textX = x1 + dx * 3; textY = y1 + dy * 3; if (!isLabelInside) { // For roseType var x2 = x1 + dx * (labelLineLen + r - layout.r); var y2 = y1 + dy * (labelLineLen + r - layout.r); var x3 = x2 + ((dx < 0 ? -1 : 1) * labelLineLen2); var y3 = y2; if (labelAlignTo === 'edge') { // Adjust textX because text align of edge is opposite textX = dx < 0 ? viewLeft + labelMargin : viewLeft + viewWidth - labelMargin; } else { textX = x3 + (dx < 0 ? -labelDistance : labelDistance); } textY = y3; linePoints = [[x1, y1], [x2, y2], [x3, y3]]; } textAlign = isLabelInside ? 'center' : (labelAlignTo === 'edge' ? (dx > 0 ? 'right' : 'left') : (dx > 0 ? 'left' : 'right')); } var labelRotate; var rotate = labelModel.get('rotate'); if (typeof rotate === 'number') { labelRotate = rotate * (Math.PI / 180); } else { labelRotate = rotate ? (dx < 0 ? -midAngle + Math.PI : -midAngle) : 0; } hasLabelRotate = !!labelRotate; layout.label = { x: textX, y: textY, position: labelPosition, height: textRect.height, len: labelLineLen, len2: labelLineLen2, linePoints: linePoints, textAlign: textAlign, verticalAlign: 'middle', rotation: labelRotate, inside: isLabelInside, labelDistance: labelDistance, labelAlignTo: labelAlignTo, labelMargin: labelMargin, bleedMargin: bleedMargin, textRect: textRect, text: text, font: font }; // Not layout the inside label if (!isLabelInside) { labelLayoutList.push(layout.label); } }); if (!hasLabelRotate && seriesModel.get('avoidLabelOverlap')) { avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop); } }
@payload @property {string} seriesName @property {string} name
labelLayout
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function getViewRect(seriesModel, api) { return getLayoutRect( seriesModel.getBoxLayoutParams(), { width: api.getWidth(), height: api.getHeight() } ); }
@payload @property {string} seriesName @property {string} name
getViewRect
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
dataFilter = function (seriesType) { return { seriesType: seriesType, reset: function (seriesModel, ecModel) { var legendModels = ecModel.findComponents({ mainType: 'legend' }); if (!legendModels || !legendModels.length) { return; } var data = seriesModel.getData(); data.filterSelf(function (idx) { var name = data.getName(idx); // If in any legend component the status is not selected. for (var i = 0; i < legendModels.length; i++) { if (!legendModels[i].isSelected(name)) { return false; } } return true; }); } }; }
@payload @property {string} seriesName @property {string} name
dataFilter
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/echarts.simple.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/echarts.simple.js
Apache-2.0
function parse(xml) { var doc; if (typeof xml === 'string') { var parser = new DOMParser(); doc = parser.parseFromString(xml, 'text/xml'); } else { doc = xml; } if (!doc || doc.getElementsByTagName('parsererror').length) { return null; } var gexfRoot = getChildByTagName(doc, 'gexf'); if (!gexfRoot) { return null; } var graphRoot = getChildByTagName(gexfRoot, 'graph'); var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes')); var attributesMap = {}; for (var i = 0; i < attributes.length; i++) { attributesMap[attributes[i].id] = attributes[i]; } return { nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap), links: parseEdges(getChildByTagName(graphRoot, 'edges')) }; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
parse
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function parseAttributes(parent) { return parent ? map(getChildrenByTagName(parent, 'attribute'), function (attribDom) { return { id: getAttr(attribDom, 'id'), title: getAttr(attribDom, 'title'), type: getAttr(attribDom, 'type') }; }) : []; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
parseAttributes
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function parseNodes(parent, attributesMap) { return parent ? map(getChildrenByTagName(parent, 'node'), function (nodeDom) { var id = getAttr(nodeDom, 'id'); var label = getAttr(nodeDom, 'label'); var node = { id: id, name: label, itemStyle: { normal: {} } }; var vizSizeDom = getChildByTagName(nodeDom, 'viz:size'); var vizPosDom = getChildByTagName(nodeDom, 'viz:position'); var vizColorDom = getChildByTagName(nodeDom, 'viz:color'); // var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape'); var attvaluesDom = getChildByTagName(nodeDom, 'attvalues'); if (vizSizeDom) { node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value')); } if (vizPosDom) { node.x = parseFloat(getAttr(vizPosDom, 'x')); node.y = parseFloat(getAttr(vizPosDom, 'y')); // z } if (vizColorDom) { node.itemStyle.normal.color = 'rgb(' + [ getAttr(vizColorDom, 'r') | 0, getAttr(vizColorDom, 'g') | 0, getAttr(vizColorDom, 'b') | 0 ].join(',') + ')'; } // if (vizShapeDom) { // node.shape = getAttr(vizShapeDom, 'shape'); // } if (attvaluesDom) { var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue'); node.attributes = {}; for (var j = 0; j < attvalueDomList.length; j++) { var attvalueDom = attvalueDomList[j]; var attId = getAttr(attvalueDom, 'for'); var attValue = getAttr(attvalueDom, 'value'); var attribute = attributesMap[attId]; if (attribute) { switch (attribute.type) { case 'integer': case 'long': attValue = parseInt(attValue, 10); break; case 'float': case 'double': attValue = parseFloat(attValue); break; case 'boolean': attValue = attValue.toLowerCase() === 'true'; break; default: } node.attributes[attId] = attValue; } } } return node; }) : []; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
parseNodes
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function parseEdges(parent) { return parent ? map(getChildrenByTagName(parent, 'edge'), function (edgeDom) { var id = getAttr(edgeDom, 'id'); var label = getAttr(edgeDom, 'label'); var sourceId = getAttr(edgeDom, 'source'); var targetId = getAttr(edgeDom, 'target'); var edge = { id: id, name: label, source: sourceId, target: targetId, lineStyle: { normal: {} } }; var lineStyle = edge.lineStyle.normal; var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness'); var vizColorDom = getChildByTagName(edgeDom, 'viz:color'); // var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape'); if (vizThicknessDom) { lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value')); } if (vizColorDom) { lineStyle.color = 'rgb(' + [ getAttr(vizColorDom, 'r') | 0, getAttr(vizColorDom, 'g') | 0, getAttr(vizColorDom, 'b') | 0 ].join(',') + ')'; } // if (vizShapeDom) { // edge.shape = vizShapeDom.getAttribute('shape'); // } return edge; }) : []; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
parseEdges
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function getAttr(el, attrName) { return el.getAttribute(attrName); }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
getAttr
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function getChildByTagName(parent, tagName) { var node = parent.firstChild; while (node) { if ( node.nodeType !== 1 || node.nodeName.toLowerCase() !== tagName.toLowerCase() ) { node = node.nextSibling; } else { return node; } } return null; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
getChildByTagName
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function getChildrenByTagName(parent, tagName) { var node = parent.firstChild; var children = []; while (node) { if (node.nodeName.toLowerCase() === tagName.toLowerCase()) { children.push(node); } node = node.nextSibling; } return children; }
This is a parse of GEXF. The spec of GEXF: https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
getChildrenByTagName
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function asc(arr) { arr.sort(function (a, b) { return a - b; }); return arr; }
asc sort arr. The input arr will be modified. @param {Array} arr @return {Array} The input arr.
asc
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
prepareBoxplotData = function (rawData, opt) { opt = opt || []; var boxData = []; var outliers = []; var axisData = []; var boundIQR = opt.boundIQR; var useExtreme = boundIQR === 'none' || boundIQR === 0; for (var i = 0; i < rawData.length; i++) { axisData.push(i + ''); var ascList = asc(rawData[i].slice()); var Q1 = quantile(ascList, 0.25); var Q2 = quantile(ascList, 0.5); var Q3 = quantile(ascList, 0.75); var min = ascList[0]; var max = ascList[ascList.length - 1]; var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1); var low = useExtreme ? min : Math.max(min, Q1 - bound); var high = useExtreme ? max : Math.min(max, Q3 + bound); boxData.push([low, Q1, Q2, Q3, high]); for (var j = 0; j < ascList.length; j++) { var dataItem = ascList[j]; if (dataItem < low || dataItem > high) { var outlier = [i, dataItem]; opt.layout === 'vertical' && outlier.reverse(); outliers.push(outlier); } } } return { boxData: boxData, outliers: outliers, axisData: axisData }; }
See: <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2> <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html> Helper method for preparing data. @param {Array.<number>} rawData like [ [12,232,443], (raw data set for the first box) [3843,5545,1232], (raw datat set for the second box) ... ] @param {Object} [opt] @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier. default 1.5, means Q1 - 1.5 * (Q3 - Q1). If 'none'/0 passed, min bound will not be used. @param {(number|string)} [opt.layout='horizontal'] Box plot layout, can be 'horizontal' or 'vertical' @return {Object} { boxData: Array.<Array.<number>> outliers: Array.<Array.<number>> axisData: Array.<string> }
prepareBoxplotData
javascript
douyu/juno
assets/public/js/echarts/v4.7.0/extension/dataTool.js
https://github.com/douyu/juno/blob/master/assets/public/js/echarts/v4.7.0/extension/dataTool.js
Apache-2.0
function markFunction( fn ) { fn[ expando ] = true; return fn; }
Mark a function for special use by Sizzle @param {Function} fn The function to mark
markFunction
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function assert( fn ) { var el = document.createElement("fieldset"); try { return !!fn( el ); } catch (e) { return false; } finally { // Remove from its parent by default if ( el.parentNode ) { el.parentNode.removeChild( el ); } // release memory in IE el = null; } }
Support testing using an element @param {Function} fn Passed the created element and returns a boolean result
assert
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = arr.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } }
Adds the same handler for all of the specified attrs @param {String} attrs Pipe-separated list of attributes @param {Function} handler The method that will be applied
addHandle
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex; // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; }
Checks document order of two siblings @param {Element} a @param {Element} b @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
siblingCheck
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; }
Returns a function to use in pseudos for input types @param {String} type
createInputPseudo
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; }
Returns a function to use in pseudos for buttons @param {String} type
createButtonPseudo
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function createDisabledPseudo( disabled ) { // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable return function( elem ) { // Only certain elements can match :enabled or :disabled // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled if ( "form" in elem ) { // Check for inherited disabledness on relevant non-disabled elements: // * listed form-associated elements in a disabled fieldset // https://html.spec.whatwg.org/multipage/forms.html#category-listed // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled // * option elements in a disabled optgroup // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled // All such elements have a "form" property. if ( elem.parentNode && elem.disabled === false ) { // Option elements defer to a parent optgroup if present if ( "label" in elem ) { if ( "label" in elem.parentNode ) { return elem.parentNode.disabled === disabled; } else { return elem.disabled === disabled; } } // Support: IE 6 - 11 // Use the isDisabled shortcut property to check for disabled fieldset ancestors return elem.isDisabled === disabled || // Where there is no isDisabled, check manually /* jshint -W018 */ elem.isDisabled !== !disabled && inDisabledFieldset( elem ) === disabled; } return elem.disabled === disabled; // Try to winnow out elements that can't be disabled before trusting the disabled property. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't // even exist on them, let alone have a boolean value. } else if ( "label" in elem ) { return elem.disabled === disabled; } // Remaining elements are neither :enabled nor :disabled return false; }; }
Returns a function to use in pseudos for :enabled/:disabled @param {Boolean} disabled true for :disabled; false for :enabled
createDisabledPseudo
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); }
Returns a function to use in pseudos for positionals @param {Function} fn
createPositionalPseudo
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; }
Checks a node for validity as a Sizzle context @param {Element|Object=} context @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
testContext
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
toSelector
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } return false; } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); if ( skip && skip === elem.nodeName.toLowerCase() ) { elem = elem[ dir ] || elem; } else if ( (oldCache = uniqueCache[ key ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements uniqueCache[ key ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } return false; }; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
addCombinator
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
elementMatcher
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
multipleContexts
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
condense
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
setMatcher
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
matcherFromTokens
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
matcherFromGroupMatchers
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
superMatcher
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
dir = function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
dir
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
siblings = function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
siblings
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function nodeName( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
nodeName
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function winnow( elements, qualifier, not ) { if ( isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { return !!qualifier.call( elem, i, elem ) !== not; } ); } // Single element if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } // Arraylike of elements (jQuery, arguments, Array) if ( typeof qualifier !== "string" ) { return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not; } ); } // Filtered directly for both simple and complex selectors return jQuery.filter( qualifier, elements, not ); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
winnow
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function sibling( cur, dir ) { while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} return cur; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
sibling
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function createOptions( options ) { var object = {}; jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
createOptions
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
fire = function() { // Enforce single-firing locked = locked || options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes fired = firing = true; for ( ; queue.length; firingIndex = -1 ) { memory = queue.shift(); while ( ++firingIndex < list.length ) { // Run callback and check for early termination if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && options.stopOnFalse ) { // Jump to end and forget the data so .add doesn't re-fire firingIndex = list.length; memory = false; } } } // Forget the data if we're done with it if ( !options.memory ) { memory = false; } firing = false; // Clean up if we're done firing for good if ( locked ) { // Keep an empty list if we have data for future add calls if ( memory ) { list = []; // Otherwise, this object is spent } else { list = ""; } } }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
fire
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function Identity( v ) { return v; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
Identity
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function Thrower( ex ) { throw ex; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
Thrower
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function adoptValue( value, resolve, reject, noValue ) { var method; try { // Check for promise aspect first to privilege synchronous behavior if ( value && isFunction( ( method = value.promise ) ) ) { method.call( value ).done( resolve ).fail( reject ); // Other thenables } else if ( value && isFunction( ( method = value.then ) ) ) { method.call( value, resolve, reject ); // Other non-thenables } else { // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: // * false: [ value ].slice( 0 ) => resolve( value ) // * true: [ value ].slice( 1 ) => resolve() resolve.apply( undefined, [ value ].slice( noValue ) ); } // For Promises/A+, convert exceptions into rejections // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in // Deferred#then to conditionally suppress rejection. } catch ( value ) { // Support: Android 4.0 only // Strict mode functions invoked without .call/.apply get global-object context reject.apply( undefined, [ value ] ); } }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
adoptValue
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function resolve( depth, deferred, handler, special ) { return function() { var that = this, args = arguments, mightThrow = function() { var returned, then; // Support: Promises/A+ section 2.3.3.3.3 // https://promisesaplus.com/#point-59 // Ignore double-resolution attempts if ( depth < maxDepth ) { return; } returned = handler.apply( that, args ); // Support: Promises/A+ section 2.3.1 // https://promisesaplus.com/#point-48 if ( returned === deferred.promise() ) { throw new TypeError( "Thenable self-resolution" ); } // Support: Promises/A+ sections 2.3.3.1, 3.5 // https://promisesaplus.com/#point-54 // https://promisesaplus.com/#point-75 // Retrieve `then` only once then = returned && // Support: Promises/A+ section 2.3.4 // https://promisesaplus.com/#point-64 // Only check objects and functions for thenability ( typeof returned === "object" || typeof returned === "function" ) && returned.then; // Handle a returned thenable if ( isFunction( then ) ) { // Special processors (notify) just wait for resolution if ( special ) { then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ) ); // Normal processors (resolve) also hook into progress } else { // ...and disregard older resolution values maxDepth++; then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ), resolve( maxDepth, deferred, Identity, deferred.notifyWith ) ); } // Handle all other returned values } else { // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Identity ) { that = undefined; args = [ returned ]; } // Process the value(s) // Default process is resolve ( special || deferred.resolveWith )( that, args ); } }, // Only normal processors (resolve) catch and reject exceptions process = special ? mightThrow : function() { try { mightThrow(); } catch ( e ) { if ( jQuery.Deferred.exceptionHook ) { jQuery.Deferred.exceptionHook( e, process.stackTrace ); } // Support: Promises/A+ section 2.3.3.3.4.1 // https://promisesaplus.com/#point-61 // Ignore post-resolution exceptions if ( depth + 1 >= maxDepth ) { // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Thrower ) { that = undefined; args = [ e ]; } deferred.rejectWith( that, args ); } } }; // Support: Promises/A+ section 2.3.3.3.1 // https://promisesaplus.com/#point-57 // Re-resolve promises immediately to dodge false rejection from // subsequent errors if ( depth ) { process(); } else { // Call an optional hook to record the stack, in case of exception // since it's otherwise lost when execution goes async if ( jQuery.Deferred.getStackHook ) { process.stackTrace = jQuery.Deferred.getStackHook(); } window.setTimeout( process ); } }; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
resolve
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
mightThrow = function() { var returned, then; // Support: Promises/A+ section 2.3.3.3.3 // https://promisesaplus.com/#point-59 // Ignore double-resolution attempts if ( depth < maxDepth ) { return; } returned = handler.apply( that, args ); // Support: Promises/A+ section 2.3.1 // https://promisesaplus.com/#point-48 if ( returned === deferred.promise() ) { throw new TypeError( "Thenable self-resolution" ); } // Support: Promises/A+ sections 2.3.3.1, 3.5 // https://promisesaplus.com/#point-54 // https://promisesaplus.com/#point-75 // Retrieve `then` only once then = returned && // Support: Promises/A+ section 2.3.4 // https://promisesaplus.com/#point-64 // Only check objects and functions for thenability ( typeof returned === "object" || typeof returned === "function" ) && returned.then; // Handle a returned thenable if ( isFunction( then ) ) { // Special processors (notify) just wait for resolution if ( special ) { then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ) ); // Normal processors (resolve) also hook into progress } else { // ...and disregard older resolution values maxDepth++; then.call( returned, resolve( maxDepth, deferred, Identity, special ), resolve( maxDepth, deferred, Thrower, special ), resolve( maxDepth, deferred, Identity, deferred.notifyWith ) ); } // Handle all other returned values } else { // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Identity ) { that = undefined; args = [ returned ]; } // Process the value(s) // Default process is resolve ( special || deferred.resolveWith )( that, args ); } }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
mightThrow
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
updateFunc = function( i ) { return function( value ) { resolveContexts[ i ] = this; resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( !( --remaining ) ) { master.resolveWith( resolveContexts, resolveValues ); } }; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
updateFunc
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
completed
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; // Sets many values if ( toType( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < len; i++ ) { fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } } if ( chainable ) { return elems; } // Gets if ( bulk ) { return fn.call( elems ); } return len ? fn( elems[ 0 ], key ) : emptyGet; }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
access
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function fcamelCase( all, letter ) { return letter.toUpperCase(); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
fcamelCase
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
function camelCase( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
camelCase
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0
acceptData = function( owner ) { // Accepts only: // - Node // - Node.ELEMENT_NODE // - Node.DOCUMENT_NODE // - Object // - Any return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }
A low-level selection function that works with Sizzle's compiled selector functions @param {String|Function} selector A selector or a pre-compiled selector function built with Sizzle.compile @param {Element} context @param {Array} [results] @param {Array} [seed] A set of elements to match against
acceptData
javascript
douyu/juno
assets/public/js/jquery/v3.4.1/jquery.js
https://github.com/douyu/juno/blob/master/assets/public/js/jquery/v3.4.1/jquery.js
Apache-2.0