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 assignCodec(media, groupItem, codecProperty) { var codecValue = groupItem[codecProperty]; if (codecValue) { media[codecProperty] = codecValue; } }
Backfill any missing PDT values "If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after one or more Media Segment URIs, the client SHOULD extrapolate backward from that tag (using EXTINF durations and/or media timestamps) to associate dates with those segments." We have already extrapolated forward, but a...
assignCodec
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function backfillProgramDateTimes(fragments, firstPdtIndex) { var fragPrev = fragments[firstPdtIndex]; for (var i = firstPdtIndex; i--;) { var frag = fragments[i]; // Exit on delta-playlist skipped segments if (!frag) { return; } frag.programDateTime = fragPrev.programDateTime - frag.durati...
Backfill any missing PDT values "If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after one or more Media Segment URIs, the client SHOULD extrapolate backward from that tag (using EXTINF durations and/or media timestamps) to associate dates with those segments." We have already extrapolated forward, but a...
backfillProgramDateTimes
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function assignProgramDateTime(frag, prevFrag) { if (frag.rawProgramDateTime) { frag.programDateTime = Date.parse(frag.rawProgramDateTime); } else if (prevFrag !== null && prevFrag !== void 0 && prevFrag.programDateTime) { frag.programDateTime = prevFrag.endProgramDateTime; } if (!Object(_home_runner_w...
Backfill any missing PDT values "If the first EXT-X-PROGRAM-DATE-TIME tag in a Playlist appears after one or more Media Segment URIs, the client SHOULD extrapolate backward from that tag (using EXTINF durations and/or media timestamps) to associate dates with those segments." We have already extrapolated forward, but a...
assignProgramDateTime
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function mapContextToLevelType(context) { var type = context.type; switch (type) { case _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistContextType"].AUDIO_TRACK: return _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO; case _types_loader__WEBPACK_IMPORTED_MODULE_6__["Playli...
PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models. Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks. Uses loader(s) set in config to do actual internal loading of resource tasks. @module
mapContextToLevelType
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function getResponseUrl(response, context) { var url = response.url; // responseURL not supported on some browsers (it is used to detect URL redirection) // data-uri mode also not supported (but no need to detect redirection) if (url === undefined || url.indexOf('data:') === 0) { // fallback to initial URL ...
PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models. Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks. Uses loader(s) set in config to do actual internal loading of resource tasks. @module
getResponseUrl
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function PlaylistLoader(hls) { this.hls = void 0; this.loaders = Object.create(null); this.hls = hls; this.registerListeners(); }
PlaylistLoader - delegate for media manifest/playlist loading tasks. Takes care of parsing media to internal data-models. Once loaded, dispatches events with parsed data-models of manifest/levels/audio/subtitle tracks. Uses loader(s) set in config to do actual internal loading of resource tasks. @module
PlaylistLoader
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function alignStream(lastFrag, lastLevel, details) { if (!lastLevel) { return; } alignDiscontinuities(lastFrag, details, lastLevel); if (!details.alignedSliding && lastLevel.details) { // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level. ...
Using the parameters of the last level, this function computes PTS' of the new fragments so that they form a contiguous stream with the last fragments. The PTS of a fragment lets Hls.js know where it fits into a stream - by knowing every PTS, we know which fragment to download at any given time. PTS is normally compute...
alignStream
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function alignDiscontinuities(lastFrag, details, lastLevel) { if (shouldAlignOnDiscontinuities(lastFrag, lastLevel, details)) { var referenceFrag = findDiscontinuousReferenceFrag(lastLevel.details, details); if (referenceFrag && Object(_home_runner_work_hls_js_hls_js_src_polyfills_number__WEBPACK_IMPORTED_MO...
Computes the PTS if a new level's fragments using the PTS of a fragment in the last level which shares the same discontinuity sequence. @param lastFrag - The last Fragment which shares the same discontinuity sequence @param lastLevel - The details of the last loaded level @param details - The details of the new level
alignDiscontinuities
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function alignPDT(details, lastDetails) { // This check protects the unsafe "!" usage below for null program date time access. if (!lastDetails.fragments.length || !details.hasProgramDateTime || !lastDetails.hasProgramDateTime) { return; } // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME ...
Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level. @param details - The details of the new level @param lastDetails - The details of the last loaded level
alignPDT
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function alignFragmentByPDTDelta(frag, delta) { var programDateTime = frag.programDateTime; if (!programDateTime) return; var start = (programDateTime - delta) / 1000; frag.start = frag.startPTS = start; frag.endPTS = start + frag.duration; }
Computes the PTS of a new level's fragments using the difference in Program Date Time from the last level. @param details - The details of the new level @param lastDetails - The details of the last loaded level
alignFragmentByPDTDelta
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function alignMediaPlaylistByPDT(details, refDetails) { // This check protects the unsafe "!" usage below for null program date time access. if (!refDetails.fragments.length || !details.hasProgramDateTime || !refDetails.hasProgramDateTime) { return; } var refPDT = refDetails.fragments[0].programDateTime; /...
Ensures appropriate time-alignment between renditions based on PDT. Unlike `alignPDT`, which adjusts the timeline based on the delta between PDTs of the 0th fragment of two playlists/`LevelDetails`, this function assumes the timelines represented in `refDetails` are accurate, including the PDTs, and uses the "wallclock...
alignMediaPlaylistByPDT
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function parseInitSegment(initSegment) { var result = []; var traks = findBox(initSegment, ['moov', 'trak']); for (var i = 0; i < traks.length; i++) { var trak = traks[i]; var tkhd = findBox(trak, ['tkhd'])[0]; if (tkhd) { var version = tkhd.data[tkhd.start]; var _index = version === 0 ...
Parses an MP4 initialization segment and extracts stream type and timescale values for any declared tracks. Timescale values indicate the number of clock ticks per second to assume for time-based values elsewhere in the MP4. To determine the start time of an MP4, you need two pieces of information: the timescale unit ...
parseInitSegment
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function getStartDTS(initData, fmp4) { // we need info from two children of each track fragment box return findBox(fmp4, ['moof', 'traf']).reduce(function (result, traf) { var tfdt = findBox(traf, ['tfdt'])[0]; var version = tfdt.data[tfdt.start]; var start = findBox(traf, ['tfhd']).reduce(function (res...
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
getStartDTS
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function getDuration(data, initData) { var rawDuration = 0; var videoDuration = 0; var audioDuration = 0; var trafs = findBox(data, ['moof', 'traf']); for (var i = 0; i < trafs.length; i++) { var traf = trafs[i]; // There is only one tfhd & trun per traf // This is true for CMAF style content, and we...
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
getDuration
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function computeRawDurationFromSamples(trun) { var flags = readUint32(trun, 0); // Flags are at offset 0, non-optional sample_count is at offset 4. Therefore we start 8 bytes in. // Each field is an int32, which is 4 bytes var offset = 8; // data-offset-present flag if (flags & 0x000001) { offset += 4; ...
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
computeRawDurationFromSamples
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function offsetStartDTS(initData, fmp4, timeOffset) { findBox(fmp4, ['moof', 'traf']).forEach(function (traf) { findBox(traf, ['tfhd']).forEach(function (tfhd) { // get the track id from the tfhd var id = readUint32(tfhd, 4); var track = initData[id]; if (!track) { return; }...
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
offsetStartDTS
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function segmentValidRange(data) { var segmentedRange = { valid: null, remainder: null }; var moofs = findBox(data, ['moof']); if (!moofs) { return segmentedRange; } else if (moofs.length < 2) { segmentedRange.remainder = data; return segmentedRange; } var last = moofs[moofs.length -...
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
segmentValidRange
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function appendUint8Array(data1, data2) { var temp = new Uint8Array(data1.length + data2.length); temp.set(data1); temp.set(data2, data1.length); return temp; }
Determine the base media decode start time, in seconds, for an MP4 fragment. If multiple fragments are specified, the earliest time is returned. The base media decode time can be parsed from track fragment metadata: ``` moof > traf > tfdt.baseMediaDecodeTime ``` It requires the timescale value from the mdhd to interpr...
appendUint8Array
javascript
gongfuxiang/shopxo
public/static/common/lib/ckplayer/hls.js/hls.light.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ckplayer/hls.js/hls.light.js
MIT
function Clipboard(trigger, options) { _classCallCheck(this, Clipboard); var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); _this.resolveOptions(options); _this.listenClick(trigger); return _this; }
@param {String|HTMLElement|HTMLCollection|NodeList} trigger @param {Object} options
Clipboard
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function getAttributeValue(suffix, element) { var attribute = 'data-clipboard-' + suffix; if (!element.hasAttribute(attribute)) { return; } return element.getAttribute(attribute); }
Helper function to retrieve attribute value. @param {String} suffix @param {Element} element
getAttributeValue
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function listen(target, type, callback) { if (!target && !type && !callback) { throw new Error('Missing required arguments'); } if (!is.string(type)) { throw new TypeError('Second argument must be a String'); } if (!is.fn(callback)) { throw new TypeError('Third argument mus...
Validates all params and calls the right listener function based on its target type. @param {String|HTMLElement|HTMLCollection|NodeList} target @param {String} type @param {Function} callback @return {Object}
listen
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function listenNode(node, type, callback) { node.addEventListener(type, callback); return { destroy: function() { node.removeEventListener(type, callback); } } }
Adds an event listener to a HTML element and returns a remove listener function. @param {HTMLElement} node @param {String} type @param {Function} callback @return {Object}
listenNode
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function listenNodeList(nodeList, type, callback) { Array.prototype.forEach.call(nodeList, function(node) { node.addEventListener(type, callback); }); return { destroy: function() { Array.prototype.forEach.call(nodeList, function(node) { node.removeEventListener(...
Add an event listener to a list of HTML elements and returns a remove listener function. @param {NodeList|HTMLCollection} nodeList @param {String} type @param {Function} callback @return {Object}
listenNodeList
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function listenSelector(selector, type, callback) { return delegate(document.body, selector, type, callback); }
Add an event listener to a selector and returns a remove listener function. @param {String} selector @param {String} type @param {Function} callback @return {Object}
listenSelector
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function _delegate(element, selector, type, callback, useCapture) { var listenerFn = listener.apply(this, arguments); element.addEventListener(type, listenerFn, useCapture); return { destroy: function() { element.removeEventListener(type, listenerFn, useCapture); } } }
Delegates event to a selector. @param {Element} element @param {String} selector @param {String} type @param {Function} callback @param {Boolean} useCapture @return {Object}
_delegate
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function delegate(elements, selector, type, callback, useCapture) { // Handle the regular Element usage if (typeof elements.addEventListener === 'function') { return _delegate.apply(null, arguments); } // Handle Element-less usage, it defaults to global delegation if (typeof type === 'funct...
Delegates event to a selector. @param {Element|String|Array} [elements] @param {String} selector @param {String} type @param {Function} callback @param {Boolean} useCapture @return {Object}
delegate
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function listener(element, selector, type, callback) { return function(e) { e.delegateTarget = closest(e.target, selector); if (e.delegateTarget) { callback.call(element, e); } } }
Finds closest match and invokes callback. @param {Element} element @param {String} selector @param {String} type @param {Function} callback @return {Function}
listener
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function closest (element, selector) { while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { if (typeof element.matches === 'function' && element.matches(selector)) { return element; } element = element.parentNode; } }
Finds the closest parent that matches a selector. @param {Element} element @param {String} selector @return {Function}
closest
javascript
gongfuxiang/shopxo
public/static/common/lib/clipboard/clipboard.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/clipboard/clipboard.js
MIT
function QR8bitByte(data) { this.mode = QRMode.MODE_8BIT_BYTE; this.data = data; this.parsedData = []; // Added to support UTF-8 Characters for (var i = 0, l = this.data.length; i < l; i++) { var byteArray = []; var code = this.data.charCodeAt(i); if (code > 0x10000) { byteArray[0] = 0xF0 | ((c...
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QR8bitByte
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function QRCodeModel(typeNumber, errorCorrectLevel) { this.typeNumber = typeNumber; this.errorCorrectLevel = errorCorrectLevel; this.modules = null; this.moduleCount = 0; this.dataCache = null; this.dataList = []; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QRCodeModel
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);} var offset=0;while(offset<num.length&&num[offset]==0){offset++;} this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QRPolynomial
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function _isSupportCanvas() { return typeof CanvasRenderingContext2D != "undefined"; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
_isSupportCanvas
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function _getAndroid() { var android = false; var sAgent = navigator.userAgent; if (/android/i.test(sAgent)) { // android android = true; var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); if (aMat && aMat[1]) { android = parseFloat(aMat[1]); } } return android; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
_getAndroid
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
Drawing = function (el, htOption) { this._el = el; this._htOption = htOption; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
Drawing
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function makeSVG(tag, attrs) { var el = document.createElementNS('http://www.w3.org/2000/svg', tag); for (var k in attrs) if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); return el; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
makeSVG
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
Drawing = function (el, htOption) { this._el = el; this._htOption = htOption; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
Drawing
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function _safeSetDataURI(fSuccess, fFail) { var self = this; self._fFail = fFail; self._fSuccess = fSuccess; // Check it just once if (self._bSupportDataURI === null) { var el = document.createElement("img"); var fOnError = fun...
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
_safeSetDataURI
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
fOnError = function() { self._bSupportDataURI = false; if (self._fFail) { self._fFail.call(self); } }
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
fOnError
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
fOnSuccess = function() { self._bSupportDataURI = true; if (self._fSuccess) { self._fSuccess.call(self); } }
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
fOnSuccess
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
Drawing = function (el, htOption) { this._bIsPainted = false; this._android = _getAndroid(); this._htOption = htOption; this._elCanvas = document.createElement("canvas"); this._elCanvas.width = htOption.width; this._elCanvas.height = htOption.height; el.appendChild(this._elCanvas); this...
Drawing QRCode by using canvas @constructor @param {HTMLElement} el @param {Object} htOption QRCode Options
Drawing
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function _getTypeNumber(sText, nCorrectLevel) { var nType = 1; var length = _getUTF8Length(sText); for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { var nLimit = 0; switch (nCorrectLevel) { case QRErrorCorrectLevel.L : nLimit = QRCodeLimitLength[i][0]; break; case ...
Get the type by string length @private @param {String} sText @param {Number} nCorrectLevel @return {Number} type
_getTypeNumber
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function _getUTF8Length(sText) { var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); return replacedText.length + (replacedText.length != sText ? 3 : 0); }
Get the type by string length @private @param {String} sText @param {Number} nCorrectLevel @return {Number} type
_getUTF8Length
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/qrcode.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/qrcode.js
MIT
function scaleCanvas (canvas, width, height) { var w = canvas.width, h = canvas.height; if (width == undefined) { width = w; } if (height == undefined) { height = h; } var retCanvas = document.createElement('canvas'); var retCtx = retCanvas.getContext('2d'); retCanvas.width = width; retCanva...
covert canvas to image and save the image file
scaleCanvas
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function getDataURL (canvas, type, width, height) { canvas = scaleCanvas(canvas, width, height); return canvas.toDataURL(type); }
covert canvas to image and save the image file
getDataURL
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function saveFile (strData) { document.location.href = strData; }
covert canvas to image and save the image file
saveFile
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function genImage(strData) { var img = document.createElement('img'); img.src = strData; return img; }
covert canvas to image and save the image file
genImage
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function fixType (type) { type = type.toLowerCase().replace(/jpg/i, 'jpeg'); var r = type.match(/png|jpeg|bmp|gif/)[0]; return 'image/' + r; }
covert canvas to image and save the image file
fixType
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function encodeData (data) { if (!window.btoa) { throw 'btoa undefined' } var str = ''; if (typeof data == 'string') { str = data; } else { for (var i = 0; i < data.length; i ++) { str += String.fromCharCode(data[i]); } } return btoa(str); }
covert canvas to image and save the image file
encodeData
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function getImageData (canvas) { var w = canvas.width, h = canvas.height; return canvas.getContext('2d').getImageData(0, 0, w, h); }
covert canvas to image and save the image file
getImageData
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function makeURI (strData, type) { return 'data:' + type + ';base64,' + strData; }
covert canvas to image and save the image file
makeURI
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
saveAsImage = function (canvas, width, height, type) { if ($support.canvas && $support.dataURL) { if (typeof canvas == "string") { canvas = document.getElementById(canvas); } if (type == undefined) { type = 'png'; } type = fixType(type); if (/bmp/.test(type)) { var data = getImageData(scaleCanvas(canv...
saveAsImage @param canvasElement @param {String} image type @param {Number} [optional] png width @param {Number} [optional] png height
saveAsImage
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
convertToImage = function (canvas, width, height, type) { if ($support.canvas && $support.dataURL) { if (typeof canvas == "string") { canvas = document.getElementById(canvas); } if (type == undefined) { type = 'png'; } type = fixType(type); if (/bmp/.test(type)) { var data = getImageData(scaleCanvas(...
saveAsImage @param canvasElement @param {String} image type @param {Number} [optional] png width @param {Number} [optional] png height
convertToImage
javascript
gongfuxiang/shopxo
public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/hiprint/plugins/jspdf/canvas2image.js
MIT
function insertLine(arr, current, begin) { arr.push(breakChar); return current + (begin ? 1 : -1); }
Created with JetBrains PhpStorm. User: campaign Date: 10/8/13 Time: 6:15 PM To change this template use File | Settings | File Templates.
insertLine
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/ueditor.all.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/ueditor.all.js
MIT
function isComment(node, arr) { arr.push('<!--' + node.data + '-->'); }
Created with JetBrains PhpStorm. User: campaign Date: 10/8/13 Time: 6:15 PM To change this template use File | Settings | File Templates.
isComment
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/ueditor.all.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/ueditor.all.js
MIT
function getNodeById(root, id) { var node; if (root.type == 'element' && root.getAttr('id') == id) { return root; } if (root.children && root.children.length) { for (var i = 0, ci; ci = root.children[i++];) { if (node = getNodeById(ci, id)) { ...
Created with JetBrains PhpStorm. User: campaign Date: 10/8/13 Time: 6:15 PM To change this template use File | Settings | File Templates.
getNodeById
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/ueditor.all.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/ueditor.all.js
MIT
function getNodesByTagName(node, tagName, arr) { if (node.type == 'element' && node.tagName == tagName) { arr.push(node); } if (node.children && node.children.length) { for (var i = 0, ci; ci = node.children[i++];) { getNodesByTagName(ci, tagName, arr) ...
Created with JetBrains PhpStorm. User: campaign Date: 10/8/13 Time: 6:15 PM To change this template use File | Settings | File Templates.
getNodesByTagName
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/ueditor.all.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/ueditor.all.js
MIT
function Pane(options, chart, firstAxis) { this.init.call(this, options, chart, firstAxis); }
The Pane object allows options that are common to a set of X and Y axes. In the future, this can be extended to basic Highcharts and Highstock.
Pane
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
MIT
function initArea(proceed, chart, options) { proceed.call(this, chart, options); if (this.chart.polar) { /** * Overridden method to close a segment path. While in a cartesian plane the area * goes down to the threshold, in the polar chart it goes to the center. */ this.closeSegment = function (path) ...
Add some special init logic to areas and areasplines
initArea
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
MIT
function polarAnimate(proceed, init) { var chart = this.chart, animation = this.options.animation, group = this.group, markerGroup = this.markerGroup, center = this.xAxis.center, plotLeft = chart.plotLeft, plotTop = chart.plotTop, attribs; // Specific animation for polar charts if (chart.polar) { ...
Extend getSegmentPath to allow connecting ends across 0 to provide a closed circle in line-like series.
polarAnimate
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts-more.src.js
MIT
function extend(a, b) { var n; if (!a) { a = {}; } for (n in b) { a[n] = b[n]; } return a; }
Extend an object with the members of another @param {Object} a The object to be extended @param {Object} b The object to add to the first one
extend
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function hash() { var i = 0, args = arguments, length = args.length, obj = {}; for (; i < length; i++) { obj[args[i++]] = args[i]; } return obj; }
Take an array and turn into a hash with even number arguments as keys and odd numbers as values. Allows creating constants for commonly used style properties, attributes etc. Avoid it in performance critical situations like looping
hash
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function pInt(s, mag) { return parseInt(s, mag || 10); }
Shortcut for parseInt @param {Object} s @param {Number} mag Magnitude
pInt
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function isObject(obj) { return typeof obj === 'object'; }
Check for object @param {Object} obj
isObject
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function isArray(obj) { return Object.prototype.toString.call(obj) === '[object Array]'; }
Check for array @param {Object} obj
isArray
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function erase(arr, item) { var i = arr.length; while (i--) { if (arr[i] === item) { arr.splice(i, 1); break; } } //return arr; }
Remove last occurence of an item from an array @param {Array} arr @param {Mixed} item
erase
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function defined(obj) { return obj !== UNDEFINED && obj !== null; }
Returns true if the object is not null or undefined. Like MooTools' $.defined. @param {Object} obj
defined
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function attr(elem, prop, value) { var key, setAttribute = 'setAttribute', ret; // if the prop is a string if (isString(prop)) { // set the value if (defined(value)) { elem[setAttribute](prop, value); // get the value } else if (elem && elem.getAttribute) { // elem not defined when printing pie dem...
Set or get an attribute or an object of attributes. Can't use jQuery attr because it attempts to set expando properties on the SVG element, which is not allowed. @param {Object} elem The DOM element to receive the attribute(s) @param {String|Object} prop The property or an abject of key-value pairs @param {String} val...
attr
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function splat(obj) { return isArray(obj) ? obj : [obj]; }
Check if an element is an array, and if not, make it into an array. Like MooTools' $.splat.
splat
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function pick() { var args = arguments, i, arg, length = args.length; for (i = 0; i < length; i++) { arg = args[i]; if (typeof arg !== 'undefined' && arg !== null) { return arg; } } }
Return the first value that is defined. Like MooTools' $.pick.
pick
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function css(el, styles) { if (isIE) { if (styles && styles.opacity !== UNDEFINED) { styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')'; } } extend(el.style, styles); }
Set CSS on a given element @param {Object} el @param {Object} styles Style object with camel case property names
css
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function createElement(tag, attribs, styles, parent, nopad) { var el = doc.createElement(tag); if (attribs) { extend(el, attribs); } if (nopad) { css(el, {padding: 0, border: NONE, margin: 0}); } if (styles) { css(el, styles); } if (parent) { parent.appendChild(el); } return el; }
Utility function to create element with attributes and styles @param {Object} tag @param {Object} attribs @param {Object} styles @param {Object} parent @param {Object} nopad
createElement
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function extendClass(parent, members) { var object = function () {}; object.prototype = new parent(); extend(object.prototype, members); return object; }
Extend a prototyped class by new members @param {Object} parent @param {Object} members
extendClass
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function numberFormat(number, decimals, decPoint, thousandsSep) { var lang = defaultOptions.lang, // http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_number_format/ n = +number || 0, c = decimals === -1 ? (n.toString().split('.')[1] || '').length : // preserve decimals (isNaN(d...
Format a number and return a string based on input settings @param {Number} number The input number to format @param {Number} decimals The amount of decimals @param {String} decPoint The decimal point, defaults to the one given in the lang options @param {String} thousandsSep The thousands separator, defaults to the on...
numberFormat
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function pad(number, length) { // Create an array of the remaining length +1 and join it with 0's return new Array((length || 2) + 1 - String(number).length).join(0) + number; }
Pad a string to a given length by adding 0 to the beginning @param {Number} number @param {Number} length
pad
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function wrap(obj, method, func) { var proceed = obj[method]; obj[method] = function () { var args = Array.prototype.slice.call(arguments); args.unshift(proceed); return func.apply(this, args); }; }
Wrap a method with extended functionality, preserving the original function @param {Object} obj The context object that the method belongs to @param {String} method The name of the method to extend @param {Function} func A wrapper function callback. This function is called with the same arguments as the original funct...
wrap
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function formatSingle(format, val) { var floatRegex = /f$/, decRegex = /\.([0-9])/, lang = defaultOptions.lang, decimals; if (floatRegex.test(format)) { // float decimals = format.match(decRegex); decimals = decimals ? decimals[1] : -1; val = numberFormat( val, decimals, lang.decimalPoint, fo...
Format a single variable. Similar to sprintf, without the % prefix.
formatSingle
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function format(str, ctx) { var splitter = '{', isInside = false, segment, valueAndFormat, path, i, len, ret = [], val, index; while ((index = str.indexOf(splitter)) !== -1) { segment = str.slice(0, index); if (isInside) { // we're on the closing bracket looking back valueAndFormat =...
Format a string according to a subset of the rules of Python's String.format method.
format
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function normalizeTickInterval(interval, multiples, magnitude, options) { var normalized, i; // round to a tenfold of 1, 2, 2.5 or 5 magnitude = pick(magnitude, 1); normalized = interval / magnitude; // multiples for a linear scale if (!multiples) { multiples = [1, 2, 2.5, 5, 10]; // the allowDecimals opti...
Take an interval and normalize it to multiples of 1, 2, 2.5 and 5 @param {Number} interval @param {Array} multiples @param {Number} magnitude @param {Object} options
normalizeTickInterval
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function normalizeTimeTickInterval(tickInterval, unitsOption) { var units = unitsOption || [[ MILLISECOND, // unit name [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples ], [ SECOND, [1, 2, 5, 10, 15, 30] ], [ MINUTE, [1, 2, 5, 10, 15, 30] ], [ HOUR, [1, 2, 3, 4, 6,...
Get a normalized tick interval for dates. Returns a configuration object with unit range (interval), count and name. Used to prepare data for getTimeTicks. Previously this logic was part of getTimeTicks, but as getTimeTicks now runs of segments in stock charts, the normalizing logic was extracted in order to prevent ...
normalizeTimeTickInterval
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function getTimeTicks(normalizedInterval, min, max, startOfWeek) { var tickPositions = [], i, higherRanks = {}, useUTC = defaultOptions.global.useUTC, minYear, // used in months and years as a basis for Date.UTC() minDate = new Date(min), interval = normalizedInterval.unitRange, count = normalizedInterva...
Set the tick positions to a time unit that makes sense, for example on the first of each month or on every Monday. Return an array with the time positions. Used in datetime axes as well as for grouping data on a datetime axis. @param {Object} normalizedInterval The interval in axis values (ms) and the count @param {Nu...
getTimeTicks
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function ChartCounters() { this.color = 0; this.symbol = 0; }
Helper class that contains variuos counters that are local to the chart.
ChartCounters
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function stableSort(arr, sortFunction) { var length = arr.length, sortValue, i; // Add index to each item for (i = 0; i < length; i++) { arr[i].ss_i = i; // stable sort index } arr.sort(function (a, b) { sortValue = sortFunction(a, b); return sortValue === 0 ? a.ss_i - b.ss_i : sortValue; }); // Rem...
Utility method that sorts an object array and keeping the order of equal items. ECMA script standard does not specify the behaviour when items are equal.
stableSort
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function arrayMin(data) { var i = data.length, min = data[0]; while (i--) { if (data[i] < min) { min = data[i]; } } return min; }
Non-recursive method to find the lowest member of an array. Math.min raises a maximum call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This method is slightly slower, but safe.
arrayMin
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function arrayMax(data) { var i = data.length, max = data[0]; while (i--) { if (data[i] > max) { max = data[i]; } } return max; }
Non-recursive method to find the lowest member of an array. Math.min raises a maximum call stack size exceeded error in Chrome when trying to apply more than 150.000 points. This method is slightly slower, but safe.
arrayMax
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function destroyObjectProperties(obj, except) { var n; for (n in obj) { // If the object is non-null and destroy is defined if (obj[n] && obj[n] !== except && obj[n].destroy) { // Invoke the destroy obj[n].destroy(); } // Delete the property from the object. delete obj[n]; } }
Utility method that destroys any SVGElement or VMLElement that are properties on the given object. It loops all properties and invokes destroy if there is a destroy method. The property is then delete'ed. @param {Object} The object to destroy properties on @param {Object} Exception, do not destroy this property, only d...
destroyObjectProperties
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function discardElement(element) { // create a garbage bin element, not part of the DOM if (!garbageBin) { garbageBin = createElement(DIV); } // move the node and empty bin if (element) { garbageBin.appendChild(element); } garbageBin.innerHTML = ''; }
Discard an element by moving it to the bin and delete @param {Object} The HTML node to discard
discardElement
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function error(code, stop) { var msg = 'Highcharts error #' + code + ': www.highcharts.com/errors/' + code; if (stop) { throw msg; } else if (win.console) { console.log(msg); } }
Provide error messages for debugging, with links to online explanation
error
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function correctFloat(num) { return parseFloat( num.toPrecision(14) ); }
Fix JS round off float errors @param {Number} num
correctFloat
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function setAnimation(animation, chart) { globalAnimation = pick(animation, chart.animation); }
Set the global animation to either a given value, or fall back to the given chart's animation option @param {Object} animation @param {Object} chart
setAnimation
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
sixify = function (arr) { // in splines make move points have six parameters like bezier curves i = arr.length; while (i--) { if (arr[i] === M) { arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]); } } }
Prepare start and end values so that the path can be animated one to one
sixify
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function setTimeMethods() { var useUTC = defaultOptions.global.useUTC, GET = useUTC ? 'getUTC' : 'get', SET = useUTC ? 'setUTC' : 'set'; makeTime = useUTC ? Date.UTC : function (year, month, date, hours, minutes, seconds) { return new Date( year, month, pick(date, 1), pick(hours, 0), pick(minute...
Set the time methods globally based on the useUTC option. Time method can be either local time or UTC (default).
setTimeMethods
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function setOptions(options) { // Pull out axis options and apply them to the respective default axis options /*defaultXAxisOptions = merge(defaultXAxisOptions, options.xAxis); defaultYAxisOptions = merge(defaultYAxisOptions, options.yAxis); options.xAxis = options.yAxis = UNDEFINED;*/ // Merge in the default...
Merge the default options with custom options and return the new options structure @param {Object} options The new custom options
setOptions
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function getOptions() { return defaultOptions; }
Get the updated default options. Merely exposing defaultOptions for outside modules isn't enough because the setOptions method creates a new object.
getOptions
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
Color = function (input) { // declare variables var rgba = [], result, stops; /** * Parse the input color to rgba array * @param {String} input */ function init(input) { // Gradients if (input && input.stops) { stops = map(input.stops, function (stop) { return Color(stop[1]); }); // Solid c...
Handle color operations. The object methods are chainable. @param {String} input The input color in either rbga or hex format
Color
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function init(input) { // Gradients if (input && input.stops) { stops = map(input.stops, function (stop) { return Color(stop[1]); }); // Solid colors } else { // rgba result = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(input); if (res...
Parse the input color to rgba array @param {String} input
init
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function get(format) { var ret; if (stops) { ret = merge(input); ret.stops = [].concat(ret.stops); each(stops, function (stop, i) { ret.stops[i] = [ret.stops[i][0], stop.get(format)]; }); // it's NaN if gradient colors on a column chart } else if (rgba && !isNaN(rgba[0])) { if (format === '...
Return the color a specified format @param {String} format
get
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function brighten(alpha) { if (stops) { each(stops, function (stop) { stop.brighten(alpha); }); } else if (isNumber(alpha) && alpha !== 0) { var i; for (i = 0; i < 3; i++) { rgba[i] += pInt(alpha * 255); if (rgba[i] < 0) { rgba[i] = 0; } if (rgba[i] > 255) { rgba[i] = 2...
Brighten the color @param {Number} alpha
brighten
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function setOpacity(alpha) { rgba[3] = alpha; return this; }
Set the color's opacity to a given alpha value @param {Number} alpha
setOpacity
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function updateBoxSize() { var boxX, boxY, style = text.element.style; bBox = (width === undefined || height === undefined || wrapper.styles.textAlign) && text.getBBox(); wrapper.width = (width || bBox.width || 0) + 2 * padding + paddingLeft; wrapper.height = (height || bBox.height || 0) + 2 * ...
This function runs after the label is added to the DOM (when the bounding box is available), and after the text of the label is updated to detect the new bounding box and reflect it in the border box.
updateBoxSize
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT
function updateTextPadding() { var styles = wrapper.styles, textAlign = styles && styles.textAlign, x = paddingLeft + padding * (1 - alignFactor), y; // determin y based on the baseline y = baseline ? 0 : baselineOffset; // compensate for alignment if (defined(width) && (textAlign === 'cent...
This function runs after setting text or padding, but only if padding is changed
updateTextPadding
javascript
gongfuxiang/shopxo
public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
https://github.com/gongfuxiang/shopxo/blob/master/public/static/common/lib/ueditor/third-party/highcharts/highcharts.src.js
MIT